msxml3: Properly escape character data in text nodes.
[wine/multimedia.git] / dlls / uxtheme / tests / system.c
blob8dd413b9a7f71b7461af5dbb287acd6d8216b42c
1 /* Unit test suite for uxtheme API functions
3 * Copyright 2006 Paul Vriens
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.
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.
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
21 #include <stdarg.h>
23 #include "windows.h"
24 #include "vfwmsgs.h"
25 #include "uxtheme.h"
27 #include "wine/test.h"
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);
39 static HMODULE hUxtheme = 0;
41 #define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func);
43 static BOOL InitFunctionPtrs(void)
45 hUxtheme = LoadLibraryA("uxtheme.dll");
46 if(!hUxtheme) {
47 trace("Could not load uxtheme.dll\n");
48 return FALSE;
50 if (hUxtheme)
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)
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.
66 if (!pCloseThemeData || !pGetCurrentThemeName ||
67 !pGetWindowTheme || !pIsAppThemed ||
68 !pIsThemeActive || !pIsThemePartDefined ||
69 !pOpenThemeData || !pSetWindowTheme)
71 FreeLibrary(hUxtheme);
72 return FALSE;
75 return TRUE;
78 static void test_IsThemed(void)
80 BOOL bThemeActive;
81 BOOL bAppThemed;
82 BOOL bTPDefined;
84 SetLastError(0xdeadbeef);
85 bThemeActive = pIsThemeActive();
86 trace("Theming is %s\n", (bThemeActive) ? "active" : "inactive");
88 /* This test is not themed */
89 SetLastError(0xdeadbeef);
90 bAppThemed = pIsAppThemed();
92 if (bThemeActive)
93 todo_wine
94 ok( bAppThemed == FALSE, "Expected FALSE as this test executable is not (yet) themed.\n");
95 else
96 /* Although Wine currently returns FALSE, the logic behind it is wrong. It is not a todo_wine though in the testing sense */
97 ok( bAppThemed == FALSE, "Expected FALSE as this test executable is not (yet) themed.\n");
99 ok( GetLastError() == ERROR_SUCCESS,
100 "Expected ERROR_SUCCESS, got 0x%08x\n",
101 GetLastError());
103 SetLastError(0xdeadbeef);
104 bTPDefined = pIsThemePartDefined(NULL, 0 , 0);
105 ok( bTPDefined == FALSE, "Expected FALSE\n");
106 ok( GetLastError() == E_HANDLE,
107 "Expected E_HANDLE, got 0x%08x\n",
108 GetLastError());
111 static void test_GetWindowTheme(void)
113 HTHEME hTheme;
114 HWND hWnd;
115 BOOL bDestroyed;
117 SetLastError(0xdeadbeef);
118 hTheme = pGetWindowTheme(NULL);
119 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
120 todo_wine
121 ok( GetLastError() == E_HANDLE,
122 "Expected E_HANDLE, got 0x%08x\n",
123 GetLastError());
125 /* Only do the bare minimum to get a valid hwnd */
126 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
127 if (!hWnd) return;
129 SetLastError(0xdeadbeef);
130 hTheme = pGetWindowTheme(hWnd);
131 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
132 ok( GetLastError() == 0xdeadbeef,
133 "Expected 0xdeadbeef, got 0x%08x\n",
134 GetLastError());
136 bDestroyed = DestroyWindow(hWnd);
137 if (!bDestroyed)
138 trace("Window %p couldn't be destroyed : 0x%08x\n",
139 hWnd, GetLastError());
142 static void test_SetWindowTheme(void)
144 HRESULT hRes;
145 HWND hWnd;
146 BOOL bDestroyed;
148 SetLastError(0xdeadbeef);
149 hRes = pSetWindowTheme(NULL, NULL, NULL);
150 todo_wine
152 ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
153 ok( GetLastError() == 0xdeadbeef,
154 "Expected 0xdeadbeef, got 0x%08x\n",
155 GetLastError());
158 /* Only do the bare minimum to get a valid hwnd */
159 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
160 if (!hWnd) return;
162 SetLastError(0xdeadbeef);
163 hRes = pSetWindowTheme(hWnd, NULL, NULL);
164 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
165 ok( GetLastError() == 0xdeadbeef,
166 "Expected 0xdeadbeef, got 0x%08x\n",
167 GetLastError());
169 bDestroyed = DestroyWindow(hWnd);
170 if (!bDestroyed)
171 trace("Window %p couldn't be destroyed : 0x%08x\n",
172 hWnd, GetLastError());
175 static void test_OpenThemeData(void)
177 HTHEME hTheme, hTheme2;
178 HWND hWnd;
179 BOOL bThemeActive;
180 HRESULT hRes;
181 BOOL bDestroyed;
182 BOOL bTPDefined;
184 WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
185 WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
186 WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
187 WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
189 bThemeActive = pIsThemeActive();
191 /* All NULL */
192 SetLastError(0xdeadbeef);
193 hTheme = pOpenThemeData(NULL, NULL);
194 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
195 ok( GetLastError() == E_POINTER,
196 "Expected GLE() to be E_POINTER, got 0x%08x\n",
197 GetLastError());
199 /* A NULL hWnd and an invalid classlist */
200 SetLastError(0xdeadbeef);
201 hTheme = pOpenThemeData(NULL, szInvalidClassList);
202 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
203 todo_wine
204 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
205 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
206 GetLastError());
208 SetLastError(0xdeadbeef);
209 hTheme = pOpenThemeData(NULL, szClassList);
210 if (bThemeActive)
212 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
213 todo_wine
214 ok( GetLastError() == ERROR_SUCCESS,
215 "Expected ERROR_SUCCESS, got 0x%08x\n",
216 GetLastError());
218 else
220 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
221 todo_wine
222 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
223 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
224 GetLastError());
227 /* Only do the bare minimum to get a valid hdc */
228 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
229 if (!hWnd) return;
231 SetLastError(0xdeadbeef);
232 hTheme = pOpenThemeData(hWnd, NULL);
233 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
234 ok( GetLastError() == E_POINTER,
235 "Expected GLE() to be E_POINTER, got 0x%08x\n",
236 GetLastError());
238 SetLastError(0xdeadbeef);
239 hTheme = pOpenThemeData(hWnd, szInvalidClassList);
240 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
241 todo_wine
242 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
243 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
244 GetLastError());
246 if (!bThemeActive)
248 SetLastError(0xdeadbeef);
249 hTheme = pOpenThemeData(hWnd, szButtonClassList);
250 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
251 todo_wine
252 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
253 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
254 GetLastError());
255 skip("No active theme, skipping rest of OpenThemeData tests\n");
256 return;
259 /* Only do the next checks if we have an active theme */
261 SetLastError(0xdeadbeef);
262 hTheme = pOpenThemeData(hWnd, szButtonClassList);
263 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
264 todo_wine
265 ok( GetLastError() == ERROR_SUCCESS,
266 "Expected ERROR_SUCCESS, got 0x%08x\n",
267 GetLastError());
269 /* Test with bUtToN instead of Button */
270 SetLastError(0xdeadbeef);
271 hTheme = pOpenThemeData(hWnd, szButtonClassList2);
272 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
273 todo_wine
274 ok( GetLastError() == ERROR_SUCCESS,
275 "Expected ERROR_SUCCESS, got 0x%08x\n",
276 GetLastError());
278 SetLastError(0xdeadbeef);
279 hTheme = pOpenThemeData(hWnd, szClassList);
280 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
281 todo_wine
282 ok( GetLastError() == ERROR_SUCCESS,
283 "Expected ERROR_SUCCESS, got 0x%08x\n",
284 GetLastError());
286 /* GetWindowTheme should return the last handle opened by OpenThemeData */
287 SetLastError(0xdeadbeef);
288 hTheme2 = pGetWindowTheme(hWnd);
289 ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
290 hTheme, hTheme2);
291 ok( GetLastError() == 0xdeadbeef,
292 "Expected 0xdeadbeef, got 0x%08x\n",
293 GetLastError());
295 SetLastError(0xdeadbeef);
296 hRes = pCloseThemeData(hTheme);
297 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
298 ok( GetLastError() == 0xdeadbeef,
299 "Expected 0xdeadbeef, got 0x%08x\n",
300 GetLastError());
302 /* Close a second time */
303 SetLastError(0xdeadbeef);
304 hRes = pCloseThemeData(hTheme);
305 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
306 ok( GetLastError() == 0xdeadbeef,
307 "Expected 0xdeadbeef, got 0x%08x\n",
308 GetLastError());
310 /* See if closing makes a difference for GetWindowTheme */
311 SetLastError(0xdeadbeef);
312 hTheme2 = NULL;
313 hTheme2 = pGetWindowTheme(hWnd);
314 ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
315 hTheme, hTheme2);
316 ok( GetLastError() == 0xdeadbeef,
317 "Expected 0xdeadbeef, got 0x%08x\n",
318 GetLastError());
320 SetLastError(0xdeadbeef);
321 bTPDefined = pIsThemePartDefined(hTheme, 0 , 0);
322 todo_wine
324 ok( bTPDefined == FALSE, "Expected FALSE\n");
325 ok( GetLastError() == ERROR_SUCCESS,
326 "Expected ERROR_SUCCESS, got 0x%08x\n",
327 GetLastError());
330 bDestroyed = DestroyWindow(hWnd);
331 if (!bDestroyed)
332 trace("Window %p couldn't be destroyed : 0x%08x\n",
333 hWnd, GetLastError());
336 static void test_OpenThemeDataEx(void)
338 HTHEME hTheme;
339 HWND hWnd;
340 BOOL bThemeActive;
341 BOOL bDestroyed;
343 WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
344 WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
345 WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
346 WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
348 if (!pOpenThemeDataEx)
350 win_skip("OpenThemeDataEx not available\n");
351 return;
354 bThemeActive = pIsThemeActive();
356 /* All NULL */
357 SetLastError(0xdeadbeef);
358 hTheme = pOpenThemeDataEx(NULL, NULL, 0);
359 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
360 ok( GetLastError() == E_POINTER,
361 "Expected GLE() to be E_POINTER, got 0x%08x\n",
362 GetLastError());
364 /* A NULL hWnd and an invalid classlist without flags */
365 SetLastError(0xdeadbeef);
366 hTheme = pOpenThemeDataEx(NULL, szInvalidClassList, 0);
367 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
368 todo_wine
369 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
370 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
371 GetLastError());
373 SetLastError(0xdeadbeef);
374 hTheme = pOpenThemeDataEx(NULL, szClassList, 0);
375 if (bThemeActive)
377 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
378 todo_wine
379 ok( GetLastError() == ERROR_SUCCESS,
380 "Expected ERROR_SUCCESS, got 0x%08x\n",
381 GetLastError());
383 else
385 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
386 todo_wine
387 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
388 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
389 GetLastError());
392 /* Only do the bare minimum to get a valid hdc */
393 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
394 if (!hWnd) return;
396 SetLastError(0xdeadbeef);
397 hTheme = pOpenThemeDataEx(hWnd, NULL, 0);
398 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
399 ok( GetLastError() == E_POINTER,
400 "Expected GLE() to be E_POINTER, got 0x%08x\n",
401 GetLastError());
403 SetLastError(0xdeadbeef);
404 hTheme = pOpenThemeDataEx(hWnd, szInvalidClassList, 0);
405 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
406 todo_wine
407 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
408 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
409 GetLastError());
411 if (!bThemeActive)
413 SetLastError(0xdeadbeef);
414 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
415 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
416 todo_wine
417 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
418 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
419 GetLastError());
420 skip("No active theme, skipping rest of OpenThemeDataEx tests\n");
421 return;
424 /* Only do the next checks if we have an active theme */
426 SetLastError(0xdeadbeef);
427 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
428 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
429 todo_wine
430 ok( GetLastError() == ERROR_SUCCESS,
431 "Expected ERROR_SUCCESS, got 0x%08x\n",
432 GetLastError());
434 SetLastError(0xdeadbeef);
435 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_FORCE_RECT_SIZING);
436 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
437 todo_wine
438 ok( GetLastError() == ERROR_SUCCESS,
439 "Expected ERROR_SUCCESS, got 0x%08x\n",
440 GetLastError());
442 SetLastError(0xdeadbeef);
443 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_NONCLIENT);
444 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
445 todo_wine
446 ok( GetLastError() == ERROR_SUCCESS,
447 "Expected ERROR_SUCCESS, got 0x%08x\n",
448 GetLastError());
450 SetLastError(0xdeadbeef);
451 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0x3);
452 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
453 todo_wine
454 ok( GetLastError() == ERROR_SUCCESS,
455 "Expected ERROR_SUCCESS, got 0x%08x\n",
456 GetLastError());
458 /* Test with bUtToN instead of Button */
459 SetLastError(0xdeadbeef);
460 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList2, 0);
461 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
462 todo_wine
463 ok( GetLastError() == ERROR_SUCCESS,
464 "Expected ERROR_SUCCESS, got 0x%08x\n",
465 GetLastError());
467 SetLastError(0xdeadbeef);
468 hTheme = pOpenThemeDataEx(hWnd, szClassList, 0);
469 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
470 todo_wine
471 ok( GetLastError() == ERROR_SUCCESS,
472 "Expected ERROR_SUCCESS, got 0x%08x\n",
473 GetLastError());
475 bDestroyed = DestroyWindow(hWnd);
476 if (!bDestroyed)
477 trace("Window %p couldn't be destroyed : 0x%08x\n",
478 hWnd, GetLastError());
481 static void test_GetCurrentThemeName(void)
483 BOOL bThemeActive;
484 HRESULT hRes;
485 WCHAR currentTheme[MAX_PATH];
486 WCHAR currentColor[MAX_PATH];
487 WCHAR currentSize[MAX_PATH];
489 bThemeActive = pIsThemeActive();
491 /* All NULLs */
492 SetLastError(0xdeadbeef);
493 hRes = pGetCurrentThemeName(NULL, 0, NULL, 0, NULL, 0);
494 if (bThemeActive)
495 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
496 else
497 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
498 ok( GetLastError() == 0xdeadbeef,
499 "Expected 0xdeadbeef, got 0x%08x\n",
500 GetLastError());
502 /* Number of characters given is 0 */
503 SetLastError(0xdeadbeef);
504 hRes = pGetCurrentThemeName(currentTheme, 0, NULL, 0, NULL, 0);
505 if (bThemeActive)
506 ok( hRes == S_OK || broken(hRes == E_FAIL /* WinXP SP1 */), "Expected S_OK, got 0x%08x\n", hRes);
507 else
508 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
509 ok( GetLastError() == 0xdeadbeef,
510 "Expected 0xdeadbeef, got 0x%08x\n",
511 GetLastError());
513 SetLastError(0xdeadbeef);
514 hRes = pGetCurrentThemeName(currentTheme, 2, NULL, 0, NULL, 0);
515 if (bThemeActive)
516 todo_wine
517 ok(hRes == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) ||
518 broken(hRes == E_FAIL /* WinXP SP1 */),
519 "Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got 0x%08x\n", hRes);
520 else
521 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
522 ok( GetLastError() == 0xdeadbeef,
523 "Expected 0xdeadbeef, got 0x%08x\n",
524 GetLastError());
526 /* The same is true if the number of characters is too small for Color and/or Size */
527 SetLastError(0xdeadbeef);
528 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
529 currentColor, 2,
530 currentSize, sizeof(currentSize) / sizeof(WCHAR));
531 if (bThemeActive)
532 todo_wine
533 ok(hRes == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) ||
534 broken(hRes == E_FAIL /* WinXP SP1 */),
535 "Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got 0x%08x\n", hRes);
536 else
537 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
538 ok( GetLastError() == 0xdeadbeef,
539 "Expected 0xdeadbeef, got 0x%08x\n",
540 GetLastError());
542 /* Given number of characters is correct */
543 SetLastError(0xdeadbeef);
544 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR), NULL, 0, NULL, 0);
545 if (bThemeActive)
546 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
547 else
548 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
549 ok( GetLastError() == 0xdeadbeef,
550 "Expected 0xdeadbeef, got 0x%08x\n",
551 GetLastError());
553 /* Given number of characters for the theme name is too large */
554 SetLastError(0xdeadbeef);
555 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme), NULL, 0, NULL, 0);
556 if (bThemeActive)
557 ok( hRes == E_POINTER || hRes == S_OK, "Expected E_POINTER or S_OK, got 0x%08x\n", hRes);
558 else
559 ok( hRes == E_PROP_ID_UNSUPPORTED ||
560 hRes == E_POINTER, /* win2k3 */
561 "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
562 ok( GetLastError() == 0xdeadbeef,
563 "Expected 0xdeadbeef, got 0x%08x\n",
564 GetLastError());
566 /* The too large case is only for the theme name, not for color name or size name */
567 SetLastError(0xdeadbeef);
568 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
569 currentColor, sizeof(currentTheme),
570 currentSize, sizeof(currentSize) / sizeof(WCHAR));
571 if (bThemeActive)
572 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
573 else
574 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
575 ok( GetLastError() == 0xdeadbeef,
576 "Expected 0xdeadbeef, got 0x%08x\n",
577 GetLastError());
579 SetLastError(0xdeadbeef);
580 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
581 currentColor, sizeof(currentTheme) / sizeof(WCHAR),
582 currentSize, sizeof(currentSize));
583 if (bThemeActive)
584 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
585 else
586 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
587 ok( GetLastError() == 0xdeadbeef,
588 "Expected 0xdeadbeef, got 0x%08x\n",
589 GetLastError());
591 /* Correct call */
592 SetLastError(0xdeadbeef);
593 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
594 currentColor, sizeof(currentColor) / sizeof(WCHAR),
595 currentSize, sizeof(currentSize) / sizeof(WCHAR));
596 if (bThemeActive)
597 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
598 else
599 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
600 ok( GetLastError() == 0xdeadbeef,
601 "Expected 0xdeadbeef, got 0x%08x\n",
602 GetLastError());
605 static void test_CloseThemeData(void)
607 HRESULT hRes;
609 SetLastError(0xdeadbeef);
610 hRes = pCloseThemeData(NULL);
611 ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
612 ok( GetLastError() == 0xdeadbeef,
613 "Expected 0xdeadbeef, got 0x%08x\n",
614 GetLastError());
617 START_TEST(system)
619 if(!InitFunctionPtrs())
620 return;
622 /* No real functional tests will be done (yet). The current tests
623 * only show input/return behaviour
626 /* IsThemeActive, IsAppThemed and IsThemePartDefined*/
627 trace("Starting test_IsThemed()\n");
628 test_IsThemed();
630 /* GetWindowTheme */
631 trace("Starting test_GetWindowTheme()\n");
632 test_GetWindowTheme();
634 /* SetWindowTheme */
635 trace("Starting test_SetWindowTheme()\n");
636 test_SetWindowTheme();
638 /* OpenThemeData, a bit more functional now */
639 trace("Starting test_OpenThemeData()\n");
640 test_OpenThemeData();
642 /* OpenThemeDataEx */
643 trace("Starting test_OpenThemeDataEx()\n");
644 test_OpenThemeDataEx();
646 /* GetCurrentThemeName */
647 trace("Starting test_GetCurrentThemeName()\n");
648 test_GetCurrentThemeName();
650 /* CloseThemeData */
651 trace("Starting test_CloseThemeData()\n");
652 test_CloseThemeData();
654 FreeLibrary(hUxtheme);