From: strudelll strudelll@etersoft.ru
Add a conformance test that calls GetCurrentThemeName() and checks that the returned path ends with \Aero\Aero.msstyles (regardless of Light/Dark). Skip if theming is inactive. On Wine this currently returns ...\light\light.msstyles, so the check is wrapped in todo_wine.
Tested on: - Windows 10 22H2: theme=Aero\Aero.msstyles (passes) - Windows 11 24H2: theme=Aero\Aero.msstyles (passes)
Signed-off-by: Nikita strudelll@etersoft.ru --- dlls/uxtheme/tests/system.c | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c index 6597dc274cd..994775d523b 100644 --- a/dlls/uxtheme/tests/system.c +++ b/dlls/uxtheme/tests/system.c @@ -36,6 +36,10 @@
#include "v6util.h"
+#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif + static HTHEME (WINAPI * pOpenThemeDataEx)(HWND, LPCWSTR, DWORD); static HTHEME (WINAPI *pOpenThemeDataForDpi)(HWND, LPCWSTR, UINT); static HRESULT (WINAPI *pOpenThemeFile)(const WCHAR *, const WCHAR *, const WCHAR *, HANDLE, DWORD); @@ -782,6 +786,55 @@ static void test_OpenThemeDataForDpi(void) } }
+static BOOL ends_with_i(const WCHAR *s, const WCHAR *suffix) +{ + size_t ls, lt; + size_t i; + + if (!s || !suffix) return FALSE; + ls = lstrlenW(s); + lt = lstrlenW(suffix); + if (lt > ls) return FALSE; + for (i = 0; i < lt; ++i) + { + WCHAR a = s[ls - lt + i], b = suffix[i]; + if (a >= L'A' && a <= L'Z') a += L'a' - L'A'; + if (b >= L'A' && b <= L'Z') b += L'a' - L'A'; + if (a != b) return FALSE; + } + return TRUE; +} + +static BOOL ends_with_aero_msstyles(const WCHAR *path) +{ + static const WCHAR suf1[] = L"\Aero\Aero.msstyles"; + static const WCHAR suf2[] = L"/Aero/Aero.msstyles"; + return ends_with_i(path, suf1) || ends_with_i(path, suf2); +} + +static void test_GetCurrentThemeName_maps_to_aero(void) +{ + HRESULT hr; + WCHAR theme[MAX_PATH], color[64], size[64]; + + if (!IsThemeActive()) + { + win_skip("Themes are inactive on this system.\n"); + return; + } + + theme[0] = color[0] = size[0] = 0; + hr = GetCurrentThemeName(theme, ARRAY_SIZE(theme), color, ARRAY_SIZE(color), + size, ARRAY_SIZE(size)); + ok(hr == S_OK, "GetCurrentThemeName failed, hr=%#lx\n", hr); + trace("theme=%s color=%s size=%s\n", + wine_dbgstr_w(theme), wine_dbgstr_w(color), wine_dbgstr_w(size)); + + todo_wine ok(ends_with_aero_msstyles(theme), + "Expected '\\Aero\\Aero.msstyles', got %s\n", + wine_dbgstr_w(theme)); +} + static void test_GetCurrentThemeName(void) { BOOL bThemeActive; @@ -2836,6 +2889,8 @@ START_TEST(system) unload_v6_module(ctx_cookie, ctx); }
+ test_GetCurrentThemeName_maps_to_aero(); + /* Test EnableTheming() in the end because it may disable theming */ test_EnableTheming(); }