ReactOS 0.4.15-dev-5666-gc548b97
SetWindowTheme.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for SetWindowTheme
5 * PROGRAMMERS: Giannis Adamopoulos
6 */
7
8#include <apitest.h>
9#include <stdio.h>
10#include <windows.h>
11#include <uxtheme.h>
12
14{
15 HRESULT hr;
16
18 ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
19
20 hr = SetWindowTheme((HWND)(ULONG_PTR)0xdeaddeaddeaddeadULL, NULL, NULL);
21 ok (hr == E_HANDLE, "Expected E_HANDLE got 0x%lx error\n", hr);
22
24 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
25
26 hr = SetWindowTheme(hwnd, L"none", L"none");
27 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
28
29 hr = SetWindowTheme(hwnd, NULL, L"none");
30 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
31
32 hr = SetWindowTheme(hwnd, L"none", NULL);
33 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
34
35 hr = SetWindowTheme(hwnd, L"", L"");
36 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
37}
38
40{
41 HRESULT hr;
42 HTHEME htheme1, htheme2;
43
45 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
46
47 htheme1 = OpenThemeData(hwnd, L"Toolbar");
48 if (IsThemeActive())
49 ok (htheme1 != NULL, "OpenThemeData failed\n");
50 else
51 skip("Theme not active\n");
52
53 hr = SetWindowTheme(hwnd, L"", L"");
54 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
55
56 htheme2 = OpenThemeData(hwnd, L"Toolbar");
57 ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
58
59 hr = SetWindowTheme(hwnd, L"TrayNotify", L"");
60 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
61
62 htheme2 = OpenThemeData(hwnd, L"Toolbar");
63 ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
64
65 hr = SetWindowTheme(hwnd, L"TrayNotify", NULL);
66 ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
67
68 htheme2 = OpenThemeData(hwnd, L"Toolbar");
69 if (IsThemeActive())
70 {
71 ok (htheme2 != NULL, "OpenThemeData failed\n");
72 ok(htheme1 != htheme2, "Expected different theme data\n");
73 }
74 else
75 {
76 skip("Theme not active\n");
77 }
78}
79
81{
82 HWND hwnd;
83
84 hwnd = CreateWindowW(L"button", L"Test window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
85 ok (hwnd != NULL, "Expected CreateWindowW to succeed\n");
86
89
91}
void TestTheme(HWND hwnd)
void TestParams(HWND hwnd)
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
#define S_OK
Definition: intsafe.h:52
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
HRESULT hr
Definition: shlfolder.c:183
uint32_t ULONG_PTR
Definition: typedefs.h:65
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define E_HANDLE
Definition: winerror.h:2850
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4306
BOOL WINAPI DestroyWindow(_In_ HWND)