Zhiyi Zhang : user32/tests: Test that user32 loads uxtheme.
Alexandre Julliard
julliard at winehq.org
Mon Aug 9 16:21:42 CDT 2021
Module: wine
Branch: master
Commit: cbf7bdce2877645fa2c5c847f48f6a4ffcaeef03
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cbf7bdce2877645fa2c5c847f48f6a4ffcaeef03
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Mon Aug 9 15:00:06 2021 +0800
user32/tests: Test that user32 loads uxtheme.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/class.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index 94dd8105a50..0f4fd1cf90e 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -1490,6 +1490,55 @@ static void test_actctx_classes(void)
ReleaseActCtx(context);
}
+static void test_uxtheme(void)
+{
+ static const CHAR *class_name = "test_uxtheme_class";
+ BOOL (WINAPI * pIsThemeActive)(void);
+ BOOL dll_loaded, is_theme_active;
+ WNDCLASSEXA class;
+ HMODULE uxtheme;
+ ATOM atom;
+ HWND hwnd;
+
+ memset(&class, 0, sizeof(class));
+ class.cbSize = sizeof(class);
+ class.lpfnWndProc = DefWindowProcA;
+ class.hInstance = GetModuleHandleA(NULL);
+ class.lpszClassName = class_name;
+ atom = RegisterClassExA(&class);
+ ok(atom, "RegisterClassExA failed, error %u.\n", GetLastError());
+
+ dll_loaded = !!GetModuleHandleA("comctl32.dll");
+ ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
+ dll_loaded = !!GetModuleHandleA("uxtheme.dll");
+ ok(!dll_loaded, "Expected uxtheme.dll not loaded.\n");
+
+ /* Creating a window triggers uxtheme load when theming is active */
+ hwnd = CreateWindowA(class_name, "Test", WS_POPUP, 0, 0, 1, 1, NULL, NULL,
+ GetModuleHandleA(NULL), NULL);
+ ok(!!hwnd, "Failed to create a test window, error %u.\n", GetLastError());
+
+ dll_loaded = !!GetModuleHandleA("comctl32.dll");
+ ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
+
+ /* Uxtheme is loaded when theming is active */
+ dll_loaded = !!GetModuleHandleA("uxtheme.dll");
+
+ uxtheme = LoadLibraryA("uxtheme.dll");
+ ok(!!uxtheme, "Failed to load uxtheme.dll, error %u.\n", GetLastError());
+ pIsThemeActive = (void *)GetProcAddress(uxtheme, "IsThemeActive");
+ ok(!!pIsThemeActive, "Failed to load IsThemeActive, error %u.\n", GetLastError());
+ is_theme_active = pIsThemeActive();
+ FreeLibrary(uxtheme);
+
+ todo_wine_if(is_theme_active)
+ ok(dll_loaded == is_theme_active, "Expected uxtheme %s when theming is %s.\n",
+ is_theme_active ? "loaded" : "not loaded", is_theme_active ? "active" : "inactive");
+
+ DestroyWindow(hwnd);
+ UnregisterClassA(class_name, GetModuleHandleA(NULL));
+}
+
START_TEST(class)
{
char **argv;
@@ -1502,6 +1551,7 @@ START_TEST(class)
return;
}
+ test_uxtheme();
test_IME();
test_GetClassInfo();
test_extra_values();
More information about the wine-cvs
mailing list