[PATCH v3 2/7] comctl32/tests: Test changing the selection styles after listbox creation
Gabriel Ivăncescu
gabrielopcode at gmail.com
Wed Nov 21 07:38:43 CST 2018
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/comctl32/tests/listbox.c | 54 +++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c
index d457b13..eeb1c7b 100644
--- a/dlls/comctl32/tests/listbox.c
+++ b/dlls/comctl32/tests/listbox.c
@@ -735,6 +735,59 @@ static void test_listbox_height(void)
DestroyWindow( hList );
}
+static void test_changing_selection_styles(void)
+{
+ static const DWORD styles[] =
+ {
+ 0,
+ LBS_NODATA | LBS_OWNERDRAWFIXED
+ };
+ static const DWORD selstyles[] =
+ {
+ 0,
+ LBS_MULTIPLESEL,
+ LBS_EXTENDEDSEL,
+ LBS_MULTIPLESEL | LBS_EXTENDEDSEL
+ };
+ HWND parent, listbox;
+ LONG ret, expected;
+ DWORD style;
+ UINT i, j;
+
+ parent = create_parent();
+ for (i = 0; i < ARRAY_SIZE(styles); i++)
+ {
+ for (j = 0; j < ARRAY_SIZE(selstyles); j++)
+ {
+ listbox = CreateWindowA(WC_LISTBOXA, "TestList", styles[i] | selstyles[j] | WS_VISIBLE,
+ 0, 0, 100, 100, NULL, NULL, NULL, 0);
+ ok(listbox != NULL, "%u: Failed to create ListBox window.\n", j);
+
+ style = GetWindowLongA(listbox, GWL_STYLE);
+ ok((style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == selstyles[j], "%u: unexpected window styles %#x.\n", j, style);
+
+ if (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
+ {
+ style &= ~selstyles[j];
+ expected = 0;
+ }
+ else
+ {
+ style |= LBS_MULTIPLESEL | LBS_EXTENDEDSEL;
+ expected = LB_ERR;
+ }
+ SetWindowLongA(listbox, GWL_STYLE, style);
+ style = GetWindowLongA(listbox, GWL_STYLE);
+ ok(!(style & selstyles[j]), "%u: unexpected window styles %#x.\n", j, style);
+
+ ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
+ ok(ret == expected, "%u: expected %d from LB_GETSELCOUNT, got %d\n", j, expected, ret);
+ DestroyWindow(listbox);
+ }
+ }
+ DestroyWindow(parent);
+}
+
static void test_itemfrompoint(void)
{
/* WS_POPUP is required in order to have a more accurate size calculation (
@@ -2390,6 +2443,7 @@ START_TEST(listbox)
test_LB_SELITEMRANGE();
test_LB_SETCURSEL();
test_listbox_height();
+ test_changing_selection_styles();
test_itemfrompoint();
test_listbox_item_data();
test_listbox_LB_DIR();
--
2.19.1
More information about the wine-devel
mailing list