From: Fabian Maurer dark.shadow4@web.de
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/tests/combo.c | 98 +++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 923d826b30..be4ee53c22 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;
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -748,6 +754,20 @@ 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; + } + break; }
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam); @@ -1254,6 +1274,83 @@ static void test_combo_dropdown_size(DWORD style) } }
+static void test_combo_ctlcolor(void) +{ + static const int messages[] = + { + WM_CTLCOLOR, + WM_CTLCOLORMSGBOX, + WM_CTLCOLOREDIT, + WM_CTLCOLORLISTBOX, + WM_CTLCOLORBTN, + WM_CTLCOLORDLG, + WM_CTLCOLORSCROLLBAR, + WM_CTLCOLORSTATIC, + }; + + HBRUSH brush, global_brush; + COMBOBOXINFO info; + unsigned int i; + HWND combo; + + combo = create_combobox(CBS_DROPDOWN); + ok(!!combo, "Failed to create combo window.\n"); + + old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc); + + get_combobox_info(combo, &info); + + lparam_for_WM_CTLCOLOR = info.hwndItem; + + /* Parent returns valid brush handle. */ + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "%u: unexpected brush %p, expected got %p.\n", i, brush, brush_red); + } + + /* Parent returns NULL brush. */ + global_brush = brush_red; + brush_red = NULL; + + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + todo_wine + ok(!brush, "%u: unexpected brush %p.\n", i, brush); + } + + brush_red = global_brush; + + lparam_for_WM_CTLCOLOR = 0; + + /* Parent does default processing. */ + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + ok(!!brush && brush != brush_red, "%u: unexpected brush %p.\n", i, brush); + } + + SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc); + DestroyWindow(combo); + + /* Combo without a parent. */ + combo = CreateWindowA(WC_COMBOBOXA, "Combo", CBS_DROPDOWN, 5, 5, 100, 100, NULL, NULL, NULL, 0); + ok(!!combo, "Failed to create combo window.\n"); + + get_combobox_info(combo, &info); + + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + todo_wine + ok(!brush, "%u: unexpected brush %p.\n", i, brush); + } + + DestroyWindow(combo); +} + START_TEST(combo) { ULONG_PTR ctx_cookie; @@ -1297,6 +1394,7 @@ START_TEST(combo) test_combo_listbox_styles(CBS_DROPDOWNLIST); test_combo_dropdown_size(0); test_combo_dropdown_size(CBS_NOINTEGRALHEIGHT); + test_combo_ctlcolor();
cleanup(); unload_v6_module(ctx_cookie, hCtx);
From: Fabian Maurer dark.shadow4@web.de
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/user32/tests/combo.c | 99 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+)
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index 0d3b1b170f..289e1d3f56 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -173,6 +173,8 @@ 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; +static HBRUSH brush_red;
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -204,6 +206,20 @@ 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; + } + break; }
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam); @@ -804,8 +820,89 @@ static void test_WS_VSCROLL(void) DestroyWindow(hCombo); }
+static void test_combo_ctlcolor(void) +{ + static const int messages[] = + { + WM_CTLCOLOR, + WM_CTLCOLORMSGBOX, + WM_CTLCOLOREDIT, + WM_CTLCOLORLISTBOX, + WM_CTLCOLORBTN, + WM_CTLCOLORDLG, + WM_CTLCOLORSCROLLBAR, + WM_CTLCOLORSTATIC, + }; + + HBRUSH brush, global_brush; + unsigned int i, ret; + COMBOBOXINFO info; + HWND combo; + + combo = build_combo(CBS_DROPDOWN); + ok(!!combo, "Failed to create combo window.\n"); + + old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc); + + info.cbSize = sizeof(COMBOBOXINFO); + ret = GetComboBoxInfo(combo, &info); + ok(ret, "Failed to get combobox info structure.\n"); + + lparam_for_WM_CTLCOLOR = info.hwndItem; + + /* Parent returns valid brush handle. */ + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + todo_wine + ok(brush == brush_red, "%u: unexpected brush %p, expected got %p.\n", i, brush, brush_red); + } + + /* Parent returns NULL brush. */ + global_brush = brush_red; + brush_red = NULL; + + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + todo_wine + ok(!brush, "%u: unexpected brush %p.\n", i, brush); + } + + brush_red = global_brush; + + lparam_for_WM_CTLCOLOR = 0; + + /* Parent does default processing. */ + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + ok(!!brush && brush != brush_red, "%u: unexpected brush %p.\n", i, brush); + } + + SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc); + DestroyWindow(combo); + + /* Combo without a parent. */ + combo = CreateWindowA("ComboBox", "Combo", CBS_DROPDOWN, 5, 5, 100, 100, NULL, NULL, NULL, 0); + ok(!!combo, "Failed to create combo window.\n"); + + info.cbSize = sizeof(COMBOBOXINFO); + ret = GetComboBoxInfo(combo, &info); + ok(ret, "Failed to get combobox info structure.\n"); + + for (i = 0; i < ARRAY_SIZE(messages); ++i) + { + brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); + ok(!!brush && brush != brush_red, "%u: unexpected brush %p.\n", i, brush); + } + + DestroyWindow(combo); +} + START_TEST(combo) { + brush_red = CreateSolidBrush(RGB(255, 0, 0)); hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0); ShowWindow(hMainWnd, SW_SHOW);
@@ -825,6 +922,8 @@ START_TEST(combo) test_listbox_styles(CBS_DROPDOWN); test_listbox_styles(CBS_DROPDOWNLIST); test_listbox_size(CBS_DROPDOWN); + test_combo_ctlcolor();
DestroyWindow(hMainWnd); + DeleteObject(brush_red); }
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46417 Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/combo.c | 10 ++++++++++ dlls/comctl32/tests/combo.c | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/combo.c b/dlls/comctl32/combo.c index 8a52a0bdc0..599817aed4 100644 --- a/dlls/comctl32/combo.c +++ b/dlls/comctl32/combo.c @@ -1963,6 +1963,16 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0); return TRUE;
+ case WM_CTLCOLOR: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + return SendMessageW(lphc->owner, message, wParam, lParam); + /* Combo messages */ case CB_ADDSTRING: if (lphc->dwStyle & CBS_LOWERCASE) diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index be4ee53c22..4757fa3cc6 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -1306,7 +1306,6 @@ static void test_combo_ctlcolor(void) for (i = 0; i < ARRAY_SIZE(messages); ++i) { brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "%u: unexpected brush %p, expected got %p.\n", i, brush, brush_red); }
@@ -1317,7 +1316,6 @@ static void test_combo_ctlcolor(void) for (i = 0; i < ARRAY_SIZE(messages); ++i) { brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); - todo_wine ok(!brush, "%u: unexpected brush %p.\n", i, brush); }
@@ -1344,7 +1342,6 @@ static void test_combo_ctlcolor(void) for (i = 0; i < ARRAY_SIZE(messages); ++i) { brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); - todo_wine ok(!brush, "%u: unexpected brush %p.\n", i, brush); }
From: Fabian Maurer dark.shadow4@web.de
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/user32/combo.c | 12 ++++++++++++ dlls/user32/tests/combo.c | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index 59c2e6484c..4ddccd6c95 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -1988,6 +1988,18 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0); return TRUE;
+ 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 (lphc->owner) + return SendMessageW(lphc->owner, message, wParam, lParam); + break; + /* Combo messages */
case CB_ADDSTRING: diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index 289e1d3f56..6b51ff9719 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -854,7 +854,6 @@ static void test_combo_ctlcolor(void) for (i = 0; i < ARRAY_SIZE(messages); ++i) { brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); - todo_wine ok(brush == brush_red, "%u: unexpected brush %p, expected got %p.\n", i, brush, brush_red); }
@@ -865,7 +864,6 @@ static void test_combo_ctlcolor(void) for (i = 0; i < ARRAY_SIZE(messages); ++i) { brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem); - todo_wine ok(!brush, "%u: unexpected brush %p.\n", i, brush); }