1*c2c66affSColin Finck /*
2*c2c66affSColin Finck * PROJECT: ReactOS api tests
3*c2c66affSColin Finck * LICENSE: GPL - See COPYING in the top level directory
4*c2c66affSColin Finck * PURPOSE: Test for SetThemeAppProperties
5*c2c66affSColin Finck * PROGRAMMERS: Giannis Adamopoulos
6*c2c66affSColin Finck */
7*c2c66affSColin Finck
8*c2c66affSColin Finck #include <apitest.h>
9*c2c66affSColin Finck #include <stdio.h>
10*c2c66affSColin Finck #include <windows.h>
11*c2c66affSColin Finck #include <uxtheme.h>
12*c2c66affSColin Finck #include <vfwmsgs.h>
13*c2c66affSColin Finck
START_TEST(SetThemeAppProperties)14*c2c66affSColin Finck START_TEST(SetThemeAppProperties)
15*c2c66affSColin Finck {
16*c2c66affSColin Finck BOOL bThemeActive;
17*c2c66affSColin Finck HTHEME hTheme;
18*c2c66affSColin Finck HWND hWnd;
19*c2c66affSColin Finck
20*c2c66affSColin Finck bThemeActive = IsThemeActive();
21*c2c66affSColin Finck if (!bThemeActive)
22*c2c66affSColin Finck {
23*c2c66affSColin Finck skip("No active theme, skipping SetWindowTheme tests\n");
24*c2c66affSColin Finck return;
25*c2c66affSColin Finck }
26*c2c66affSColin Finck
27*c2c66affSColin Finck SetLastError(0xdeadbeef);
28*c2c66affSColin Finck
29*c2c66affSColin Finck bThemeActive = IsAppThemed();
30*c2c66affSColin Finck ok (bThemeActive == FALSE, "\n");
31*c2c66affSColin Finck ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
32*c2c66affSColin Finck
33*c2c66affSColin Finck SetLastError(0xdeadbeef);
34*c2c66affSColin Finck hTheme = OpenThemeData(NULL, L"BUTTON");
35*c2c66affSColin Finck ok (hTheme == NULL, "\n");
36*c2c66affSColin Finck ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
37*c2c66affSColin Finck
38*c2c66affSColin Finck hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
39*c2c66affSColin Finck ok (hWnd != NULL, "\n");
40*c2c66affSColin Finck
41*c2c66affSColin Finck SetLastError(0xdeadbeef);
42*c2c66affSColin Finck bThemeActive = IsAppThemed();
43*c2c66affSColin Finck ok (bThemeActive == TRUE, "\n");
44*c2c66affSColin Finck ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
45*c2c66affSColin Finck
46*c2c66affSColin Finck SetLastError(0xdeadbeef);
47*c2c66affSColin Finck hTheme = OpenThemeData(NULL, L"BUTTON");
48*c2c66affSColin Finck ok (hTheme != NULL, "\n");
49*c2c66affSColin Finck ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
50*c2c66affSColin Finck
51*c2c66affSColin Finck SetLastError(0xdeadbeef);
52*c2c66affSColin Finck SetThemeAppProperties(0);
53*c2c66affSColin Finck ok( GetLastError() == 0, "Expected 0 last error, got 0x%lx\n", GetLastError());
54*c2c66affSColin Finck
55*c2c66affSColin Finck bThemeActive = IsThemeActive();
56*c2c66affSColin Finck ok (bThemeActive == TRUE, "\n");
57*c2c66affSColin Finck
58*c2c66affSColin Finck bThemeActive = IsAppThemed();
59*c2c66affSColin Finck ok (bThemeActive == TRUE, "\n");
60*c2c66affSColin Finck
61*c2c66affSColin Finck SetLastError(0xdeadbeef);
62*c2c66affSColin Finck hTheme = OpenThemeData(NULL, L"BUTTON");
63*c2c66affSColin Finck ok (hTheme == NULL, "\n");
64*c2c66affSColin Finck ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
65*c2c66affSColin Finck
66*c2c66affSColin Finck SetThemeAppProperties(STAP_ALLOW_NONCLIENT);
67*c2c66affSColin Finck
68*c2c66affSColin Finck hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
69*c2c66affSColin Finck ok (hTheme != NULL, "\n");
70*c2c66affSColin Finck SetLastError(0xdeadbeef);
71*c2c66affSColin Finck hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
72*c2c66affSColin Finck ok (hTheme == NULL, "\n");
73*c2c66affSColin Finck ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
74*c2c66affSColin Finck
75*c2c66affSColin Finck SetThemeAppProperties(STAP_ALLOW_CONTROLS);
76*c2c66affSColin Finck
77*c2c66affSColin Finck SetLastError(0xdeadbeef);
78*c2c66affSColin Finck hTheme = OpenThemeDataEx (NULL, L"BUTTON", OTD_NONCLIENT);
79*c2c66affSColin Finck ok (hTheme == NULL, "\n");
80*c2c66affSColin Finck ok( GetLastError() == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED last error, got 0x%lx\n", GetLastError());
81*c2c66affSColin Finck hTheme = OpenThemeDataEx (NULL, L"BUTTON", 0);
82*c2c66affSColin Finck ok (hTheme != NULL, "\n");
83*c2c66affSColin Finck
84*c2c66affSColin Finck }
85