[uxtheme/tests][4] Add some tests for GetWindowTheme

Paul Vriens Paul.Vriens at xs4all.nl
Wed Jun 21 11:51:00 CDT 2006


Hi,

new simple tests for GetWindowTheme.

Tests succeed on Wine (theming enabled/disabled), WinXP (theming
enabled) and W2K3 (theming disabled).

Changelog
  Add some tests for GetWindowTheme

Cheers,

Paul.

---
diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c
index 579c399..dc60105 100644
--- a/dlls/uxtheme/tests/system.c
+++ b/dlls/uxtheme/tests/system.c
@@ -26,6 +26,7 @@ #include "uxtheme.h"
 #include "wine/test.h"
 
 static HRESULT (WINAPI * pCloseThemeData)(HTHEME);
+static HTHEME  (WINAPI * pGetWindowTheme)(HWND);
 static BOOL    (WINAPI * pIsAppThemed)(VOID);
 static BOOL    (WINAPI * pIsThemeActive)(VOID);
 static HTHEME  (WINAPI * pOpenThemeData)(HWND, LPCWSTR);
@@ -51,6 +52,7 @@ static BOOL InitFunctionPtrs(void)
     if (hUxtheme)
     {
       UXTHEME_GET_PROC(CloseThemeData)
+      UXTHEME_GET_PROC(GetWindowTheme)
       UXTHEME_GET_PROC(IsAppThemed)
       UXTHEME_GET_PROC(IsThemeActive)
       UXTHEME_GET_PROC(OpenThemeData)
@@ -89,6 +91,31 @@ static void test_IsThemed(void)
             GetLastError());
 }
 
+static void test_GetWindowTheme(void)
+{
+    HTHEME    hTheme;
+    HWND      hWnd;
+
+    SetLastError(0xdeadbeef);
+    hTheme = pGetWindowTheme(NULL);
+    ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
+    todo_wine
+        ok( GetLastError() == E_HANDLE,
+            "Expected E_HANDLE, got 0x%08lx\n",
+            GetLastError());
+
+    /* Only do the bare minumum to get a valid hwnd */
+    hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
+    if (!hWnd) return;
+
+    SetLastError(0xdeadbeef);
+    hTheme = pGetWindowTheme(hWnd);
+    ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
+    ok( GetLastError() == 0xdeadbeef,
+        "Expected 0xdeadbeef, got 0x%08lx\n",
+        GetLastError());
+}
+
 static void test_SetWindowTheme(void)
 {
     HRESULT hRes;
@@ -244,6 +271,11 @@ START_TEST(system)
     if (pIsAppThemed && pIsThemeActive)
         test_IsThemed();
 
+    /* GetWindowTheme */
+    trace("Starting test_GetWindowTheme()\n");
+    if (pGetWindowTheme)
+        test_GetWindowTheme();
+
     /* SetWindowTheme */
     trace("Starting test_SetWindowTheme()\n");
     if (pSetWindowTheme)
-- 
1.4.0




More information about the wine-patches mailing list