[1/2] comctl32/listview: Some tests to show we don't handle WM_SETREDRAW right

Nikolay Sivov bunglehead at gmail.com
Wed Aug 12 04:57:13 CDT 2009


Changelog:
    - Some tests to show we don't handle WM_SETREDRAW right

>From a3cdc343a104273a27dbec6e7c879a1fbbacfd9e Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 12 Aug 2009 12:20:30 +0400
Subject: Some tests to show we don't handle WM_SETREDRAW right

---
 dlls/comctl32/tests/listview.c |   50 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 72abdff..516445c 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -288,6 +288,11 @@ static const struct message scroll_parent_seq[] = {
     { 0 }
 };
 
+static const struct message setredraw_seq[] = {
+    { WM_SETREDRAW, sent|id|wparam, FALSE, 0, LISTVIEW_ID },
+    { 0 }
+};
+
 struct subclass_info
 {
     WNDPROC oldproc;
@@ -2786,8 +2791,9 @@ static void test_setredraw(void)
     HWND hwnd;
     DWORD_PTR style;
     DWORD ret;
+    HDC hdc;
 
-    hwnd = create_listview_control(0);
+    hwnd = create_listview_control(LVS_OWNERDATA);
     ok(hwnd != NULL, "failed to create a listview window\n");
 
     /* Passing WM_SETREDRAW to DefWinProc removes WS_VISIBLE.
@@ -2803,6 +2809,48 @@ static void test_setredraw(void)
     expect(0, ret);
     style = GetWindowLongPtr(hwnd, GWL_STYLE);
     ok(style & WS_VISIBLE, "Expected WS_VISIBLE to be set\n");
+    ret = SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+    expect(0, ret);
+
+    /* WM_ERASEBKGND */
+    hdc = GetWindowDC(hwndparent);
+    ret = SendMessage(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    expect(TRUE, ret);
+    ret = SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+    expect(0, ret);
+    ret = SendMessage(hwnd, WM_ERASEBKGND, (WPARAM)hdc, 0);
+    expect(TRUE, ret);
+    ret = SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+    expect(0, ret);
+    ReleaseDC(hwndparent, hdc);
+
+    /* check notification messages to show that repainting is disabled */
+    ret = SendMessage(hwnd, LVM_SETITEMCOUNT, 1, 0);
+    expect(TRUE, ret);
+    ret = SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+    expect(0, ret);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+    InvalidateRect(hwnd, NULL, TRUE);
+    UpdateWindow(hwnd);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq,
+                "redraw after WM_SETREDRAW (FALSE)", TRUE);
+
+    ret = SendMessage(hwnd, LVM_SETBKCOLOR, 0, CLR_NONE);
+    expect(TRUE, ret);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    InvalidateRect(hwnd, NULL, TRUE);
+    UpdateWindow(hwnd);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq,
+                "redraw after WM_SETREDRAW (FALSE) with CLR_NONE bkgnd", TRUE);
+
+    /* message isn't forwarded to header */
+    subclass_header(hwnd);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    ret = SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+    expect(0, ret);
+    ok_sequence(sequences, LISTVIEW_SEQ_INDEX, setredraw_seq,
+                "WM_SETREDRAW: not forwarded to header", FALSE);
 
     DestroyWindow(hwnd);
 }
-- 
1.5.6.5







More information about the wine-patches mailing list