Zhiyi Zhang : comctl32/tests: Fix a treeview test failure when theming is on.
Alexandre Julliard
julliard at winehq.org
Wed Oct 6 15:51:36 CDT 2021
Module: wine
Branch: master
Commit: 0f2f195831ce078034bf070032b69e998709d07f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0f2f195831ce078034bf070032b69e998709d07f
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Wed Oct 6 15:48:33 2021 +0800
comctl32/tests: Fix a treeview test failure when theming is on.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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(module, f) p##f = (void*)GetProcAddress(module, #f);
+ X(hComCtl32, InitCommonControlsEx);
-#define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
- X(InitCommonControlsEx);
+ X(hUxtheme, GetWindowTheme);
+ X(hUxtheme, IsThemeBackgroundPartiallyTransparent);
#undef X
}
More information about the wine-cvs
mailing list