[PATCH 1/6] user32/static: Add test for CTLCOLOR_STATIC inside DefWndProc

Fabian Maurer dark.shadow4 at web.de
Sat Sep 21 13:35:03 CDT 2019


Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/user32/tests/static.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/dlls/user32/tests/static.c b/dlls/user32/tests/static.c
index 8776c3a9e0..84be11254b 100644
--- a/dlls/user32/tests/static.c
+++ b/dlls/user32/tests/static.c
@@ -36,6 +36,8 @@ static HWND hMainWnd;

 static int g_nReceivedColorStatic = 0;

+static BOOL handle_WM_CTLCOLORSTATIC = TRUE;
+
 /* try to make sure pending X events have been processed before continuing */
 static void flush_events(void)
 {
@@ -62,6 +64,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
     switch (msg)
     {
     case WM_CTLCOLORSTATIC:
+        if (handle_WM_CTLCOLORSTATIC)
         {
             HDC hdc = (HDC)wparam;
             HRGN hrgn = CreateRectRgn(0, 0, 1, 1);
@@ -130,6 +133,26 @@ static void test_set_text(void)
     DestroyWindow(hStatic);
 }

+static void test_WM_CTLCOLORSTATIC(void)
+{
+    HBRUSH brush;
+    LOGBRUSH logbrush;
+    int result;
+    HWND handle_static = build_static(SS_SIMPLE);
+    COLORREF color_expected = GetSysColor(COLOR_3DFACE);
+
+    handle_WM_CTLCOLORSTATIC = FALSE;
+    brush = (HBRUSH)SendMessageA(hMainWnd, WM_CTLCOLORSTATIC, 0, (LPARAM)handle_static);
+    handle_WM_CTLCOLORSTATIC = TRUE;
+
+    result = GetObjectA(brush, sizeof(logbrush), &logbrush);
+    ok(result > 0, "GetObject failed: %d!\n", GetLastError());
+
+    ok(logbrush.lbColor == color_expected, "Expected %x, got %x\n", color_expected, logbrush.lbColor);
+
+    DestroyWindow(handle_static);
+}
+
 START_TEST(static)
 {
     static const char szClassName[] = "testclass";
@@ -162,6 +185,7 @@ START_TEST(static)
     test_updates(SS_ETCHEDHORZ, TODO_COUNT);
     test_updates(SS_ETCHEDVERT, TODO_COUNT);
     test_set_text();
+    test_WM_CTLCOLORSTATIC();

     DestroyWindow(hMainWnd);
 }
--
2.23.0




More information about the wine-devel mailing list