=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: user32/tests: Add more Listbox tests for ownerdraw styles.

Alexandre Julliard julliard at winehq.org
Fri Nov 16 14:38:19 CST 2018


Module: wine
Branch: master
Commit: 686fb7001684ea59b2d0c256c44974d46b60d243
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=686fb7001684ea59b2d0c256c44974d46b60d243

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Thu Nov 15 11:46:12 2018 +0200

user32/tests: Add more Listbox tests for ownerdraw styles.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/listbox.c | 50 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 019d284..4b5d574 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -371,6 +371,35 @@ static void test_ownerdraw(void)
     ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);
 
     DestroyWindow(hLB);
+
+    /* Both FIXED and VARIABLE, FIXED should override VARIABLE. */
+    hLB = CreateWindowA("listbox", "TestList", LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE, 0, 0, 100, 100,
+        NULL, NULL, NULL, 0);
+    ok(hLB != NULL, "last error 0x%08x\n", GetLastError());
+
+    ret = SendMessageA(hLB, LB_INSERTSTRING, -1, 0);
+    ok(ret == 0, "Unexpected return value %d.\n", ret);
+    ret = SendMessageA(hLB, LB_INSERTSTRING, -1, 0);
+    ok(ret == 1, "Unexpected return value %d.\n", ret);
+
+    ret = SendMessageA(hLB, LB_SETITEMHEIGHT, 0, 13);
+    ok(ret == LB_OKAY, "Failed to set item height, %d.\n", ret);
+
+    ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
+    ok(ret == 13, "Unexpected item height %d.\n", ret);
+
+    ret = SendMessageA(hLB, LB_SETITEMHEIGHT, 1, 42);
+    ok(ret == LB_OKAY, "Failed to set item height, %d.\n", ret);
+
+    ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
+todo_wine
+    ok(ret == 42, "Unexpected item height %d.\n", ret);
+
+    ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 1, 0);
+    ok(ret == 42, "Unexpected item height %d.\n", ret);
+
+    DestroyWindow (hLB);
+
     DestroyWindow(parent);
 }
 
@@ -1695,7 +1724,13 @@ static void test_listbox_dlgdir(void)
 
 static void test_set_count( void )
 {
+    static const DWORD styles[] =
+    {
+        LBS_OWNERDRAWFIXED,
+        LBS_HASSTRINGS,
+    };
     HWND parent, listbox;
+    unsigned int i;
     LONG ret;
     RECT r;
 
@@ -1725,6 +1760,21 @@ static void test_set_count( void )
     ok( !IsRectEmpty( &r ), "got empty rect\n");
 
     DestroyWindow( listbox );
+
+    for (i = 0; i < ARRAY_SIZE(styles); ++i)
+    {
+        listbox = create_listbox( styles[i] | WS_CHILD | WS_VISIBLE, parent );
+
+        SetLastError( 0xdeadbeef );
+        ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
+    todo_wine_if(i == 0)
+        ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret );
+    todo_wine_if(i == 0)
+        ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %d.\n", GetLastError() );
+
+        DestroyWindow( listbox );
+    }
+
     DestroyWindow( parent );
 }
 




More information about the wine-cvs mailing list