comctl32/tests: Fix a treeview test failure when theming is on.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-10-06 15:48:33 +08:00 committed by Alexandre Julliard
parent 8f6a4438b4
commit 0f2f195831
1 changed files with 19 additions and 4 deletions

View File

@ -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
}