ReactOS  0.4.14-dev-55-g2da92ac
SetThemeAppProperties.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 SetThemeAppProperties
5  * PROGRAMMERS: Giannis Adamopoulos
6  */
7 
8 #include <apitest.h>
9 #include <stdio.h>
10 #include <windows.h>
11 #include <uxtheme.h>
12 #include <vfwmsgs.h>
13 
15 {
17  HTHEME hTheme;
18  HWND hWnd;
19 
21  if (!bThemeActive)
22  {
23  skip("No active theme, skipping SetWindowTheme tests\n");
24  return;
25  }
26 
27  SetLastError(0xdeadbeef);
28 
30  ok (bThemeActive == FALSE, "\n");
31  ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
32 
33  SetLastError(0xdeadbeef);
34  hTheme = OpenThemeData(NULL, L"BUTTON");
35  ok (hTheme == NULL, "\n");
36  ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
37 
38  hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
39  ok (hWnd != NULL, "\n");
40 
41  SetLastError(0xdeadbeef);
43  ok (bThemeActive == TRUE, "\n");
44  ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
45 
46  SetLastError(0xdeadbeef);
47  hTheme = OpenThemeData(NULL, L"BUTTON");
48  ok (hTheme != NULL, "\n");
49  ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
50 
51  SetLastError(0xdeadbeef);
53  ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
54 
56  ok (bThemeActive == TRUE, "\n");
57 
59  ok (bThemeActive == TRUE, "\n");
60 
61  SetLastError(0xdeadbeef);
62  hTheme = OpenThemeData(NULL, L"BUTTON");
63  ok (hTheme == NULL, "\n");
64  ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
65 
66  SetThemeAppProperties(STAP_ALLOW_NONCLIENT);
67 
68  hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
69  ok (hTheme != NULL, "\n");
70  SetLastError(0xdeadbeef);
71  hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
72  ok (hTheme == NULL, "\n");
73  ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
74 
75  SetThemeAppProperties(STAP_ALLOW_CONTROLS);
76 
77  SetLastError(0xdeadbeef);
78  hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
79  ok (hTheme == NULL, "\n");
80  ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
81  hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
82  ok (hTheme != NULL, "\n");
83 
84 }
#define TRUE
Definition: types.h:120
START_TEST(SetThemeAppProperties)
HWND hWnd
Definition: settings.c:17
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
void WINAPI SetThemeAppProperties(DWORD dwFlags)
Definition: system.c:941
smooth NULL
Definition: ftsmooth.c:416
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:819
#define SetLastError(x)
Definition: compat.h:409
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
static const WCHAR L[]
Definition: oid.c:1250
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
#define skip(...)
Definition: atltest.h:64
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
static BOOL bThemeActive
Definition: scroll.c:29