Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/comctl32/tests/listbox.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index 43da3ca..d457b13 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -110,6 +110,15 @@ static HWND create_listbox(DWORD add_style, HWND parent) return handle; }
+static UINT lb_resetcontent_count; +static WNDPROC lb_test_subclass_proc_prev; +static LRESULT WINAPI lb_test_subclass_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if (msg == LB_RESETCONTENT) lb_resetcontent_count++; + + return CallWindowProcW(lb_test_subclass_proc_prev, hwnd, msg, wParam, lParam); +} + struct listbox_prop { DWORD add_style; @@ -227,6 +236,17 @@ static void run_test(DWORD style, const struct listbox_test test) res = SendMessageA(hLB, LB_GETCOUNT, 0, 0); ok(res == 4, "Expected 4 items, got %d\n", res);
+ /* Confirm that emptying the listbox sends a LB_RESETCONTENT to itself */ + lb_test_subclass_proc_prev = (WNDPROC)SetWindowLongPtrW(hLB, GWLP_WNDPROC, (LONG_PTR)lb_test_subclass_proc); + + lb_resetcontent_count = 0; + for (i = 4; i--;) + { + res = SendMessageA(hLB, LB_DELETESTRING, 0, 0); + ok(res == i, "Expected %d items, got %d\n", i, res); + } + ok(lb_resetcontent_count == 1, "Expected 1 LB_RESETCONTENT message, got %u\n", lb_resetcontent_count); + DestroyWindow(hLB); }
@@ -1798,6 +1818,14 @@ static void test_set_count( void ) GetUpdateRect( listbox, &r, TRUE ); ok( !IsRectEmpty( &r ), "got empty rect\n");
+ /* Confirm that emptying the listbox sends a LB_RESETCONTENT to itself */ + lb_test_subclass_proc_prev = (WNDPROC)SetWindowLongPtrW(listbox, GWLP_WNDPROC, (LONG_PTR)lb_test_subclass_proc); + + lb_resetcontent_count = 0; + ret = SendMessageA(listbox, LB_SETCOUNT, 0, 0); + ok(ret == 0, "got %d\n", ret); + ok(lb_resetcontent_count == 1, "Expected 1 LB_RESETCONTENT message, got %u\n", lb_resetcontent_count); + DestroyWindow( listbox );
for (i = 0; i < ARRAY_SIZE(styles); ++i)