comctl32: Additional test for ListView header creation

Nikolay Sivov bunglehead at gmail.com
Thu Apr 2 07:00:15 CDT 2009


Changelog:
    - Additional test for ListView header creation
    - Corrected some ok() test from previous patch (276c7a3bc6c451b892355126c983f686af2b4af0)
      Thanks Joris Huizer for spotting this.

>From 98aa0eb957224dc2c3a312b6ec20dd51cfe4a167 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Thu, 2 Apr 2009 07:56:30 -0400
Subject: Additional test for ListView header creation

---
 dlls/comctl32/tests/listview.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index f7b34af..0590217 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -820,11 +820,11 @@ static void test_create(void)
     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");
+    ok(ret & WS_VISIBLE, "Style wrong, should have WS_VISIBLE\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");
+    ok((ret & WS_VISIBLE) && (ret & LVS_REPORT), "Style wrong, should have 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");
@@ -835,13 +835,13 @@ static void test_create(void)
                           GetModuleHandle(NULL), 0);
     ret = SetWindowLongPtr(hList, GWL_STYLE,
                           (GetWindowLongPtr(hList, GWL_STYLE) & ~LVS_LIST) | LVS_REPORT);
-    ok(ret = WS_VISIBLE|LVS_LIST, "Style wrong, should be WS_VISIBLE|LVS_ICON\n");
+    ok(((ret & WS_VISIBLE) && (ret & LVS_LIST)), "Style wrong, should have WS_VISIBLE|LVS_LIST\n");
     hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
     ok(IsWindow(hHeader), "Header shouldn't be created\n");
     ok(hHeader == 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");
+    ok(((ret & WS_VISIBLE) && (ret & LVS_REPORT)), "Style wrong, should have WS_VISIBLE|LVS_REPORT\n");
     hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
     ok(IsWindow(hHeader), "Header shouldn't be created\n");
     ok(hHeader == GetDlgItem(hList, 0), "NULL dialog item expected\n");
@@ -863,6 +863,18 @@ static void test_create(void)
     ok(IsWindow(hHeader), "Header should be created\n");
     ok(hHeader == GetDlgItem(hList, 0), "Expected header as dialog item\n");
     DestroyWindow(hList);
+
+    /* LVS_REPORT without WS_VISIBLE, try to show it */
+    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");
+    ShowWindow(hList, SW_SHOW);
+    hHeader = (HWND)SendMessage(hList, LVM_GETHEADER, 0, 0);
+    ok(IsWindow(hHeader), "Header shouldn't be created\n");
+    ok(hHeader == GetDlgItem(hList, 0), "NULL dialog item expected\n");
+    DestroyWindow(hList);
 }
 
 static void test_redraw(void)
-- 
1.5.6.5





More information about the wine-patches mailing list