[PATCH 4/4] dwmapi: add test for Dwmp{Get,Set}ColorizationParameters
Louis Lenders
xerox.xerox2000x at gmail.com
Mon Oct 22 14:26:18 CDT 2018
Tests for Dwmp{Get,Set}ColorizationParameters, I could verify that the
first parameter is color RGB, and the 5th an 7th give a ``blur behind
window`` and opacity effect. As for the others: i guess one have to have
a trained/artistic eye to see the effects.
Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
---
dlls/dwmapi/tests/dwmapi.c | 87 +++++++++++++++++++++++++++++++++++++-
1 file changed, 86 insertions(+), 1 deletion(-)
diff --git a/dlls/dwmapi/tests/dwmapi.c b/dlls/dwmapi/tests/dwmapi.c
index 1307206362..7ede96ce8b 100644
--- a/dlls/dwmapi/tests/dwmapi.c
+++ b/dlls/dwmapi/tests/dwmapi.c
@@ -23,8 +23,20 @@
#include "wine/test.h"
+typedef struct _DWMCOLORIZATIONPARAMS {
+ DWORD color;
+ DWORD glow;
+ DWORD color_int;
+ DWORD glow_int;
+ DWORD blur_int;
+ DWORD refl_int;
+ DWORD opaque;
+} DWMCOLORIZATIONPARAMS;
+
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL*);
static HRESULT (WINAPI *pDwmEnableComposition)(UINT);
+static HRESULT (WINAPI *pDwmpGetColorizationParameters)(DWMCOLORIZATIONPARAMS*);
+static HRESULT (WINAPI *pDwmpSetColorizationParameters)(DWMCOLORIZATIONPARAMS*,BOOL);
BOOL dwmenabled;
@@ -69,6 +81,76 @@ static void test_isdwmenabled(void)
}
}
+static void test_colorization(void)
+{
+ int i;
+ HRESULT res;
+ DWMCOLORIZATIONPARAMS p0 = {0}; /*to store initial values to restore desktop appearance later */
+
+ DWMCOLORIZATIONPARAMS p[] =
+ {
+ { 0, 0, 0, 0, 0, 0, 0},
+ {0x00FF0000, 0, 0, 0, 0, 0, 0},
+ {0x00FF0000, 0x00FF0000, 0, 0, 0, 0, 0},
+ {0x00FF0000, 0, 0x00FF0000, 0, 0, 0, 0},
+ {0x00FF0000, 0x00FF0000, 0x00FF0000, 0, 0, 0, 0},
+ {0x00FF0000, 0 ,0x00FF0000, 0x00FF0000, 0, 0, 0},
+ {0x00FF0000, 0, 0x00FF0000, 0, 0x00FF0000, 0, 0}, /* 5th parameter gives some kind of transparancy */
+ {0x00FF0000, 0, 0x00FF0000, 0, 0, 0x00FF0000, 0},
+ {0x00FF0000, 0, 0x00FF0000, 0, 0, 0, 0x00FF0000}
+ };
+
+ if (!pDwmpSetColorizationParameters || !pDwmpGetColorizationParameters)
+ win_skip("function pointer pDwmp{S,G}etColorizationParameters not found in dwmapi, skipping test\n");
+
+ res = pDwmpGetColorizationParameters(NULL);
+ ok(res == E_INVALIDARG, "got %x expected E_INVALIDARG\n", res);
+
+ /*DwmpGetColorizationParameters returns success, whether DWM is enabled or not*/
+ res = pDwmpGetColorizationParameters(&p0);
+ todo_wine ok(res == S_OK, "got %x expected S_OK\n", res);
+
+ if (winetest_debug > 1)
+ trace("initial %x, %x, %d, %d, %d, %d, %d\n", p0.color, p0.glow, p0.color_int, p0.glow_int,
+ p0.blur_int, p0.refl_int, p0.opaque);
+
+ for (i = 0; i < ARRAY_SIZE(p); i++)
+ {
+ res = pDwmpSetColorizationParameters(&p[i], FALSE);
+
+ if (dwmenabled)
+ {
+ todo_wine ok(res == S_OK, "got %x expected S_OK\n", res);
+
+ if (winetest_debug > 1)
+ {
+ trace("testing %x, %x, %d, %d, %d, %d, %d\n", p[i].color, p[i].glow, p[i].color_int, p[i].glow_int,
+ p[i].blur_int, p[i].refl_int, p[i].opaque);
+ Sleep(4000);
+ }
+ }
+ else
+ ok(res == DWM_E_COMPOSITIONDISABLED, "got %x expected DWM_E_COMPOSITIONDISABLED\n", res);
+
+ res = pDwmpGetColorizationParameters(&p[i]);
+ todo_wine ok(res == S_OK, "got %x expected S_OK\n", res);
+ /* these parameters have max. value 120 -->intensity values (?) */
+ ok(p[i].color_int <= 120 && p[i].glow_int <= 120 && p[i].blur_int <= 120 && p[i].refl_int <=120, \
+ "test failed, got %d %d %d %d\n", p[i].color_int, p[i].glow_int, p[i].blur_int, p[i].refl_int);
+
+ if (winetest_debug > 1)
+ trace("got %x, %x, %d, %d, %d, %d, %d\n", p[i].color, p[i].glow, p[i].color_int, p[i].glow_int,
+ p[i].blur_int, p[i].refl_int, p[i].opaque);
+ }
+
+ /* restore initial values (note: if last param is TRUE, this somehow doesn`t work */
+ res = pDwmpSetColorizationParameters(&p0, FALSE);
+ if (dwmenabled)
+ todo_wine ok(res == S_OK, "got %x expected S_OK\n", res);
+ else
+ ok(res == DWM_E_COMPOSITIONDISABLED, "got %x expected DWM_E_COMPOSITIONDISABLED\n", res);
+}
+
START_TEST(dwmapi)
{
HMODULE hmod = LoadLibraryA("dwmapi.dll");
@@ -81,12 +163,15 @@ START_TEST(dwmapi)
pDwmIsCompositionEnabled = (void *)GetProcAddress(hmod, "DwmIsCompositionEnabled");
pDwmEnableComposition = (void *)GetProcAddress(hmod, "DwmEnableComposition");
+ pDwmpGetColorizationParameters = (void *)GetProcAddress(hmod, (LPSTR)127);
+ pDwmpSetColorizationParameters = (void *)GetProcAddress(hmod, (LPSTR)131);
if (!pDwmIsCompositionEnabled || !pDwmEnableComposition)
{
- trace("essential function pointers not found, skipping tests\n");
+ trace("essential function pointers not found, skipping all tests\n");
return;
}
test_isdwmenabled();
+ test_colorization();
}
--
2.17.1
More information about the wine-devel
mailing list