comctl32/listview: Some tests for delayed header creation in ListView control
Nikolay Sivov
bunglehead at gmail.com
Sun Mar 29 16:12:08 CDT 2009
http://bugs.winehq.org/show_bug.cgi?id=4175
Mikolaj Zalewski found out that target app (P-CAD) depends on
delayed header creation used in native comctl32.
In all cases tested LVM_GETHEADER and DlgGetItem() give same results.
Changelog:
- Some tests for delayed header creation in ListView control
>From d64fcc6cf7dd0cc16504923fd9fe7281aa51c478 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun, 29 Mar 2009 17:04:52 -0400
Subject: Some tests for delayed header creation in ListView control
---
dlls/comctl32/tests/listview.c | 83 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 813d9bb..6b6503f 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -764,6 +764,9 @@ static void test_create(void)
{
HWND hList;
HWND hHeader;
+ LONG_PTR ret;
+ LONG r;
+ LVCOLUMNA col;
WNDCLASSEX cls;
cls.cbSize = sizeof(WNDCLASSEX);
ok(GetClassInfoEx(GetModuleHandle(NULL), "SysListView32", &cls), "GetClassInfoEx failed\n");
@@ -777,6 +780,86 @@ static void test_create(void)
ok((HIMAGELIST)SendMessage(hList, LVM_GETIMAGELIST, 0, 0) == test_create_imagelist, "Image list not obtained\n");
hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
ok(IsWindow(hHeader) && IsWindowVisible(hHeader), "Listview not in report mode\n");
+ ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
+ DestroyWindow(hList);
+
+ /* header isn't created on LVS_ICON and LVS_LIST styles */
+ hList = CreateWindow("SysListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL,
+ GetModuleHandle(NULL), 0);
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ todo_wine ok(!IsWindow(hHeader), "Header shouldn't be created\n");
+ todo_wine ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+ /* insert column */
+ memset(&col, 0, sizeof(LVCOLUMNA));
+ col.mask = LVCF_WIDTH;
+ col.cx = 100;
+ r = SendMessage(hList, LVM_INSERTCOLUMN, 0, (LPARAM)&col);
+ ok(r == 0, "Expected 0 column's inserted\n");
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ ok(IsWindow(hHeader), "Header should be created\n");
+ ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
+ DestroyWindow(hList);
+
+ hList = CreateWindow("SysListView32", "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
+ GetModuleHandle(NULL), 0);
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ todo_wine ok(!IsWindow(hHeader), "Header shouldn't be created\n");
+ todo_wine ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+ /* insert column */
+ memset(&col, 0, sizeof(LVCOLUMNA));
+ col.mask = LVCF_WIDTH;
+ col.cx = 100;
+ r = SendMessage(hList, LVM_INSERTCOLUMN, 0, (LPARAM)&col);
+ ok(r == 0, "Expected 0 column's inserted\n");
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ ok(IsWindow(hHeader), "Header should be created\n");
+ ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
+ DestroyWindow(hList);
+
+ /* try to switch LVS_ICON -> LVS_REPORT and back LVS_ICON -> LVS_REPORT */
+ hList = CreateWindow("SysListView32", "Test", WS_VISIBLE, 0, 0, 100, 100, NULL, NULL,
+ GetModuleHandle(NULL), 0);
+ ret = SetWindowLongPtr(hList, GWL_STYLE, GetWindowLongPtr(hList, GWL_STYLE) | LVS_REPORT);
+ ok(ret = WS_VISIBLE, "Style wrong, should be WS_VISIBLE|LVS_ICON\n");
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ ok(IsWindow(hHeader), "Header should be created\n");
+ ret = SetWindowLongPtr(hList, GWL_STYLE, GetWindowLong(hList, GWL_STYLE) & ~LVS_REPORT);
+ ok(ret = WS_VISIBLE|LVS_REPORT, "Style wrong, should be WS_VISIBLE|LVS_REPORT\n");
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ ok(IsWindow(hHeader), "Header should be created\n");
+ ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
+ DestroyWindow(hList);
+
+ /* try to switch LVS_LIST -> LVS_REPORT and back LVS_LIST -> LVS_REPORT */
+ hList = CreateWindow("SysListView32", "Test", WS_VISIBLE|LVS_LIST, 0, 0, 100, 100, NULL, NULL,
+ GetModuleHandle(NULL), 0);
+ ret = SetWindowLongPtr(hList, GWL_STYLE, GetWindowLongPtr(hList, GWL_STYLE) | LVS_REPORT);
+ ok(ret = WS_VISIBLE|LVS_LIST, "Style wrong, should be WS_VISIBLE|LVS_ICON\n");
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ todo_wine ok(!IsWindow(hHeader), "Header shouldn't be created\n");
+ todo_wine ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+ ret = SetWindowLongPtr(hList, GWL_STYLE, GetWindowLongPtr(hList, GWL_STYLE) & ~LVS_REPORT & LVS_LIST);
+ ok(ret = WS_VISIBLE|LVS_REPORT, "Style wrong, should be WS_VISIBLE|LVS_REPORT\n");
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ todo_wine ok(!IsWindow(hHeader), "Header shouldn't be created\n");
+ todo_wine ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+ DestroyWindow(hList);
+
+ /* LVS_REPORT without WS_VISIBLE */
+ hList = CreateWindow("SysListView32", "Test", LVS_REPORT, 0, 0, 100, 100, NULL, NULL,
+ GetModuleHandle(NULL), 0);
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ todo_wine ok(!IsWindow(hHeader), "Header shouldn't be created\n");
+ todo_wine ok(NULL == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+ /* insert column */
+ memset(&col, 0, sizeof(LVCOLUMNA));
+ col.mask = LVCF_WIDTH;
+ col.cx = 100;
+ r = SendMessage(hList, LVM_INSERTCOLUMN, 0, (LPARAM)&col);
+ ok(r == 0, "Expected 0 column's inserted\n");
+ hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+ ok(IsWindow(hHeader), "Header should be created\n");
+ ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
DestroyWindow(hList);
}
--
1.5.6.5
More information about the wine-patches
mailing list