ReactOS  0.4.14-dev-115-g4576127
SetWindowTheme.c File Reference
#include <apitest.h>
#include <stdio.h>
#include <windows.h>
#include <uxtheme.h>
Include dependency graph for SetWindowTheme.c:

Go to the source code of this file.

Functions

void TestParams (HWND hwnd)
 
void TestTheme (HWND hwnd)
 
 START_TEST (SetWindowTheme)
 

Function Documentation

◆ START_TEST()

START_TEST ( SetWindowTheme  )

Definition at line 71 of file SetWindowTheme.c.

72 {
73  HWND hwnd;
74 
75  hwnd = CreateWindowW(L"button", L"Test window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, NULL, NULL, NULL);
76  ok (hwnd != NULL, "Expected CreateWindowW to succeed\n");
77 
79  TestTheme(hwnd);
80 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
void TestParams(HWND hwnd)
void TestTheme(HWND hwnd)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4217
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620

◆ TestParams()

void TestParams ( HWND  hwnd)

Definition at line 13 of file SetWindowTheme.c.

14 {
15  HRESULT hr;
16 
17  hr = SetWindowTheme(0, NULL, NULL);
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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define E_HANDLE
Definition: winerror.h:2850
HRESULT hr
Definition: shlfolder.c:183
uint32_t ULONG_PTR
Definition: typedefs.h:63
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ TestTheme()

void TestTheme ( HWND  hwnd)

Definition at line 39 of file SetWindowTheme.c.

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  ok (htheme1 != NULL, "OpenThemeData failed\n");
49 
50  hr = SetWindowTheme(hwnd, L"", L"");
51  ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
52 
53  htheme2 = OpenThemeData(hwnd, L"Toolbar");
54  ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
55 
56  hr = SetWindowTheme(hwnd, L"TrayNotify", L"");
57  ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
58 
59  htheme2 = OpenThemeData(hwnd, L"Toolbar");
60  ok (htheme2 == NULL, "Expected OpenThemeData to fail\n");
61 
62  hr = SetWindowTheme(hwnd, L"TrayNotify", NULL);
63  ok (hr == S_OK, "Expected S_OK got 0x%lx error\n", hr);
64 
65  htheme2 = OpenThemeData(hwnd, L"Toolbar");
66  ok (htheme2 != NULL, "OpenThemeData failed\n");
67 
68  ok(htheme1 != htheme2, "Expected different theme data\n");
69 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT hr
Definition: shlfolder.c:183
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().