[PATCH 2/4] Don't invalidate list on LVM_SETTEXTBKCOLOR

Nikolay Sivov nsivov at codeweavers.com
Wed Jul 20 07:01:21 CDT 2011


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

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 033472c..f6eebe8 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -8894,23 +8894,18 @@ static INT LISTVIEW_SetSelectionMark(LISTVIEW_INFO *infoPtr, INT nIndex)
  *
  * PARAMETER(S):
  * [I] infoPtr : valid pointer to the listview structure
- * [I] clrTextBk : text background color
+ * [I] color   : text background color
  *
  * RETURN:
  *   SUCCESS : TRUE
  *   FAILURE : FALSE
  */
-static BOOL LISTVIEW_SetTextBkColor(LISTVIEW_INFO *infoPtr, COLORREF clrTextBk)
+static BOOL LISTVIEW_SetTextBkColor(LISTVIEW_INFO *infoPtr, COLORREF color)
 {
-    TRACE("(clrTextBk=%x)\n", clrTextBk);
+    TRACE("(color=%x)\n", color);
 
-    if (infoPtr->clrTextBk != clrTextBk)
-    {
-	infoPtr->clrTextBk = clrTextBk;
-	LISTVIEW_InvalidateList(infoPtr);
-    }
-    
-  return TRUE;
+    infoPtr->clrTextBk = color;
+    return TRUE;
 }
 
 /***
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index a848575..e33e334 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -1748,8 +1748,7 @@ static void test_icon_spacing(void)
 
 static void test_color(void)
 {
-    /* SETBKCOLOR/GETBKCOLOR, SETTEXTCOLOR/GETTEXTCOLOR, SETTEXTBKCOLOR/GETTEXTBKCOLOR */
-
+    RECT rect;
     HWND hwnd;
     DWORD r;
     int i;
@@ -1768,23 +1767,54 @@ static void test_color(void)
 
         r = SendMessage(hwnd, LVM_SETBKCOLOR, 0, color);
         expect(TRUE, r);
-        r = SendMessage(hwnd, LVM_GETBKCOLOR, 0, color);
+        r = SendMessage(hwnd, LVM_GETBKCOLOR, 0, 0);
         expect(color, r);
 
         r = SendMessage(hwnd, LVM_SETTEXTCOLOR, 0, color);
         expect (TRUE, r);
-        r = SendMessage(hwnd, LVM_GETTEXTCOLOR, 0, color);
+        r = SendMessage(hwnd, LVM_GETTEXTCOLOR, 0, 0);
         expect(color, r);
 
         r = SendMessage(hwnd, LVM_SETTEXTBKCOLOR, 0, color);
         expect(TRUE, r);
-        r = SendMessage(hwnd, LVM_GETTEXTBKCOLOR, 0, color);
+        r = SendMessage(hwnd, LVM_GETTEXTBKCOLOR, 0, 0);
         expect(color, r);
     }
 
     ok_sequence(sequences, LISTVIEW_SEQ_INDEX, listview_color_seq, "test color seq", FALSE);
-
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+    /* invalidation test done separately to avoid a message chain mess */
+    r = ValidateRect(hwnd, NULL);
+    expect(TRUE, r);
+    r = SendMessage(hwnd, LVM_SETBKCOLOR, 0, colors[0]);
+    expect(TRUE, r);
+
+    rect.right = rect.bottom = 1;
+    r = GetUpdateRect(hwnd, &rect, TRUE);
+    todo_wine expect(FALSE, r);
+    todo_wine ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
+
+    r = ValidateRect(hwnd, NULL);
+    expect(TRUE, r);
+    r = SendMessage(hwnd, LVM_SETTEXTCOLOR, 0, colors[0]);
+    expect(TRUE, r);
+
+    rect.right = rect.bottom = 1;
+    r = GetUpdateRect(hwnd, &rect, TRUE);
+    todo_wine expect(FALSE, r);
+    todo_wine ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
+
+    r = ValidateRect(hwnd, NULL);
+    expect(TRUE, r);
+    r = SendMessage(hwnd, LVM_SETTEXTBKCOLOR, 0, colors[0]);
+    expect(TRUE, r);
+
+    rect.right = rect.bottom = 1;
+    r = GetUpdateRect(hwnd, &rect, TRUE);
+    todo_wine expect(FALSE, r);
+    ok(rect.right == 0 && rect.bottom == 0, "got update rectangle\n");
+
     DestroyWindow(hwnd);
 }
 
-- 
1.5.6.5



--------------070704070403070904020609--



More information about the wine-patches mailing list