[UXTHEME_APITEST] -Add tests for SetThemeAppProperties.
authorgadamopoulos <gadamopoulos@97493ccd-5924-5043-b1f5-66cb403b36ce>
Wed, 9 Aug 2017 07:14:44 +0000 (07:14 +0000)
committergadamopoulos <gadamopoulos@97493ccd-5924-5043-b1f5-66cb403b36ce>
Wed, 9 Aug 2017 07:14:44 +0000 (07:14 +0000)
git-svn-id: file:///srv/svn/reactos/trunk@75513 97493ccd-5924-5043-b1f5-66cb403b36ce

rostests/apitests/uxtheme/CMakeLists.txt
rostests/apitests/uxtheme/SetThemeAppProperties.c [new file with mode: 0644]
rostests/apitests/uxtheme/testlist.c

index 333a874..ccb6706 100644 (file)
@@ -3,6 +3,7 @@ list(APPEND SOURCE
     CloseThemeData.c
     DrawThemeParentBackground.c
     SetWindowTheme.c
+    SetThemeAppProperties.c
     ../include/msgtrace.c
     testlist.c)
 
diff --git a/rostests/apitests/uxtheme/SetThemeAppProperties.c b/rostests/apitests/uxtheme/SetThemeAppProperties.c
new file mode 100644 (file)
index 0000000..35288ca
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for SetThemeAppProperties
+ * PROGRAMMERS:     Giannis Adamopoulos
+ */
+#include <apitest.h>
+#include <stdio.h>
+#include <windows.h>
+#include <uxtheme.h>
+#include <vfwmsgs.h>
+
+START_TEST(SetThemeAppProperties)
+{
+    BOOL bThemeActive;
+    HTHEME hTheme;
+    HWND hWnd;
+
+    bThemeActive = IsThemeActive();
+    if (!bThemeActive)
+    {
+        skip("No active theme, skipping SetWindowTheme tests\n");
+        return;
+    }
+
+    SetLastError(0xdeadbeef);
+    
+    bThemeActive = IsAppThemed();
+    ok (bThemeActive == FALSE, "\n");
+    ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
+
+    SetLastError(0xdeadbeef);            
+    hTheme = OpenThemeData(NULL, L"BUTTON");
+    ok (hTheme == NULL, "\n");
+    ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
+    
+    hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
+    ok (hWnd != NULL, "\n");
+
+    SetLastError(0xdeadbeef);
+    bThemeActive = IsAppThemed();
+    ok (bThemeActive == TRUE, "\n");
+    ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    hTheme = OpenThemeData(NULL, L"BUTTON");
+    ok (hTheme != NULL, "\n");
+    ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    SetThemeAppProperties(0);
+    ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
+
+    bThemeActive = IsThemeActive();
+    ok (bThemeActive == TRUE, "\n");
+
+    bThemeActive = IsAppThemed();
+    ok (bThemeActive == TRUE, "\n");
+    
+    SetLastError(0xdeadbeef);
+    hTheme = OpenThemeData(NULL, L"BUTTON");
+    ok (hTheme == NULL, "\n");
+    ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
+
+    SetThemeAppProperties(STAP_ALLOW_NONCLIENT);
+
+    hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
+    ok (hTheme != NULL, "\n");
+    SetLastError(0xdeadbeef);
+    hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
+    ok (hTheme == NULL, "\n");
+    ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
+    
+    SetThemeAppProperties(STAP_ALLOW_CONTROLS);
+
+    SetLastError(0xdeadbeef);
+    hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
+    ok (hTheme == NULL, "\n");
+    ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
+    hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
+    ok (hTheme != NULL, "\n");
+
+}
index 7b06a3f..0ecc2b9 100644 (file)
@@ -5,6 +5,7 @@
 
 extern void func_CloseThemeData(void);
 extern void func_DrawThemeParentBackground(void);
+extern void func_SetThemeAppProperties(void);
 extern void func_SetWindowTheme(void);
 
 const struct test winetest_testlist[] =
@@ -12,5 +13,6 @@ const struct test winetest_testlist[] =
     { "CloseThemeData", func_CloseThemeData },
     { "DrawThemeParentBackground", func_DrawThemeParentBackground },
     { "SetWindowTheme", func_SetWindowTheme },
+    { "SetThemeAppProperties", func_SetThemeAppProperties },
     { 0, 0 }
 };