[PATCH 5/5] comctl32/tests: Fix a treeview test failure when theming is on.

Zhiyi Zhang zzhang at codeweavers.com
Wed Oct 6 02:48:33 CDT 2021


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/comctl32/tests/treeview.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 02d914c249c..0d245cf9d15 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -27,12 +27,17 @@
 #include "winuser.h"
 #include "winnls.h"
 #include "winreg.h"
-#include "commctrl.h" 
+#include "commctrl.h"
+#include "uxtheme.h"
+#include "vsstyle.h"
 
 #include "wine/test.h"
 #include "v6util.h"
 #include "msg.h"
 
+static HTHEME (WINAPI *pGetWindowTheme)(HWND);
+static BOOL (WINAPI *pIsThemeBackgroundPartiallyTransparent)(HTHEME, int, int);
+
 static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
 static const char *TEST_CALLBACK_TEXT = "callback_text";
 
@@ -2121,6 +2126,8 @@ static void test_TVS_SINGLEEXPAND(void)
 
 static void test_WM_PAINT(void)
 {
+    BOOL is_glyph_transparent;
+    HTHEME htheme;
     HWND hTree;
     COLORREF clr;
     LONG ret;
@@ -2144,7 +2151,11 @@ static void test_WM_PAINT(void)
     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 */,
+    htheme = pGetWindowTheme(hTree);
+    is_glyph_transparent = htheme && pIsThemeBackgroundPartiallyTransparent(htheme, TVP_GLYPH, 0);
+    ok(clr == RGB(255, 0, 0) || broken(clr == RGB(0, 0, 0)) /* win98 */
+       /* When theming is on and treeview glyphs are transparent, parent window needs to be repainted */
+       || (is_glyph_transparent && clr == GetSysColor(COLOR_WINDOW)),
         "got 0x%x\n", clr);
 
     ReleaseDC(hMainWnd, hdc);
@@ -2945,9 +2956,13 @@ static void test_right_click(void)
 static void init_functions(void)
 {
     HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
+    HMODULE hUxtheme = LoadLibraryA("uxtheme.dll");
 
-#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
-    X(InitCommonControlsEx);
+#define X(module, f) p##f = (void*)GetProcAddress(module, #f);
+    X(hComCtl32, InitCommonControlsEx);
+
+    X(hUxtheme, GetWindowTheme);
+    X(hUxtheme, IsThemeBackgroundPartiallyTransparent);
 #undef X
 }
 
-- 
2.30.2



More information about the wine-devel mailing list