From: Alanas alanas.00@mail.ru
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57178 --- dlls/comctl32/tests/toolbar.c | 44 +++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 7c886e1f88f..b1cf382d787 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -179,7 +179,20 @@ static BOOL equal_dc(HDC hdc1, HDC hdc2, int width, int height)
static void *alloced_str;
-static LRESULT parent_wnd_notify(LPARAM lParam) +#define TEST_WM_NOTIFY_IDFROM 0xabcd0002 +#define TEST_WM_NOTIFY_CODE 0xabcd0003 +#define TEST_WM_NOTIFY_RETURN 0xabcd0004 +static BOOL expecting_test_WM_NOTIFY; +static const NMHDR test_WM_NOTIFY_nmhdr = +{ + /* .hwndFrom should not be accessed */ + .hwndFrom = (HWND)0xabcd0001, + /* .idFrom and .code don't mean anything */ + .idFrom = TEST_WM_NOTIFY_IDFROM, + .code = TEST_WM_NOTIFY_CODE +}; + +static LRESULT parent_wnd_notify(WPARAM wParam, LPARAM lParam) { NMHDR *hdr = (NMHDR *)lParam; NMTBHOTITEM *nmhi; @@ -371,6 +384,18 @@ static LRESULT parent_wnd_notify(LPARAM lParam)
return 0; } + case TEST_WM_NOTIFY_CODE: + if (expecting_test_WM_NOTIFY) + { + ok(hdr == &test_WM_NOTIFY_nmhdr, "Got unexpected header.\n"); + ok(wParam == TEST_WM_NOTIFY_IDFROM, "Got unexpected wParam 0x%Ix.\n", wParam); + } + else + { + ok(FALSE, "Got unexpected WM_NOTIFY.\n"); + } + expecting_test_WM_NOTIFY = FALSE; + return TEST_WM_NOTIFY_RETURN; } return 0; } @@ -428,7 +453,7 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, switch (message) { case WM_NOTIFY: - return parent_wnd_notify(lParam); + return parent_wnd_notify(wParam, lParam); }
defwndproc_counter++; @@ -2833,6 +2858,20 @@ static void test_BTNS_SEP(void) DestroyWindow(hwnd); }
+static void test_WM_NOTIFY(void) +{ + HWND toolbar = NULL; + LRESULT ret; + + rebuild_toolbar(&toolbar); + expecting_test_WM_NOTIFY = TRUE; + ret = SendMessageA(toolbar, WM_NOTIFY, 0, (LPARAM)&test_WM_NOTIFY_nmhdr); + todo_wine ok(ret == TEST_WM_NOTIFY_RETURN, "SendMessageA returned 0x%Ix\n", ret); + todo_wine ok(!expecting_test_WM_NOTIFY, "toolbar didn't forward WM_NOTIFY to parent\n"); + expecting_test_WM_NOTIFY = FALSE; + DestroyWindow(toolbar); +} + START_TEST(toolbar) { ULONG_PTR ctx_cookie; @@ -2884,6 +2923,7 @@ START_TEST(toolbar) test_drawtext_flags(); test_imagelist(); test_BTNS_SEP(); + test_WM_NOTIFY();
if (!load_v6_module(&ctx_cookie, &ctx)) return;