Author: gadamopoulos
Date: Fri Mar 10 17:56:18 2017
New Revision: 74144
URL:
http://svn.reactos.org/svn/reactos?rev=74144&view=rev
Log:
[UXTHEME] -Add tests for SetWindowTheme to test the behavior that was changed in r74038.
Added:
trunk/rostests/apitests/uxtheme/SetWindowTheme.c (with props)
Modified:
trunk/rostests/apitests/uxtheme/CMakeLists.txt
trunk/rostests/apitests/uxtheme/testlist.c
Modified: trunk/rostests/apitests/uxtheme/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/uxtheme/CMakeLis…
==============================================================================
--- trunk/rostests/apitests/uxtheme/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/uxtheme/CMakeLists.txt [iso-8859-1] Fri Mar 10 17:56:18 2017
@@ -2,6 +2,7 @@
list(APPEND SOURCE
CloseThemeData.c
DrawThemeParentBackground.c
+ SetWindowTheme.c
../include/msgtrace.c
testlist.c)
Added: trunk/rostests/apitests/uxtheme/SetWindowTheme.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/uxtheme/SetWindo…
==============================================================================
--- trunk/rostests/apitests/uxtheme/SetWindowTheme.c (added)
+++ trunk/rostests/apitests/uxtheme/SetWindowTheme.c [iso-8859-1] Fri Mar 10 17:56:18
2017
@@ -0,0 +1,80 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: Test for SetWindowTheme
+ * PROGRAMMERS: Giannis Adamopoulos
+ */
+
+#include <apitest.h>
+#include <stdio.h>
+#include <windows.h>
+#include <uxtheme.h>
+
+void TestParams(HWND hwnd)
+{
+ HRESULT hr;
+
+ hr = SetWindowTheme(0, NULL, NULL);
+ ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
+
+ hr = SetWindowTheme((HWND)0xdeaddead, NULL, NULL);
+ ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
+
+ hr = SetWindowTheme(hwnd, NULL, NULL);
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ hr = SetWindowTheme(hwnd, L"none", L"none");
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ hr = SetWindowTheme(hwnd, NULL, L"none");
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ hr = SetWindowTheme(hwnd, L"none", NULL);
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ hr = SetWindowTheme(hwnd, L"", L"");
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+}
+
+void TestTheme(HWND hwnd)
+{
+ HRESULT hr;
+ HTHEME htheme1, htheme2;
+
+ hr = SetWindowTheme(hwnd, NULL, NULL);
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ htheme1 = OpenThemeData(hwnd, L"Toolbar");
+ ok (htheme1 != NULL, "OpenThemeData failed\n");
+
+ hr = SetWindowTheme(hwnd, L"", L"");
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ htheme2 = OpenThemeData(hwnd, L"Toolbar");
+ ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
+
+ hr = SetWindowTheme(hwnd, L"TrayNotify", L"");
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ htheme2 = OpenThemeData(hwnd, L"Toolbar");
+ ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
+
+ hr = SetWindowTheme(hwnd, L"TrayNotify", NULL);
+ ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
+
+ htheme2 = OpenThemeData(hwnd, L"Toolbar");
+ ok (htheme2 != NULL, "OpenThemeData failed\n");
+
+ ok(htheme1 != htheme2, "Expected different theme data\n");
+}
+
+START_TEST(SetWindowTheme)
+{
+ HWND hwnd;
+
+ hwnd = CreateWindowW(L"button", L"Test window",
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
+ ok (hwnd != NULL, "Expected CreateWindowW to succeed\n");
+
+ TestParams(hwnd);
+ TestTheme(hwnd);
+}
Propchange: trunk/rostests/apitests/uxtheme/SetWindowTheme.c
------------------------------------------------------------------------------
svn:eol-style = CRLF
Modified: trunk/rostests/apitests/uxtheme/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/uxtheme/testlist…
==============================================================================
--- trunk/rostests/apitests/uxtheme/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/uxtheme/testlist.c [iso-8859-1] Fri Mar 10 17:56:18 2017
@@ -3,12 +3,14 @@
#define STANDALONE
#include <apitest.h>
+extern void func_CloseThemeData(void);
extern void func_DrawThemeParentBackground(void);
-extern void func_CloseThemeData(void);
+extern void func_SetWindowTheme(void);
const struct test winetest_testlist[] =
{
+ { "CloseThemeData", func_CloseThemeData },
{ "DrawThemeParentBackground", func_DrawThemeParentBackground },
- { "CloseThemeData", func_CloseThemeData },
+ { "SetWindowTheme", func_SetWindowTheme },
{ 0, 0 }
};