comctl32/tests: Run Header format mask tests on version 6.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-01-29 14:20:39 +03:00 committed by Alexandre Julliard
parent de4f1783b3
commit 69694d4976

View File

@ -535,58 +535,79 @@ static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
return childHandle;
}
static void check_auto_format(void)
static void header_item_getback(HWND hwnd, UINT mask, HDITEMA *item)
{
HDITEMA hdiCreate;
HDITEMA hdiRead;
static CHAR text[] = "Test";
ZeroMemory(&hdiCreate, sizeof(HDITEMA));
int ret;
ret = SendMessageA(hwnd, HDM_INSERTITEMA, 0, (LPARAM)item);
ok(ret != -1, "Failed to add header item.\n");
memset(item, 0, sizeof(*item));
item->mask = mask;
ret = SendMessageA(hwnd, HDM_GETITEMA, 0, (LPARAM)item);
ok(ret != 0, "Failed to get item data.\n");
ret = SendMessageA(hwnd, HDM_DELETEITEM, 0, 0);
ok(ret != 0, "Failed to delete item.\n");
}
static void test_item_auto_format(HWND parent)
{
static char text[] = "Test";
HDITEMA item;
HBITMAP hbm;
HWND hwnd;
hwnd = create_custom_header_control(parent, FALSE);
/* Windows implicitly sets some format bits in INSERTITEM */
/* HDF_STRING is automatically set and cleared for no text */
hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
hdiCreate.pszText = text;
hdiCreate.cxy = 100;
hdiCreate.fmt=HDF_CENTER;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_STRING|HDF_CENTER), "HDF_STRING not set automatically (fmt=%x)\n", hdiRead.fmt);
item.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
item.pszText = text;
item.cxy = 100;
item.fmt = HDF_CENTER;
header_item_getback(hwnd, HDI_FORMAT, &item);
ok(item.fmt == (HDF_STRING | HDF_CENTER), "Unexpected item format mask %#x.\n", item.fmt);
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
hdiCreate.pszText = text;
hdiCreate.fmt = HDF_CENTER|HDF_STRING;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_CENTER), "HDF_STRING should be automatically cleared (fmt=%x)\n", hdiRead.fmt);
item.mask = HDI_WIDTH | HDI_FORMAT;
item.pszText = text;
item.fmt = HDF_CENTER | HDF_STRING;
header_item_getback(hwnd, HDI_FORMAT, &item);
ok(item.fmt == HDF_CENTER, "Unexpected item format mask %#x.\n", item.fmt);
/* HDF_BITMAP is automatically set and cleared for a NULL bitmap or no bitmap */
hdiCreate.mask = HDI_BITMAP|HDI_WIDTH|HDI_FORMAT;
hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
hdiCreate.fmt = HDF_CENTER;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_BITMAP|HDF_CENTER), "HDF_BITMAP not set automatically (fmt=%x)\n", hdiRead.fmt);
DeleteObject(hdiCreate.hbm);
item.mask = HDI_BITMAP | HDI_WIDTH | HDI_FORMAT;
item.hbm = hbm = CreateBitmap(16, 16, 1, 8, NULL);
item.fmt = HDF_CENTER;
header_item_getback(hwnd, HDI_FORMAT, &item);
ok(item.fmt == (HDF_BITMAP | HDF_CENTER), "Unexpected item format mask %#x.\n", item.fmt);
DeleteObject(hbm);
hdiCreate.hbm = NULL;
hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for NULL bitmap (fmt=%x)\n", hdiRead.fmt);
item.mask = HDI_BITMAP | HDI_WIDTH | HDI_FORMAT;
item.hbm = NULL;
item.fmt = HDF_CENTER | HDF_BITMAP;
header_item_getback(hwnd, HDI_FORMAT, &item);
ok(item.fmt == HDF_CENTER, "Unexpected item format mask %#x.\n", item.fmt);
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for no bitmap (fmt=%x)\n", hdiRead.fmt);
item.mask = HDI_WIDTH | HDI_FORMAT;
item.fmt = HDF_CENTER | HDF_BITMAP;
header_item_getback(hwnd, HDI_FORMAT, &item);
ok(item.fmt == HDF_CENTER, "Unexpected item format mask %#x.\n", item.fmt);
/* HDF_IMAGE is automatically set but not cleared */
hdiCreate.mask = HDI_IMAGE|HDI_WIDTH|HDI_FORMAT;
hdiCreate.iImage = 17;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_IMAGE|HDF_CENTER), "HDF_IMAGE not set automatically (fmt=%x)\n", hdiRead.fmt);
item.mask = HDI_IMAGE | HDI_WIDTH | HDI_FORMAT;
item.iImage = 17;
header_item_getback(hwnd, HDI_FORMAT, &item);
ok(item.fmt == (HDF_IMAGE | HDF_CENTER), "Unexpected item format mask %#x.\n", item.fmt);
hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
hdiCreate.fmt = HDF_CENTER|HDF_IMAGE;
hdiCreate.iImage = 0;
addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
ok(hdiRead.fmt == (HDF_CENTER|HDF_IMAGE), "HDF_IMAGE shouldn't be cleared automatically (fmt=%x)\n", hdiRead.fmt);
item.mask = HDI_WIDTH | HDI_FORMAT;
item.fmt = HDF_CENTER | HDF_IMAGE;
item.iImage = 0;
header_item_getback(hwnd, HDI_FORMAT, &item);
ok(item.fmt == (HDF_CENTER | HDF_IMAGE), "Unexpected item format mask %#x.\n", item.fmt);
DestroyWindow(hwnd);
}
static void check_auto_fields(void)
@ -768,7 +789,6 @@ static void test_header_control (void)
/* unexpected notifies cleared by notifies_received in setItem */
delItem(hWndHeader, 0);
check_auto_format();
TEST_GET_ITEMCOUNT(6);
check_auto_fields();
TEST_GET_ITEMCOUNT(6);
@ -1820,18 +1840,20 @@ START_TEST(header)
HANDLE hCtx;
init_functions();
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
if (!init())
return;
test_header_control();
test_item_auto_format(hHeaderParentWnd);
test_header_order();
test_hdm_orderarray();
test_customdraw();
DestroyWindow(hHeaderParentWnd);
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
parent_hwnd = create_custom_parent_window();
ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create parent windows", FALSE);
@ -1857,6 +1879,7 @@ START_TEST(header)
/* comctl32 version 6 tests start here */
test_hdf_fixedwidth(parent_hwnd);
test_hds_nosizing(parent_hwnd);
test_item_auto_format(parent_hwnd);
unload_v6_module(ctx_cookie, hCtx);