comctl32/tests: Also include LBS_NODATA cases when testing ownerdraw.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8cd569cf26
commit
423ea9790b
|
@ -462,62 +462,71 @@ static HWND create_parent( void )
|
||||||
|
|
||||||
static void test_ownerdraw(void)
|
static void test_ownerdraw(void)
|
||||||
{
|
{
|
||||||
|
static const DWORD styles[] =
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
LBS_NODATA
|
||||||
|
};
|
||||||
HWND parent, hLB;
|
HWND parent, hLB;
|
||||||
INT ret;
|
INT ret;
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
UINT i;
|
||||||
|
|
||||||
parent = create_parent();
|
parent = create_parent();
|
||||||
ok(parent != NULL, "Failed to create parent window.\n");
|
ok(parent != NULL, "Failed to create parent window.\n");
|
||||||
|
|
||||||
hLB = create_listbox(LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE, parent);
|
for (i = 0; i < ARRAY_SIZE(styles); i++)
|
||||||
ok(hLB != NULL, "Failed to create listbox window.\n");
|
{
|
||||||
|
hLB = create_listbox(LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE | styles[i], parent);
|
||||||
|
ok(hLB != NULL, "Failed to create listbox window.\n");
|
||||||
|
|
||||||
SetForegroundWindow(hLB);
|
SetForegroundWindow(hLB);
|
||||||
UpdateWindow(hLB);
|
UpdateWindow(hLB);
|
||||||
|
|
||||||
/* make height short enough */
|
/* make height short enough */
|
||||||
SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
||||||
SetWindowPos(hLB, 0, 0, 0, 100, rc.bottom - rc.top + 1, SWP_NOZORDER | SWP_NOMOVE);
|
SetWindowPos(hLB, 0, 0, 0, 100, rc.bottom - rc.top + 1, SWP_NOZORDER | SWP_NOMOVE);
|
||||||
|
|
||||||
/* make 0 item invisible */
|
/* make 0 item invisible */
|
||||||
SendMessageA(hLB, LB_SETTOPINDEX, 1, 0);
|
SendMessageA(hLB, LB_SETTOPINDEX, 1, 0);
|
||||||
ret = SendMessageA(hLB, LB_GETTOPINDEX, 0, 0);
|
ret = SendMessageA(hLB, LB_GETTOPINDEX, 0, 0);
|
||||||
ok(ret == 1, "wrong top index %d\n", ret);
|
ok(ret == 1, "wrong top index %d\n", ret);
|
||||||
|
|
||||||
SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
||||||
ok(!IsRectEmpty(&rc), "empty item rect\n");
|
ok(!IsRectEmpty(&rc), "empty item rect\n");
|
||||||
ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);
|
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. */
|
/* Both FIXED and VARIABLE, FIXED should override VARIABLE. */
|
||||||
hLB = CreateWindowA(WC_LISTBOXA, "TestList", LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE, 0, 0, 100, 100,
|
hLB = CreateWindowA(WC_LISTBOXA, "TestList", LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE | styles[i],
|
||||||
NULL, NULL, NULL, 0);
|
0, 0, 100, 100, NULL, NULL, NULL, 0);
|
||||||
ok(hLB != NULL, "last error 0x%08x\n", GetLastError());
|
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);
|
ret = SendMessageA(hLB, LB_INSERTSTRING, -1, 0);
|
||||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||||
ret = SendMessageA(hLB, LB_INSERTSTRING, -1, 0);
|
ret = SendMessageA(hLB, LB_INSERTSTRING, -1, 0);
|
||||||
ok(ret == 1, "Unexpected return value %d.\n", ret);
|
ok(ret == 1, "Unexpected return value %d.\n", ret);
|
||||||
|
|
||||||
ret = SendMessageA(hLB, LB_SETITEMHEIGHT, 0, 13);
|
ret = SendMessageA(hLB, LB_SETITEMHEIGHT, 0, 13);
|
||||||
ok(ret == LB_OKAY, "Failed to set item height, %d.\n", ret);
|
ok(ret == LB_OKAY, "Failed to set item height, %d.\n", ret);
|
||||||
|
|
||||||
ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
|
ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
|
||||||
ok(ret == 13, "Unexpected item height %d.\n", ret);
|
ok(ret == 13, "Unexpected item height %d.\n", ret);
|
||||||
|
|
||||||
ret = SendMessageA(hLB, LB_SETITEMHEIGHT, 1, 42);
|
ret = SendMessageA(hLB, LB_SETITEMHEIGHT, 1, 42);
|
||||||
ok(ret == LB_OKAY, "Failed to set item height, %d.\n", ret);
|
ok(ret == LB_OKAY, "Failed to set item height, %d.\n", ret);
|
||||||
|
|
||||||
ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
|
ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
|
||||||
ok(ret == 42, "Unexpected item height %d.\n", ret);
|
ok(ret == 42, "Unexpected item height %d.\n", ret);
|
||||||
|
|
||||||
ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 1, 0);
|
ret = SendMessageA(hLB, LB_GETITEMHEIGHT, 1, 0);
|
||||||
ok(ret == 42, "Unexpected item height %d.\n", ret);
|
ok(ret == 42, "Unexpected item height %d.\n", ret);
|
||||||
|
|
||||||
DestroyWindow (hLB);
|
DestroyWindow (hLB);
|
||||||
|
}
|
||||||
|
|
||||||
DestroyWindow(parent);
|
DestroyWindow(parent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue