d3d8/tests: Use a separate device for alpha_test().
[wine.git] / dlls / uxtheme / tests / system.c
blob303ff8d9ada46327fe3cdee29f299e44ef275c7c
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 bThemeActive = pIsThemeActive();
85 trace("Theming is %s\n", (bThemeActive) ? "active" : "inactive");
87 bAppThemed = pIsAppThemed();
88 trace("Test executable is %s\n", (bAppThemed) ? "themed" : "not themed");
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());
98 static void test_GetWindowTheme(void)
100 HTHEME hTheme;
101 HWND hWnd;
102 BOOL bDestroyed;
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());
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;
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());
123 bDestroyed = DestroyWindow(hWnd);
124 if (!bDestroyed)
125 trace("Window %p couldn't be destroyed : 0x%08x\n",
126 hWnd, GetLastError());
129 static void test_SetWindowTheme(void)
131 HRESULT hRes;
132 HWND hWnd;
133 BOOL bDestroyed;
135 SetLastError(0xdeadbeef);
136 hRes = pSetWindowTheme(NULL, NULL, NULL);
137 todo_wine
139 ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
140 ok( GetLastError() == 0xdeadbeef,
141 "Expected 0xdeadbeef, got 0x%08x\n",
142 GetLastError());
145 /* Only do the bare minimum to get a valid hwnd */
146 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
147 if (!hWnd) return;
149 SetLastError(0xdeadbeef);
150 hRes = pSetWindowTheme(hWnd, NULL, NULL);
151 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
152 ok( GetLastError() == 0xdeadbeef,
153 "Expected 0xdeadbeef, got 0x%08x\n",
154 GetLastError());
156 bDestroyed = DestroyWindow(hWnd);
157 if (!bDestroyed)
158 trace("Window %p couldn't be destroyed : 0x%08x\n",
159 hWnd, GetLastError());
162 static void test_OpenThemeData(void)
164 HTHEME hTheme, hTheme2;
165 HWND hWnd;
166 BOOL bThemeActive;
167 HRESULT hRes;
168 BOOL bDestroyed;
169 BOOL bTPDefined;
171 WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
172 WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
173 WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
174 WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
176 bThemeActive = pIsThemeActive();
178 /* All NULL */
179 SetLastError(0xdeadbeef);
180 hTheme = pOpenThemeData(NULL, NULL);
181 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
182 ok( GetLastError() == E_POINTER,
183 "Expected GLE() to be E_POINTER, got 0x%08x\n",
184 GetLastError());
186 /* A NULL hWnd and an invalid classlist */
187 SetLastError(0xdeadbeef);
188 hTheme = pOpenThemeData(NULL, szInvalidClassList);
189 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
190 todo_wine
191 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
192 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
193 GetLastError());
195 SetLastError(0xdeadbeef);
196 hTheme = pOpenThemeData(NULL, szClassList);
197 if (bThemeActive)
199 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
200 todo_wine
201 ok( GetLastError() == ERROR_SUCCESS,
202 "Expected ERROR_SUCCESS, got 0x%08x\n",
203 GetLastError());
205 else
207 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
208 todo_wine
209 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
210 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
211 GetLastError());
214 /* Only do the bare minimum to get a valid hdc */
215 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
216 if (!hWnd) return;
218 SetLastError(0xdeadbeef);
219 hTheme = pOpenThemeData(hWnd, NULL);
220 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
221 ok( GetLastError() == E_POINTER,
222 "Expected GLE() to be E_POINTER, got 0x%08x\n",
223 GetLastError());
225 SetLastError(0xdeadbeef);
226 hTheme = pOpenThemeData(hWnd, szInvalidClassList);
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());
233 if (!bThemeActive)
235 SetLastError(0xdeadbeef);
236 hTheme = pOpenThemeData(hWnd, szButtonClassList);
237 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
238 todo_wine
239 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
240 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
241 GetLastError());
242 skip("No active theme, skipping rest of OpenThemeData tests\n");
243 return;
246 /* Only do the next checks if we have an active theme */
248 SetLastError(0xdeadbeef);
249 hTheme = pOpenThemeData(hWnd, szButtonClassList);
250 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
251 todo_wine
252 ok( GetLastError() == ERROR_SUCCESS,
253 "Expected ERROR_SUCCESS, got 0x%08x\n",
254 GetLastError());
256 /* Test with bUtToN instead of Button */
257 SetLastError(0xdeadbeef);
258 hTheme = pOpenThemeData(hWnd, szButtonClassList2);
259 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
260 todo_wine
261 ok( GetLastError() == ERROR_SUCCESS,
262 "Expected ERROR_SUCCESS, got 0x%08x\n",
263 GetLastError());
265 SetLastError(0xdeadbeef);
266 hTheme = pOpenThemeData(hWnd, szClassList);
267 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
268 todo_wine
269 ok( GetLastError() == ERROR_SUCCESS,
270 "Expected ERROR_SUCCESS, got 0x%08x\n",
271 GetLastError());
273 /* GetWindowTheme should return the last handle opened by OpenThemeData */
274 SetLastError(0xdeadbeef);
275 hTheme2 = pGetWindowTheme(hWnd);
276 ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
277 hTheme, hTheme2);
278 ok( GetLastError() == 0xdeadbeef,
279 "Expected 0xdeadbeef, got 0x%08x\n",
280 GetLastError());
282 SetLastError(0xdeadbeef);
283 hRes = pCloseThemeData(hTheme);
284 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
285 ok( GetLastError() == 0xdeadbeef,
286 "Expected 0xdeadbeef, got 0x%08x\n",
287 GetLastError());
289 /* Close a second time */
290 SetLastError(0xdeadbeef);
291 hRes = pCloseThemeData(hTheme);
292 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
293 ok( GetLastError() == 0xdeadbeef,
294 "Expected 0xdeadbeef, got 0x%08x\n",
295 GetLastError());
297 /* See if closing makes a difference for GetWindowTheme */
298 SetLastError(0xdeadbeef);
299 hTheme2 = NULL;
300 hTheme2 = pGetWindowTheme(hWnd);
301 ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
302 hTheme, hTheme2);
303 ok( GetLastError() == 0xdeadbeef,
304 "Expected 0xdeadbeef, got 0x%08x\n",
305 GetLastError());
307 SetLastError(0xdeadbeef);
308 bTPDefined = pIsThemePartDefined(hTheme, 0 , 0);
309 todo_wine
311 ok( bTPDefined == FALSE, "Expected FALSE\n");
312 ok( GetLastError() == ERROR_SUCCESS,
313 "Expected ERROR_SUCCESS, got 0x%08x\n",
314 GetLastError());
317 bDestroyed = DestroyWindow(hWnd);
318 if (!bDestroyed)
319 trace("Window %p couldn't be destroyed : 0x%08x\n",
320 hWnd, GetLastError());
323 static void test_OpenThemeDataEx(void)
325 HTHEME hTheme;
326 HWND hWnd;
327 BOOL bThemeActive;
328 BOOL bDestroyed;
330 WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
331 WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
332 WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
333 WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
335 if (!pOpenThemeDataEx)
337 win_skip("OpenThemeDataEx not available\n");
338 return;
341 bThemeActive = pIsThemeActive();
343 /* All NULL */
344 SetLastError(0xdeadbeef);
345 hTheme = pOpenThemeDataEx(NULL, NULL, 0);
346 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
347 ok( GetLastError() == E_POINTER,
348 "Expected GLE() to be E_POINTER, got 0x%08x\n",
349 GetLastError());
351 /* A NULL hWnd and an invalid classlist without flags */
352 SetLastError(0xdeadbeef);
353 hTheme = pOpenThemeDataEx(NULL, szInvalidClassList, 0);
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());
360 SetLastError(0xdeadbeef);
361 hTheme = pOpenThemeDataEx(NULL, szClassList, 0);
362 if (bThemeActive)
364 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
365 todo_wine
366 ok( GetLastError() == ERROR_SUCCESS,
367 "Expected ERROR_SUCCESS, got 0x%08x\n",
368 GetLastError());
370 else
372 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
373 todo_wine
374 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
375 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
376 GetLastError());
379 /* Only do the bare minimum to get a valid hdc */
380 hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
381 if (!hWnd) return;
383 SetLastError(0xdeadbeef);
384 hTheme = pOpenThemeDataEx(hWnd, NULL, 0);
385 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
386 ok( GetLastError() == E_POINTER,
387 "Expected GLE() to be E_POINTER, got 0x%08x\n",
388 GetLastError());
390 SetLastError(0xdeadbeef);
391 hTheme = pOpenThemeDataEx(hWnd, szInvalidClassList, 0);
392 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
393 todo_wine
394 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
395 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
396 GetLastError());
398 if (!bThemeActive)
400 SetLastError(0xdeadbeef);
401 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
402 ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
403 todo_wine
404 ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
405 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
406 GetLastError());
407 skip("No active theme, skipping rest of OpenThemeDataEx tests\n");
408 return;
411 /* Only do the next checks if we have an active theme */
413 SetLastError(0xdeadbeef);
414 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
415 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
416 todo_wine
417 ok( GetLastError() == ERROR_SUCCESS,
418 "Expected ERROR_SUCCESS, got 0x%08x\n",
419 GetLastError());
421 SetLastError(0xdeadbeef);
422 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_FORCE_RECT_SIZING);
423 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
424 todo_wine
425 ok( GetLastError() == ERROR_SUCCESS,
426 "Expected ERROR_SUCCESS, got 0x%08x\n",
427 GetLastError());
429 SetLastError(0xdeadbeef);
430 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_NONCLIENT);
431 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
432 todo_wine
433 ok( GetLastError() == ERROR_SUCCESS,
434 "Expected ERROR_SUCCESS, got 0x%08x\n",
435 GetLastError());
437 SetLastError(0xdeadbeef);
438 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0x3);
439 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
440 todo_wine
441 ok( GetLastError() == ERROR_SUCCESS,
442 "Expected ERROR_SUCCESS, got 0x%08x\n",
443 GetLastError());
445 /* Test with bUtToN instead of Button */
446 SetLastError(0xdeadbeef);
447 hTheme = pOpenThemeDataEx(hWnd, szButtonClassList2, 0);
448 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
449 todo_wine
450 ok( GetLastError() == ERROR_SUCCESS,
451 "Expected ERROR_SUCCESS, got 0x%08x\n",
452 GetLastError());
454 SetLastError(0xdeadbeef);
455 hTheme = pOpenThemeDataEx(hWnd, szClassList, 0);
456 ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
457 todo_wine
458 ok( GetLastError() == ERROR_SUCCESS,
459 "Expected ERROR_SUCCESS, got 0x%08x\n",
460 GetLastError());
462 bDestroyed = DestroyWindow(hWnd);
463 if (!bDestroyed)
464 trace("Window %p couldn't be destroyed : 0x%08x\n",
465 hWnd, GetLastError());
468 static void test_GetCurrentThemeName(void)
470 BOOL bThemeActive;
471 HRESULT hRes;
472 WCHAR currentTheme[MAX_PATH];
473 WCHAR currentColor[MAX_PATH];
474 WCHAR currentSize[MAX_PATH];
476 bThemeActive = pIsThemeActive();
478 /* All NULLs */
479 SetLastError(0xdeadbeef);
480 hRes = pGetCurrentThemeName(NULL, 0, NULL, 0, NULL, 0);
481 if (bThemeActive)
482 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
483 else
484 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
485 ok( GetLastError() == 0xdeadbeef,
486 "Expected 0xdeadbeef, got 0x%08x\n",
487 GetLastError());
489 /* Number of characters given is 0 */
490 SetLastError(0xdeadbeef);
491 hRes = pGetCurrentThemeName(currentTheme, 0, NULL, 0, NULL, 0);
492 if (bThemeActive)
493 ok( hRes == S_OK || broken(hRes == E_FAIL /* WinXP SP1 */), "Expected S_OK, got 0x%08x\n", hRes);
494 else
495 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
496 ok( GetLastError() == 0xdeadbeef,
497 "Expected 0xdeadbeef, got 0x%08x\n",
498 GetLastError());
500 SetLastError(0xdeadbeef);
501 hRes = pGetCurrentThemeName(currentTheme, 2, NULL, 0, NULL, 0);
502 if (bThemeActive)
503 todo_wine
504 ok(hRes == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) ||
505 broken(hRes == E_FAIL /* WinXP SP1 */),
506 "Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), 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 /* The same is true if the number of characters is too small for Color and/or Size */
514 SetLastError(0xdeadbeef);
515 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
516 currentColor, 2,
517 currentSize, sizeof(currentSize) / sizeof(WCHAR));
518 if (bThemeActive)
519 todo_wine
520 ok(hRes == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) ||
521 broken(hRes == E_FAIL /* WinXP SP1 */),
522 "Expected HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), got 0x%08x\n", hRes);
523 else
524 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
525 ok( GetLastError() == 0xdeadbeef,
526 "Expected 0xdeadbeef, got 0x%08x\n",
527 GetLastError());
529 /* Given number of characters is correct */
530 SetLastError(0xdeadbeef);
531 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR), NULL, 0, NULL, 0);
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 ok( GetLastError() == 0xdeadbeef,
537 "Expected 0xdeadbeef, got 0x%08x\n",
538 GetLastError());
540 /* Given number of characters for the theme name is too large */
541 SetLastError(0xdeadbeef);
542 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme), NULL, 0, NULL, 0);
543 if (bThemeActive)
544 ok( hRes == E_POINTER || hRes == S_OK, "Expected E_POINTER or S_OK, got 0x%08x\n", hRes);
545 else
546 ok( hRes == E_PROP_ID_UNSUPPORTED ||
547 hRes == E_POINTER, /* win2k3 */
548 "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
549 ok( GetLastError() == 0xdeadbeef,
550 "Expected 0xdeadbeef, got 0x%08x\n",
551 GetLastError());
553 /* The too large case is only for the theme name, not for color name or size name */
554 SetLastError(0xdeadbeef);
555 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
556 currentColor, sizeof(currentTheme),
557 currentSize, sizeof(currentSize) / sizeof(WCHAR));
558 if (bThemeActive)
559 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
560 else
561 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
562 ok( GetLastError() == 0xdeadbeef,
563 "Expected 0xdeadbeef, got 0x%08x\n",
564 GetLastError());
566 SetLastError(0xdeadbeef);
567 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
568 currentColor, sizeof(currentTheme) / sizeof(WCHAR),
569 currentSize, sizeof(currentSize));
570 if (bThemeActive)
571 ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
572 else
573 ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
574 ok( GetLastError() == 0xdeadbeef,
575 "Expected 0xdeadbeef, got 0x%08x\n",
576 GetLastError());
578 /* Correct call */
579 SetLastError(0xdeadbeef);
580 hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
581 currentColor, sizeof(currentColor) / sizeof(WCHAR),
582 currentSize, sizeof(currentSize) / sizeof(WCHAR));
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());
592 static void test_CloseThemeData(void)
594 HRESULT hRes;
596 SetLastError(0xdeadbeef);
597 hRes = pCloseThemeData(NULL);
598 ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
599 ok( GetLastError() == 0xdeadbeef,
600 "Expected 0xdeadbeef, got 0x%08x\n",
601 GetLastError());
604 START_TEST(system)
606 if(!InitFunctionPtrs())
607 return;
609 /* No real functional tests will be done (yet). The current tests
610 * only show input/return behaviour
613 /* IsThemeActive, IsAppThemed and IsThemePartDefined*/
614 trace("Starting test_IsThemed()\n");
615 test_IsThemed();
617 /* GetWindowTheme */
618 trace("Starting test_GetWindowTheme()\n");
619 test_GetWindowTheme();
621 /* SetWindowTheme */
622 trace("Starting test_SetWindowTheme()\n");
623 test_SetWindowTheme();
625 /* OpenThemeData, a bit more functional now */
626 trace("Starting test_OpenThemeData()\n");
627 test_OpenThemeData();
629 /* OpenThemeDataEx */
630 trace("Starting test_OpenThemeDataEx()\n");
631 test_OpenThemeDataEx();
633 /* GetCurrentThemeName */
634 trace("Starting test_GetCurrentThemeName()\n");
635 test_GetCurrentThemeName();
637 /* CloseThemeData */
638 trace("Starting test_CloseThemeData()\n");
639 test_CloseThemeData();
641 FreeLibrary(hUxtheme);