[PATCH v5 1/8] comctl32/tests: Confirm that emptying the listbox sends a LB_RESETCONTENT to itself
Gabriel Ivăncescu
gabrielopcode at gmail.com
Thu Nov 22 07:44:37 CST 2018
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/comctl32/tests/listbox.c | 72 +++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c
index 43da3ca..9158e36 100644
--- a/dlls/comctl32/tests/listbox.c
+++ b/dlls/comctl32/tests/listbox.c
@@ -34,6 +34,7 @@
enum seq_index
{
+ LB_SEQ_INDEX,
PARENT_SEQ_INDEX,
NUM_MSG_SEQUENCES
};
@@ -110,6 +111,43 @@ static HWND create_listbox(DWORD add_style, HWND parent)
return handle;
}
+static WNDPROC lb_test_subclass_proc_prev;
+static LRESULT WINAPI lb_test_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ static LONG defwndproc_counter = 0;
+ struct message msg = { 0 };
+ LRESULT ret;
+
+ switch (message)
+ {
+ case WM_SIZE:
+ case WM_GETTEXT:
+ case WM_PAINT:
+ case WM_ERASEBKGND:
+ case WM_WINDOWPOSCHANGING:
+ case WM_WINDOWPOSCHANGED:
+ case WM_NCCALCSIZE:
+ case WM_NCPAINT:
+ case WM_NCHITTEST:
+ case WM_DEVICECHANGE:
+ break;
+
+ default:
+ msg.message = message;
+ msg.flags = sent|wparam|lparam;
+ if (defwndproc_counter) msg.flags |= defwinproc;
+ msg.wParam = wParam;
+ msg.lParam = lParam;
+ add_message(sequences, LB_SEQ_INDEX, &msg);
+ }
+
+ defwndproc_counter++;
+ ret = CallWindowProcA(lb_test_subclass_proc_prev, hwnd, message, wParam, lParam);
+ defwndproc_counter--;
+
+ return ret;
+}
+
struct listbox_prop
{
DWORD add_style;
@@ -167,6 +205,15 @@ static void keypress(HWND handle, WPARAM keycode, BYTE scancode, BOOL extended)
static void run_test(DWORD style, const struct listbox_test test)
{
+ static const struct message delete_seq[] =
+ {
+ { LB_DELETESTRING, sent|wparam|lparam, 0, 0 },
+ { LB_DELETESTRING, sent|wparam|lparam, 0, 0 },
+ { LB_DELETESTRING, sent|wparam|lparam, 0, 0 },
+ { LB_DELETESTRING, sent|wparam|lparam, 0, 0 },
+ { LB_RESETCONTENT, sent|wparam|lparam|defwinproc, 0, 0 },
+ { 0 }
+ };
struct listbox_stat answer;
RECT second_item;
int i, res;
@@ -227,6 +274,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);
+
+ flush_sequence(sequences, LB_SEQ_INDEX);
+ for (i = 4; i--;)
+ {
+ res = SendMessageA(hLB, LB_DELETESTRING, 0, 0);
+ ok(res == i, "Expected %d items, got %d\n", i, res);
+ }
+ ok_sequence(sequences, LB_SEQ_INDEX, delete_seq, "Emptying listbox", FALSE);
+
DestroyWindow(hLB);
}
@@ -1763,6 +1821,12 @@ static void test_listbox_dlgdir(void)
static void test_set_count( void )
{
+ static const struct message setcount0_seq[] =
+ {
+ { LB_SETCOUNT, sent|wparam|lparam, 0, 0 },
+ { LB_RESETCONTENT, sent|wparam|lparam|defwinproc, 0, 0 },
+ { 0 }
+ };
static const DWORD styles[] =
{
LBS_OWNERDRAWFIXED,
@@ -1798,6 +1862,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);
+
+ flush_sequence(sequences, LB_SEQ_INDEX);
+ ret = SendMessageA(listbox, LB_SETCOUNT, 0, 0);
+ ok(ret == 0, "got %d\n", ret);
+ ok_sequence(sequences, LB_SEQ_INDEX, setcount0_seq, "LB_SETCOUNT 0", FALSE);
+
DestroyWindow( listbox );
for (i = 0; i < ARRAY_SIZE(styles); ++i)
--
2.19.1
More information about the wine-devel
mailing list