[PATCH v2 5/6] uxtheme/tests: Add GetThemeBackgroundRegion() tests.

Zhiyi Zhang wine at gitlab.winehq.org
Mon Jun 27 16:12:15 CDT 2022


From: Zhiyi Zhang <zzhang at codeweavers.com>

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/uxtheme/tests/system.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c
index cbaf4b51258..e9c91c62638 100644
--- a/dlls/uxtheme/tests/system.c
+++ b/dlls/uxtheme/tests/system.c
@@ -2399,6 +2399,40 @@ static void test_DrawThemeBackgroundEx(void)
     DestroyWindow(hwnd);
 }
 
+static void test_GetThemeBackgroundRegion(void)
+{
+    HTHEME htheme;
+    HRGN region;
+    HRESULT hr;
+    HWND hwnd;
+    RECT rect;
+    int ret;
+
+    hwnd = CreateWindowA(WC_STATICA, "", WS_POPUP, 0, 0, 1, 1, 0, 0, 0, NULL);
+    ok(hwnd != NULL, "CreateWindowA failed, error %#lx.\n", GetLastError());
+    htheme = OpenThemeData(hwnd, L"Rebar");
+    if (!htheme)
+    {
+        skip("Theming is inactive.\n");
+        DestroyWindow(hwnd);
+        return;
+    }
+
+    hr = GetThemeEnumValue(htheme, RP_BAND, 0, TMT_BGTYPE, &ret);
+    ok(hr == S_OK, "Got unexpected hr %#lx,\n", hr);
+    ok(ret == BT_NONE, "Got expected type %d.\n", ret);
+
+    SetRect(&rect, 0, 0, 10, 10);
+    region = (HRGN)0xdeadbeef;
+    hr = GetThemeBackgroundRegion(htheme, NULL, RP_BAND, 0, &rect, &region);
+    todo_wine
+    ok(hr == E_UNEXPECTED || broken(hr == S_OK) /* < Win10 */, "Got unexpected hr %#lx.\n", hr);
+    ok(region == (HRGN)0xdeadbeef, "Got unexpected region.\n");
+
+    CloseThemeData(htheme);
+    DestroyWindow(hwnd);
+}
+
 START_TEST(system)
 {
     ULONG_PTR ctx_cookie;
@@ -2422,6 +2456,7 @@ START_TEST(system)
     test_GetThemeTransitionDuration();
     test_DrawThemeParentBackground();
     test_DrawThemeBackgroundEx();
+    test_GetThemeBackgroundRegion();
 
     if (load_v6_module(&ctx_cookie, &ctx))
     {
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/317



More information about the wine-devel mailing list