Signed-off-by: Fabian Maurer dark.shadow4@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
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/tests/msg.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 2766e7f5fb..37fdc797fe 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -7291,6 +7291,13 @@ static const struct message WMSetFocusComboBoxSeq[] = { 0 } };
+static const struct message WMEditReadonlyComboBoxSeq[] = +{ + { WM_CTLCOLORSTATIC, sent }, + { WM_CTLCOLORSTATIC, sent|optional }, /* Not sent by wine */ + { 0 } +}; + static const struct message SetFocusButtonSeq[] = { { WM_KILLFOCUS, sent }, @@ -7587,6 +7594,30 @@ static void test_combobox_messages(void)
DestroyWindow(combo); DestroyWindow(parent); + + /* Test what happens when we use EM_SETREADONLY on the edit control */ + parent = CreateWindowExA(0, "TestParentClass", "Parent", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 10, 300, 300, NULL, NULL, NULL, NULL); + ok(parent != 0, "Failed to create parent window\n"); + + combo = CreateWindowExA(0, "my_combobox_class", "test", WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, + 5, 5, 100, 100, parent, (HMENU)ID_COMBOBOX, NULL, NULL); + ok(combo != 0, "Failed to create combobox window\n"); + UpdateWindow(combo); + + cbInfo.cbSize = sizeof(COMBOBOXINFO); + SetLastError(0xdeadbeef); + res = GetComboBoxInfo(combo, &cbInfo); + ok(res, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError()); + + SendMessageA(cbInfo.hwndItem, EM_SETREADONLY, (WPARAM)TRUE, 0); + + flush_sequence(); + UpdateWindow(combo); + ok_sequence(WMEditReadonlyComboBoxSeq, "Setting edit control readonly.", FALSE); + + DestroyWindow(combo); + DestroyWindow(parent); }
/****************** WM_IME_KEYDOWN message test *******************/ -- 2.23.0
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=56734
Your paranoid android.
=== w2003std (32 bit report) ===
user32: msg.c:7617: Test failed: Setting edit control readonly.: 0: the msg sequence is not complete: expected 0138 - actual 0000
=== wvistau64_he (32 bit report) ===
user32: msg.c:16922: Test failed: SetFocus on a child window: 4: the msg 0x001c was expected, but got msg 0x0047 instead msg.c:16228: Test failed: 0: WaitForSingleObject failed
=== w8adm (32 bit report) ===
user32: msg.c:12893: Test failed: WmMouseHoverSeq: 3: the msg 0x0118 was expected, but got msg 0x001a instead msg.c:12893: Test failed: WmMouseHoverSeq: 4: the msg 0x02a1 was expected, but got msg 0x001a instead msg.c:12893: Test failed: WmMouseHoverSeq: 5: the msg sequence is not complete: expected 0000 - actual 0118
=== debian10 (32 bit Chinese:China report) ===
user32: msg.c:8747: Test failed: WaitForSingleObject failed 102 msg.c:8753: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8753: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8753: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000
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); +} + START_TEST(combo) { ULONG_PTR ctx_cookie; @@ -1281,6 +1317,7 @@ START_TEST(combo) }
/* ComboBox control tests. */ + test_WM_CTLCOLORSTATIC(); test_combo_WS_VSCROLL(); test_combo_setfont(CBS_DROPDOWN); test_combo_setfont(CBS_DROPDOWNLIST); -- 2.23.0
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.
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.
Well, I wanted to make sure. You mean I should just compare the HBRUSH itself?
Another question is how any of this is affected by read-only switch,
Good catch, that "EM_SETREADONLY" is not needed anymore. I reworked the code, and now it's unnecessary.
and why your fix is not affected by it.
I don't really understand what you mean by that.
Regards, Fabian Maurer
On Sun, Sep 22, 2019 at 1:54 AM Fabian Maurer dark.shadow4@web.de wrote:
and why your fix is not affected by it.
I don't really understand what you mean by that.
Your new message test will pass without following fix - you don't have it marked as todo. That means your change to forward message to owner window is not tested by this new test.
Regards, Fabian Maurer
Your new message test will pass without following fix - you don't have it marked as todo. That means your change to forward message to owner window is not tested by this new test.
Yes, as I said, the new message test is to cover something we didn't have a test for - and to disprove one of my earlier ideas.
Regards, Fabian Maurer
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/comctl32/combo.c | 3 +++ dlls/comctl32/tests/combo.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/combo.c b/dlls/comctl32/combo.c index 8a52a0bdc0..8df2992eee 100644 --- a/dlls/comctl32/combo.c +++ b/dlls/comctl32/combo.c @@ -2137,6 +2137,9 @@ static LRESULT CALLBACK COMBO_WindowProc( HWND hwnd, UINT message, WPARAM wParam lphc->visibleItems = (INT)wParam; return TRUE;
+ case WM_CTLCOLORSTATIC: + return SendMessageW(lphc->owner, WM_CTLCOLORSTATIC, wParam, (LPARAM)lphc->hWndEdit); + default: if (message >= WM_USER) WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam ); diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 5a1ba408f0..3d5832aee6 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -1283,7 +1283,6 @@ static void test_WM_CTLCOLORSTATIC(void) 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); -- 2.23.0
Message tests don't really show a difference, and succeed without this change.
On Samstag, 21. September 2019 21:04:31 CEST you wrote:
Message tests don't really show a difference, and succeed without this change.
You mean those from my patch 2? Those are just to prove that setting the combobox edit control to EM_SETREADONLY will use WM_CTLCOLORSTATIC instead of WM_CTLCOLOREDIT. Basically, to disprove my old theory, since we didn't have a patch covering that yet. If you're not talking about my patch 2, I don't know what you mean.
Regards, Fabian Maurer
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/tests/combo.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index 0d3b1b170f..b7859ee817 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -33,6 +33,8 @@
static HWND hMainWnd;
+static HBRUSH brush_red; + #define expect_eq(expr, value, type, fmt); { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); } #define expect_rect(r, _left, _top, _right, _bottom) ok(r.left == _left && r.top == _top && \ r.bottom == _bottom && r.right == _right, "Invalid rect %s vs (%d,%d)-(%d,%d)\n", \ @@ -204,6 +206,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); @@ -804,8 +808,38 @@ static void test_WS_VSCROLL(void) DestroyWindow(hCombo); }
+static void test_WM_CTLCOLORSTATIC(void) +{ + HBRUSH brush; + LOGBRUSH logbrush; + int result; + COMBOBOXINFO info; + COLORREF color_expected = RGB(255, 0, 0); + HWND handle_combo = build_combo(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); +} + 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 +859,8 @@ START_TEST(combo) test_listbox_styles(CBS_DROPDOWN); test_listbox_styles(CBS_DROPDOWNLIST); test_listbox_size(CBS_DROPDOWN); + test_WM_CTLCOLORSTATIC();
DestroyWindow(hMainWnd); + DeleteObject(brush_red); } -- 2.23.0
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/user32/combo.c | 2 ++ dlls/user32/tests/combo.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index 59c2e6484c..4ee54c85da 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -2165,6 +2165,8 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar if( lphc->wState & CBF_EDIT ) return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam); return TRUE; + case WM_CTLCOLORSTATIC: + return SendMessageW(lphc->owner, WM_CTLCOLORSTATIC, wParam, (LPARAM)lphc->hWndEdit); default: if (message >= WM_USER) WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index b7859ee817..917e0beb61 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -830,7 +830,6 @@ static void test_WM_CTLCOLORSTATIC(void) 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); -- 2.23.0
What I meant is a test for default procedure itself, not something that's using it. Unless of course we have such test already.