Commit 69694d49 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent de4f1783
......@@ -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;
/* Windows implicitly sets some format bits in INSERTITEM */
ret = SendMessageA(hwnd, HDM_INSERTITEMA, 0, (LPARAM)item);
ok(ret != -1, "Failed to add header item.\n");
/* 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);
memset(item, 0, sizeof(*item));
item->mask = mask;
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);
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");
}
/* 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);
static void test_item_auto_format(HWND parent)
{
static char text[] = "Test";
HDITEMA item;
HBITMAP hbm;
HWND hwnd;
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);
hwnd = create_custom_header_control(parent, FALSE);
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);
/* Windows implicitly sets some format bits in INSERTITEM */
/* HDF_STRING is automatically set and cleared for no text */
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);
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 */
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);
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);
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment