[PATCH 1/4] comctl32/combo: Add test for WM_CTLCOLORSTATIC

Fabian Maurer dark.shadow4 at web.de
Sun Sep 22 09:11:54 CDT 2019


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

diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c
index 923d826b30..b4130139dd 100644
--- a/dlls/comctl32/tests/combo.c
+++ b/dlls/comctl32/tests/combo.c
@@ -46,6 +46,8 @@ static HWND hComboExParentWnd, hMainWnd;
 static HINSTANCE hMainHinst;
 static const char ComboExTestClass[] = "ComboExTestClass";

+static HBRUSH brush_red;
+
 static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR);

 #define MAX_CHARS 100
@@ -507,6 +509,8 @@ static BOOL init(void)
     wc.lpfnWndProc = ComboExTestWndProc;
     RegisterClassA(&wc);

+    brush_red = CreateSolidBrush(RGB(255, 0, 0));
+
     hMainWnd = CreateWindowA(WC_STATICA, "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
     ShowWindow(hMainWnd, SW_SHOW);

@@ -533,6 +537,7 @@ static void cleanup(void)
     UnregisterClassA(ComboExTestClass, GetModuleHandleA(NULL));

     DestroyWindow(hMainWnd);
+    DeleteObject(brush_red);
 }

 static void test_comboex_subclass(void)
@@ -717,6 +722,7 @@ static LRESULT (CALLBACK *old_parent_proc)(HWND hwnd, UINT msg, WPARAM wparam, L
 static LPCSTR expected_edit_text;
 static LPCSTR expected_list_text;
 static BOOL selchange_fired;
+static HWND lparam_for_WM_CTLCOLOR = 0;

 static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
@@ -748,6 +754,19 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
             break;
         }
         break;
+    case WM_CTLCOLOR:
+    case WM_CTLCOLORMSGBOX:
+    case WM_CTLCOLOREDIT:
+    case WM_CTLCOLORLISTBOX:
+    case WM_CTLCOLORBTN:
+    case WM_CTLCOLORDLG:
+    case WM_CTLCOLORSCROLLBAR:
+    case WM_CTLCOLORSTATIC:
+        if (lparam_for_WM_CTLCOLOR)
+        {
+            ok(lparam_for_WM_CTLCOLOR == (HWND)lparam, "Expected %p, got %p\n", lparam_for_WM_CTLCOLOR, (HWND)lparam);
+        }
+        return (LRESULT) brush_red;
     }

     return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam);
@@ -1254,6 +1273,60 @@ static void test_combo_dropdown_size(DWORD style)
     }
 }

+static void test_color_messages(void)
+{
+    HBRUSH brush;
+    int result;
+    COMBOBOXINFO info;
+    HWND handle_combo = create_combobox(CBS_DROPDOWN);
+
+    old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc);
+
+    info.cbSize = sizeof(COMBOBOXINFO);
+    SetLastError(0xdeadbeef);
+    result = GetComboBoxInfo(handle_combo, &info);
+    ok(result, "Failed to get combobox info structure.\n");
+
+    lparam_for_WM_CTLCOLOR = info.hwndItem;
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOR, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORMSGBOX, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLOREDIT, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORLISTBOX, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORBTN, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORDLG, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSCROLLBAR, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSTATIC, 0, (LPARAM)info.hwndItem);
+    todo_wine
+    ok(brush == brush_red, "Expected %p, got %p\n", brush_red, brush);
+
+    lparam_for_WM_CTLCOLOR = 0;
+
+    DestroyWindow(handle_combo);
+    SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
+}
+
 START_TEST(combo)
 {
     ULONG_PTR ctx_cookie;
@@ -1281,6 +1354,7 @@ START_TEST(combo)
     }

     /* ComboBox control tests. */
+    test_color_messages();
     test_combo_WS_VSCROLL();
     test_combo_setfont(CBS_DROPDOWN);
     test_combo_setfont(CBS_DROPDOWNLIST);
--
2.23.0




More information about the wine-devel mailing list