[2/2] comctl32/listview: Add tests for LVS_NOSORTHEADER switchover

Nikolay Sivov bunglehead at gmail.com
Thu May 7 03:21:50 CDT 2009


Changelog:
    - Add tests for LVS_NOSORTHEADER switchover

>From 355321a9cd5db721c08acd3b02ea7d064835b92b Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 6 May 2009 23:28:08 +0400
Subject: Add tests for LVS_NOSORTHEADER switchover

---
 dlls/comctl32/listview.c       |    2 -
 dlls/comctl32/tests/listview.c |   42 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 133d3c2..a8ecd91 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -9631,8 +9631,6 @@ static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType,
           wStyleType, lpss->styleOld, lpss->styleNew);
 
     if (wStyleType != GWL_STYLE) return 0;
-  
-    /* FIXME: if LVS_NOSORTHEADER changed, update header */
 
     infoPtr->dwStyle = lpss->styleNew;
 
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index b6cbd47..e94bdaa 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2027,6 +2027,47 @@ static void test_norecompute(void)
     DestroyWindow(hwnd);
 }
 
+static void test_nosortheader(void)
+{
+    HWND hwnd, header;
+    LONG_PTR style;
+
+    hwnd = create_listview_control(0);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+
+    header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
+    ok(IsWindow(header), "header expected\n");
+
+    style = GetWindowLongPtr(header, GWL_STYLE);
+    ok(style & HDS_BUTTONS, "expected header to have HDS_BUTTONS\n");
+
+    style = GetWindowLongPtr(hwnd, GWL_STYLE);
+    SetWindowLongPtr(hwnd, GWL_STYLE, style | LVS_NOSORTHEADER);
+    /* HDS_BUTTONS retained */
+    style = GetWindowLongPtr(header, GWL_STYLE);
+    ok(style & HDS_BUTTONS, "expected header to retain HDS_BUTTONS\n");
+
+    DestroyWindow(hwnd);
+
+    /* create with LVS_NOSORTHEADER */
+    hwnd = create_listview_control(LVS_NOSORTHEADER);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+
+    header = (HWND)SendMessageA(hwnd, LVM_GETHEADER, 0, 0);
+    ok(IsWindow(header), "header expected\n");
+
+    style = GetWindowLongPtr(header, GWL_STYLE);
+    ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
+
+    style = GetWindowLongPtr(hwnd, GWL_STYLE);
+    SetWindowLongPtr(hwnd, GWL_STYLE, style & ~LVS_NOSORTHEADER);
+    /* not changed here */
+    style = GetWindowLongPtr(header, GWL_STYLE);
+    ok(!(style & HDS_BUTTONS), "expected header to have no HDS_BUTTONS\n");
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(listview)
 {
     HMODULE hComctl32;
@@ -2068,4 +2109,5 @@ START_TEST(listview)
     test_sorting();
     test_ownerdata();
     test_norecompute();
+    test_nosortheader();
 }
-- 
1.5.6.5





More information about the wine-patches mailing list