On Sat, Sep 21, 2019 at 9:40 PM Fabian Maurer dark.shadow4@web.de wrote:
Signed-off-by: Fabian Maurer dark.shadow4@web.de
dlls/comctl32/tests/combo.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 923d826b30..5a1ba408f0 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) @@ -748,6 +753,8 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR break; } break;
case WM_CTLCOLORSTATIC:
return (LRESULT) brush_red;
}
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam);
@@ -1254,6 +1261,35 @@ static void test_combo_dropdown_size(DWORD style) } }
+static void test_WM_CTLCOLORSTATIC(void) +{
- HBRUSH brush;
- LOGBRUSH logbrush;
- int result;
- COMBOBOXINFO info;
- COLORREF color_expected = RGB(255, 0, 0);
- 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");
- SendMessageA(info.hwndItem, EM_SETREADONLY, (WPARAM)TRUE, 0);
- brush = (HBRUSH)SendMessageA(handle_combo, WM_CTLCOLORSTATIC, 0,
(LPARAM)info.hwndItem);
- result = GetObjectA(brush, sizeof(logbrush), &logbrush);
- ok(result > 0, "GetObject failed: %d!\n", GetLastError());
- todo_wine
- ok(logbrush.lbColor == color_expected, "Expected %x, got %x\n",
color_expected, logbrush.lbColor);
- DestroyWindow(handle_combo);
- SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
+}
This looks too complicated. I don't think you need to test actual color, it should be enough to return different stock brush from what default procedure returns. Another question is how any of this is affected by read-only switch, and why your fix is not affected by it.