Commit ab091b28 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

uxtheme/tests: Test that scrollbar parts should have very few #ffffff pixels.

parent fbfc8df4
......@@ -2633,12 +2633,15 @@ static void test_GetThemeBackgroundRegion(void)
DestroyWindow(hwnd);
}
static void test_theme(void)
static void test_theme(BOOL v6)
{
static const int scrollbar_width = 200, scrollbar_height = 50;
int x, y, white_count = 0, white_percent;
BOOL transparent;
HTHEME htheme;
HRESULT hr;
HWND hwnd;
HDC hdc;
if (!IsThemeActive())
{
......@@ -2675,6 +2678,34 @@ static void test_theme(void)
CloseThemeData(htheme);
DestroyWindow(hwnd);
/* Test that scrollbar parts should have very few #ffffff pixels */
hwnd = CreateWindowA(WC_SCROLLBARA, "scrollbar", WS_POPUP | WS_VISIBLE, 0, 0, scrollbar_width,
scrollbar_height, 0, 0, 0, NULL);
ok(!!hwnd, "CreateWindowA failed, error %#lx.\n", GetLastError());
flush_events();
hdc = GetDC(hwnd);
for (y = 0; y < scrollbar_height; y++)
{
for (x = 0; x < scrollbar_width; x++)
{
COLORREF color = GetPixel(hdc, x, y);
ok(color != CLR_INVALID, "GetPixel failed.\n");
if (color == 0xffffff)
white_count++;
}
}
white_percent = white_count * 100 / (scrollbar_width * scrollbar_height);
if (v6)
todo_wine
ok(white_percent < 4, "Expected #ffffff pixels less than 4%%.\n");
else
ok(white_percent < 50, "Expected #ffffff pixels less than 50%%.\n");
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
}
static void test_ShouldSystemUseDarkMode(void)
......@@ -2760,13 +2791,14 @@ START_TEST(system)
test_DrawThemeParentBackground();
test_DrawThemeBackgroundEx();
test_GetThemeBackgroundRegion();
test_theme();
test_theme(FALSE);
test_ShouldSystemUseDarkMode();
test_ShouldAppsUseDarkMode();
if (load_v6_module(&ctx_cookie, &ctx))
{
test_EnableThemeDialogTexture();
test_theme(TRUE);
unload_v6_module(ctx_cookie, ctx);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment