[UXTHEME_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
[reactos.git] / rostests / winetests / uxtheme / system.c
1 /* Unit test suite for uxtheme API functions
2 *
3 * Copyright 2006 Paul Vriens
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 *
19 */
20
21 #include <stdarg.h>
22
23 #include "windows.h"
24 #include "vfwmsgs.h"
25 #include "uxtheme.h"
26
27 #include "wine/test.h"
28
29 static HRESULT (WINAPI * pCloseThemeData)(HTHEME);
30 static HRESULT (WINAPI * pGetCurrentThemeName)(LPWSTR, int, LPWSTR, int, LPWSTR, int);
31 static HTHEME (WINAPI * pGetWindowTheme)(HWND);
32 static BOOL (WINAPI * pIsAppThemed)(VOID);
33 static BOOL (WINAPI * pIsThemeActive)(VOID);
34 static BOOL (WINAPI * pIsThemePartDefined)(HTHEME, int, int);
35 static HTHEME (WINAPI * pOpenThemeData)(HWND, LPCWSTR);
36 static HTHEME (WINAPI * pOpenThemeDataEx)(HWND, LPCWSTR, DWORD);
37 static HRESULT (WINAPI * pSetWindowTheme)(HWND, LPCWSTR, LPCWSTR);
38
39 static HMODULE hUxtheme = 0;
40
41 #define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func);
42
43 static BOOL InitFunctionPtrs(void)
44 {
45 hUxtheme = LoadLibraryA("uxtheme.dll");
46 if(!hUxtheme) {
47 trace("Could not load uxtheme.dll\n");
48 return FALSE;
49 }
50 if (hUxtheme)
51 {
52 UXTHEME_GET_PROC(CloseThemeData)
53 UXTHEME_GET_PROC(GetCurrentThemeName)
54 UXTHEME_GET_PROC(GetWindowTheme)
55 UXTHEME_GET_PROC(IsAppThemed)
56 UXTHEME_GET_PROC(IsThemeActive)
57 UXTHEME_GET_PROC(IsThemePartDefined)
58 UXTHEME_GET_PROC(OpenThemeData)
59 UXTHEME_GET_PROC(OpenThemeDataEx)
60 UXTHEME_GET_PROC(SetWindowTheme)
61 }
62 /* The following functions should be available, if not return FALSE. The Vista functions will
63 * be checked (at some point in time) within the single tests if needed. All used functions for
64 * now are present on WinXP, W2K3 and Wine.
65 */
66 if (!pCloseThemeData || !pGetCurrentThemeName ||
67 !pGetWindowTheme || !pIsAppThemed ||
68 !pIsThemeActive || !pIsThemePartDefined ||
69 !pOpenThemeData || !pSetWindowTheme)
70 {
71 FreeLibrary(hUxtheme);
72 return FALSE;
73 }
74
75 return TRUE;
76 }
77
78 static void test_IsThemed(void)
79 {
80 BOOL bThemeActive;
81 BOOL bAppThemed;
82 BOOL bTPDefined;
83
84 bThemeActive = pIsThemeActive();
85 trace("Theming is %s\n", (bThemeActive) ? "active" : "inactive");
86
87 bAppThemed = pIsAppThemed();
88 trace("Test executable is %s\n", (bAppThemed) ? "themed" : "not themed");
89
90 SetLastError(0xdeadbeef);
91 bTPDefined = pIsThemePartDefined(NULL, 0 , 0);
92 ok( bTPDefined == FALSE, "Expected FALSE\n");
93 ok( GetLastError() == E_HANDLE,
94 "Expected E_HANDLE, got 0x%08x\n",
95 GetLastError());
96 }
97
98 static void test_GetWindowTheme(void)
99 {
100 HTHEME hTheme;
101 HWND hWnd;
102 BOOL bDestroyed;
103
104 SetLastError(0xdeadbeef);
105 hTheme = pGetWindowTheme(NULL);
106 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
107 todo_wine
108 ok( GetLastError() == E_HANDLE,
109 "Expected E_HANDLE, got 0x%08x\n",
110 GetLastError());
111
112 /* Only do the bare minimum to get a valid hwnd */
113 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
114 if (!hWnd) return;
115
116 SetLastError(0xdeadbeef);
117 hTheme = pGetWindowTheme(hWnd);
118 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
119 ok( GetLastError() == 0xdeadbeef,
120 "Expected 0xdeadbeef, got 0x%08x\n",
121 GetLastError());
122
123 bDestroyed = DestroyWindow(hWnd);
124 if (!bDestroyed)
125 trace("Window %p couldn't be destroyed : 0x%08x\n",
126 hWnd, GetLastError());
127 }
128
129 static void test_SetWindowTheme(void)
130 {
131 HRESULT hRes;
132 HWND hWnd;
133 BOOL bDestroyed;
134
135 hRes = pSetWindowTheme(NULL, NULL, NULL);
136 todo_wine
137 ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
138
139 /* Only do the bare minimum to get a valid hwnd */
140 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
141 if (!hWnd) return;
142
143 hRes = pSetWindowTheme(hWnd, NULL, NULL);
144 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
145
146 bDestroyed = DestroyWindow(hWnd);
147 if (!bDestroyed)
148 trace("Window %p couldn't be destroyed : 0x%08x\n",
149 hWnd, GetLastError());
150 }
151
152 static void test_OpenThemeData(void)
153 {
154 HTHEME hTheme, hTheme2;
155 HWND hWnd;
156 BOOL bThemeActive;
157 HRESULT hRes;
158 BOOL bDestroyed;
159 BOOL bTPDefined;
160
161 WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
162 WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
163 WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
164 WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
165
166 bThemeActive = pIsThemeActive();
167
168 /* All NULL */
169 SetLastError(0xdeadbeef);
170 hTheme = pOpenThemeData(NULL, NULL);
171 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
172 ok( GetLastError() == E_POINTER,
173 "Expected GLE() to be E_POINTER, got 0x%08x\n",
174 GetLastError());
175
176 /* A NULL hWnd and an invalid classlist */
177 SetLastError(0xdeadbeef);
178 hTheme = pOpenThemeData(NULL, szInvalidClassList);
179 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
180 todo_wine
181 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
182 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
183 GetLastError());
184
185 SetLastError(0xdeadbeef);
186 hTheme = pOpenThemeData(NULL, szClassList);
187 if (bThemeActive)
188 {
189 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
190 todo_wine
191 ok( GetLastError() == ERROR_SUCCESS,
192 "Expected ERROR_SUCCESS, got 0x%08x\n",
193 GetLastError());
194 }
195 else
196 {
197 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
198 todo_wine
199 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
200 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
201 GetLastError());
202 }
203
204 /* Only do the bare minimum to get a valid hdc */
205 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
206 if (!hWnd) return;
207
208 SetLastError(0xdeadbeef);
209 hTheme = pOpenThemeData(hWnd, NULL);
210 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
211 ok( GetLastError() == E_POINTER,
212 "Expected GLE() to be E_POINTER, got 0x%08x\n",
213 GetLastError());
214
215 SetLastError(0xdeadbeef);
216 hTheme = pOpenThemeData(hWnd, szInvalidClassList);
217 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
218 todo_wine
219 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
220 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
221 GetLastError());
222
223 if (!bThemeActive)
224 {
225 SetLastError(0xdeadbeef);
226 hTheme = pOpenThemeData(hWnd, szButtonClassList);
227 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
228 todo_wine
229 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
230 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
231 GetLastError());
232 skip("No active theme, skipping rest of OpenThemeData tests\n");
233 return;
234 }
235
236 /* Only do the next checks if we have an active theme */
237
238 SetLastError(0xdeadbeef);
239 hTheme = pOpenThemeData(hWnd, szButtonClassList);
240 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
241 todo_wine
242 ok( GetLastError() == ERROR_SUCCESS,
243 "Expected ERROR_SUCCESS, got 0x%08x\n",
244 GetLastError());
245
246 /* Test with bUtToN instead of Button */
247 SetLastError(0xdeadbeef);
248 hTheme = pOpenThemeData(hWnd, szButtonClassList2);
249 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
250 todo_wine
251 ok( GetLastError() == ERROR_SUCCESS,
252 "Expected ERROR_SUCCESS, got 0x%08x\n",
253 GetLastError());
254
255 SetLastError(0xdeadbeef);
256 hTheme = pOpenThemeData(hWnd, szClassList);
257 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
258 todo_wine
259 ok( GetLastError() == ERROR_SUCCESS,
260 "Expected ERROR_SUCCESS, got 0x%08x\n",
261 GetLastError());
262
263 /* GetWindowTheme should return the last handle opened by OpenThemeData */
264 SetLastError(0xdeadbeef);
265 hTheme2 = pGetWindowTheme(hWnd);
266 ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
267 hTheme, hTheme2);
268 ok( GetLastError() == 0xdeadbeef,
269 "Expected 0xdeadbeef, got 0x%08x\n",
270 GetLastError());
271
272 hRes = pCloseThemeData(hTheme);
273 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
274
275 /* Close a second time */
276 hRes = pCloseThemeData(hTheme);
277 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
278
279 /* See if closing makes a difference for GetWindowTheme */
280 SetLastError(0xdeadbeef);
281 hTheme2 = NULL;
282 hTheme2 = pGetWindowTheme(hWnd);
283 ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
284 hTheme, hTheme2);
285 ok( GetLastError() == 0xdeadbeef,
286 "Expected 0xdeadbeef, got 0x%08x\n",
287 GetLastError());
288
289 SetLastError(0xdeadbeef);
290 bTPDefined = pIsThemePartDefined(hTheme, 0 , 0);
291 todo_wine
292 {
293 ok( bTPDefined == FALSE, "Expected FALSE\n");
294 ok( GetLastError() == ERROR_SUCCESS,
295 "Expected ERROR_SUCCESS, got 0x%08x\n",
296 GetLastError());
297 }
298
299 bDestroyed = DestroyWindow(hWnd);
300 if (!bDestroyed)
301 trace("Window %p couldn't be destroyed : 0x%08x\n",
302 hWnd, GetLastError());
303 }
304
305 static void test_OpenThemeDataEx(void)
306 {
307 HTHEME hTheme;
308 HWND hWnd;
309 BOOL bThemeActive;
310 BOOL bDestroyed;
311
312 WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
313 WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
314 WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
315 WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
316
317 if (!pOpenThemeDataEx)
318 {
319 win_skip("OpenThemeDataEx not available\n");
320 return;
321 }
322
323 bThemeActive = pIsThemeActive();
324
325 /* All NULL */
326 SetLastError(0xdeadbeef);
327 hTheme = pOpenThemeDataEx(NULL, NULL, 0);
328 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
329 ok( GetLastError() == E_POINTER,
330 "Expected GLE() to be E_POINTER, got 0x%08x\n",
331 GetLastError());
332
333 /* A NULL hWnd and an invalid classlist without flags */
334 SetLastError(0xdeadbeef);
335 hTheme = pOpenThemeDataEx(NULL, szInvalidClassList, 0);
336 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
337 todo_wine
338 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
339 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
340 GetLastError());
341
342 SetLastError(0xdeadbeef);
343 hTheme = pOpenThemeDataEx(NULL, szClassList, 0);
344 if (bThemeActive)
345 {
346 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
347 todo_wine
348 ok( GetLastError() == ERROR_SUCCESS,
349 "Expected ERROR_SUCCESS, got 0x%08x\n",
350 GetLastError());
351 }
352 else
353 {
354 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
355 todo_wine
356 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
357 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
358 GetLastError());
359 }
360
361 /* Only do the bare minimum to get a valid hdc */
362 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
363 if (!hWnd) return;
364
365 SetLastError(0xdeadbeef);
366 hTheme = pOpenThemeDataEx(hWnd, NULL, 0);
367 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
368 ok( GetLastError() == E_POINTER,
369 "Expected GLE() to be E_POINTER, got 0x%08x\n",
370 GetLastError());
371
372 SetLastError(0xdeadbeef);
373 hTheme = pOpenThemeDataEx(hWnd, szInvalidClassList, 0);
374 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
375 todo_wine
376 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
377 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
378 GetLastError());
379
380 if (!bThemeActive)
381 {
382 SetLastError(0xdeadbeef);
383 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
384 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
385 todo_wine
386 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
387 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
388 GetLastError());
389 skip("No active theme, skipping rest of OpenThemeDataEx tests\n");
390 return;
391 }
392
393 /* Only do the next checks if we have an active theme */
394
395 SetLastError(0xdeadbeef);
396 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
397 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
398 todo_wine
399 ok( GetLastError() == ERROR_SUCCESS,
400 "Expected ERROR_SUCCESS, got 0x%08x\n",
401 GetLastError());
402
403 SetLastError(0xdeadbeef);
404 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_FORCE_RECT_SIZING);
405 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
406 todo_wine
407 ok( GetLastError() == ERROR_SUCCESS,
408 "Expected ERROR_SUCCESS, got 0x%08x\n",
409 GetLastError());
410
411 SetLastError(0xdeadbeef);
412 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_NONCLIENT);
413 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
414 todo_wine
415 ok( GetLastError() == ERROR_SUCCESS,
416 "Expected ERROR_SUCCESS, got 0x%08x\n",
417 GetLastError());
418
419 SetLastError(0xdeadbeef);
420 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0x3);
421 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
422 todo_wine
423 ok( GetLastError() == ERROR_SUCCESS,
424 "Expected ERROR_SUCCESS, got 0x%08x\n",
425 GetLastError());
426
427 /* Test with bUtToN instead of Button */
428 SetLastError(0xdeadbeef);
429 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList2, 0);
430 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
431 todo_wine
432 ok( GetLastError() == ERROR_SUCCESS,
433 "Expected ERROR_SUCCESS, got 0x%08x\n",
434 GetLastError());
435
436 SetLastError(0xdeadbeef);
437 hTheme = pOpenThemeDataEx(hWnd, szClassList, 0);
438 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
439 todo_wine
440 ok( GetLastError() == ERROR_SUCCESS,
441 "Expected ERROR_SUCCESS, got 0x%08x\n",
442 GetLastError());
443
444 bDestroyed = DestroyWindow(hWnd);
445 if (!bDestroyed)
446 trace("Window %p couldn't be destroyed : 0x%08x\n",
447 hWnd, GetLastError());
448 }
449
450 static void test_GetCurrentThemeName(void)
451 {
452 BOOL bThemeActive;
453 HRESULT hRes;
454 WCHAR currentTheme[MAX_PATH];
455 WCHAR currentColor[MAX_PATH];
456 WCHAR currentSize[MAX_PATH];
457
458 bThemeActive = pIsThemeActive();
459
460 /* All NULLs */
461 hRes = pGetCurrentThemeName(NULL, 0, NULL, 0, NULL, 0);
462 if (bThemeActive)
463 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
464 else
465 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
466
467 /* Number of characters given is 0 */
468 hRes = pGetCurrentThemeName(currentTheme, 0, NULL, 0, NULL, 0);
469 if (bThemeActive)
470 ok( hRes == S_OK || broken(hRes == E_FAIL /* WinXP SP1 */), "Expected S_OK, got 0x%08x\n", hRes);
471 else
472 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
473
474 hRes = pGetCurrentThemeName(currentTheme, 2, NULL, 0, NULL, 0);
475 if (bThemeActive)
476 todo_wine
477 ok(hRes == E_NOT_SUFFICIENT_BUFFER ||
478 broken(hRes == E_FAIL /* WinXP SP1 */),
479 "Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes);
480 else
481 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
482
483 /* The same is true if the number of characters is too small for Color and/or Size */
484 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
485 currentColor, 2,
486 currentSize, sizeof(currentSize) / sizeof(WCHAR));
487 if (bThemeActive)
488 todo_wine
489 ok(hRes == E_NOT_SUFFICIENT_BUFFER ||
490 broken(hRes == E_FAIL /* WinXP SP1 */),
491 "Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes);
492 else
493 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
494
495 /* Given number of characters is correct */
496 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR), NULL, 0, NULL, 0);
497 if (bThemeActive)
498 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
499 else
500 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
501
502 /* Given number of characters for the theme name is too large */
503 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme), NULL, 0, NULL, 0);
504 if (bThemeActive)
505 ok( hRes == E_POINTER || hRes == S_OK, "Expected E_POINTER or S_OK, got 0x%08x\n", hRes);
506 else
507 ok( hRes == E_PROP_ID_UNSUPPORTED ||
508 hRes == E_POINTER, /* win2k3 */
509 "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
510
511 /* The too large case is only for the theme name, not for color name or size name */
512 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
513 currentColor, sizeof(currentTheme),
514 currentSize, sizeof(currentSize) / sizeof(WCHAR));
515 if (bThemeActive)
516 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
517 else
518 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
519
520 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
521 currentColor, sizeof(currentTheme) / sizeof(WCHAR),
522 currentSize, sizeof(currentSize));
523 if (bThemeActive)
524 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
525 else
526 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
527
528 /* Correct call */
529 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
530 currentColor, sizeof(currentColor) / sizeof(WCHAR),
531 currentSize, sizeof(currentSize) / sizeof(WCHAR));
532 if (bThemeActive)
533 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
534 else
535 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
536 }
537
538 static void test_CloseThemeData(void)
539 {
540 HRESULT hRes;
541
542 hRes = pCloseThemeData(NULL);
543 ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
544 }
545
546 START_TEST(system)
547 {
548 if(!InitFunctionPtrs())
549 return;
550
551 /* No real functional tests will be done (yet). The current tests
552 * only show input/return behaviour
553 */
554
555 /* IsThemeActive, IsAppThemed and IsThemePartDefined*/
556 trace("Starting test_IsThemed()\n");
557 test_IsThemed();
558
559 /* GetWindowTheme */
560 trace("Starting test_GetWindowTheme()\n");
561 test_GetWindowTheme();
562
563 /* SetWindowTheme */
564 trace("Starting test_SetWindowTheme()\n");
565 test_SetWindowTheme();
566
567 /* OpenThemeData, a bit more functional now */
568 trace("Starting test_OpenThemeData()\n");
569 test_OpenThemeData();
570
571 /* OpenThemeDataEx */
572 trace("Starting test_OpenThemeDataEx()\n");
573 test_OpenThemeDataEx();
574
575 /* GetCurrentThemeName */
576 trace("Starting test_GetCurrentThemeName()\n");
577 test_GetCurrentThemeName();
578
579 /* CloseThemeData */
580 trace("Starting test_CloseThemeData()\n");
581 test_CloseThemeData();
582
583 FreeLibrary(hUxtheme);
584 }