Nikolay Sivov : comctl32/treeview: Erase background when painting over supplied hdc.

Alexandre Julliard julliard at winehq.org
Mon Sep 27 11:29:41 CDT 2010


Module: wine
Branch: master
Commit: b65423c546aca4d1e59a84153e1ab93a3c39e4d8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b65423c546aca4d1e59a84153e1ab93a3c39e4d8

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Sep 26 13:06:46 2010 +0400

comctl32/treeview: Erase background when painting over supplied hdc.

---

 dlls/comctl32/tests/treeview.c |   34 ++++++++++++++++++++++++++++++++++
 dlls/comctl32/treeview.c       |    1 +
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 5464975..572ec9b 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1265,6 +1265,39 @@ static void test_TVS_SINGLEEXPAND(void)
     DestroyWindow(hTree);
 }
 
+static void test_WM_PAINT(void)
+{
+    HWND hTree;
+    COLORREF clr;
+    LONG ret;
+    RECT rc;
+    HDC hdc;
+
+    hTree = create_treeview_control();
+
+    clr = SendMessageA(hTree, TVM_SETBKCOLOR, 0, RGB(255, 0, 0));
+    ok(clr == -1, "got %d, expected -1\n", clr);
+
+    hdc = GetDC(hMainWnd);
+
+    GetClientRect(hMainWnd, &rc);
+    FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH));
+
+    clr = GetPixel(hdc, 1, 1);
+    ok(clr == RGB(0, 0, 0), "got 0x%x\n", clr);
+
+    ret = SendMessageA(hTree, WM_PAINT, (WPARAM)hdc, 0);
+    ok(ret == 0, "got %d\n", ret);
+
+    clr = GetPixel(hdc, 1, 1);
+    ok(clr == RGB(255, 0, 0) || broken(clr == RGB(0, 0, 0)) /* win98 */,
+        "got 0x%x\n", clr);
+
+    ReleaseDC(hMainWnd, hdc);
+
+    DestroyWindow(hTree);
+}
+
 START_TEST(treeview)
 {
     HMODULE hComctl32;
@@ -1330,6 +1363,7 @@ START_TEST(treeview)
     test_treeview_classinfo();
     test_expandnotify();
     test_TVS_SINGLEEXPAND();
+    test_WM_PAINT();
 
     if (!load_v6_module(&ctx_cookie, &hCtx))
     {
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 3e987ab..9609336 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -2921,6 +2921,7 @@ TREEVIEW_Paint(TREEVIEW_INFO *infoPtr, HDC hdc_ref)
     {
         hdc = hdc_ref;
         GetClientRect(infoPtr->hwnd, &rc);
+        TREEVIEW_FillBkgnd(infoPtr, hdc, &rc);
     }
     else
     {




More information about the wine-cvs mailing list