=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: user32/tests: Also include LBS_NODATA cases when testing ownerdraw.

Alexandre Julliard julliard at winehq.org
Wed Nov 28 14:11:49 CST 2018


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

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Tue Nov 20 12:57:41 2018 +0200

user32/tests: Also include LBS_NODATA cases when testing ownerdraw.

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 | 84 +++++++++++++++++++++++++--------------------
 1 file changed, 46 insertions(+), 38 deletions(-)

diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index d13a4e3..b87acd7 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -338,65 +338,73 @@ static HWND create_parent( void )
 
 static void test_ownerdraw(void)
 {
+    static const DWORD styles[] =
+    {
+        0,
+        LBS_NODATA
+    };
     HWND parent, hLB;
     INT ret;
     RECT rc;
+    UINT i;
 
     parent = create_parent();
     assert(parent);
 
-    hLB = create_listbox(LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE, parent);
-    assert(hLB);
+    for (i = 0; i < ARRAY_SIZE(styles); i++)
+    {
+        hLB = create_listbox(LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE | styles[i], parent);
+        assert(hLB);
 
-    SetForegroundWindow(hLB);
-    UpdateWindow(hLB);
+        SetForegroundWindow(hLB);
+        UpdateWindow(hLB);
 
-    /* make height short enough */
-    SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
-    SetWindowPos(hLB, 0, 0, 0, 100, rc.bottom - rc.top + 1,
-                 SWP_NOZORDER | SWP_NOMOVE);
+        /* make height short enough */
+        SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
+        SetWindowPos(hLB, 0, 0, 0, 100, rc.bottom - rc.top + 1,
+                     SWP_NOZORDER | SWP_NOMOVE);
 
-    /* make 0 item invisible */
-    SendMessageA(hLB, LB_SETTOPINDEX, 1, 0);
-    ret = SendMessageA(hLB, LB_GETTOPINDEX, 0, 0);
-    ok(ret == 1, "wrong top index %d\n", ret);
+        /* make 0 item invisible */
+        SendMessageA(hLB, LB_SETTOPINDEX, 1, 0);
+        ret = SendMessageA(hLB, LB_GETTOPINDEX, 0, 0);
+        ok(ret == 1, "wrong top index %d\n", ret);
 
-    SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
-    trace("item 0 rect %s\n", wine_dbgstr_rect(&rc));
-    ok(!IsRectEmpty(&rc), "empty item rect\n");
-    ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);
+        SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
+        trace("item 0 rect %s\n", wine_dbgstr_rect(&rc));
+        ok(!IsRectEmpty(&rc), "empty item rect\n");
+        ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);
 
-    DestroyWindow(hLB);
+        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());
+        /* Both FIXED and VARIABLE, FIXED should override VARIABLE. */
+        hLB = CreateWindowA("listbox", "TestList", LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE | styles[i],
+            0, 0, 100, 100, NULL, NULL, NULL, 0);
+        ok(hLB != NULL, "last error 0x%08x\n", GetLastError());
 
-    ok(GetWindowLongA(hLB, GWL_STYLE) & LBS_OWNERDRAWVARIABLE, "Unexpected window style.\n");
+        ok(GetWindowLongA(hLB, GWL_STYLE) & LBS_OWNERDRAWVARIABLE, "Unexpected window style.\n");
 
-    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_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_GETITEMHEIGHT, 0, 0);
-    ok(ret == 13, "Unexpected item height %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_SETITEMHEIGHT, 1, 42);
-    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_GETITEMHEIGHT, 0, 0);
-    ok(ret == 42, "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, 1, 0);
-    ok(ret == 42, "Unexpected item height %d.\n", ret);
+        ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
+        ok(ret == 42, "Unexpected item height %d.\n", ret);
 
-    DestroyWindow (hLB);
+        ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 1, 0);
+        ok(ret == 42, "Unexpected item height %d.\n", ret);
 
+        DestroyWindow (hLB);
+    }
     DestroyWindow(parent);
 }
 




More information about the wine-cvs mailing list