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
27 #include "wine/test.h"
29 static HTHEME (WINAPI
* pOpenThemeDataEx
)(HWND
, LPCWSTR
, DWORD
);
30 static HPAINTBUFFER (WINAPI
*pBeginBufferedPaint
)(HDC
, const RECT
*, BP_BUFFERFORMAT
, BP_PAINTPARAMS
*, HDC
*);
31 static HRESULT (WINAPI
*pBufferedPaintClear
)(HPAINTBUFFER
, const RECT
*);
32 static HRESULT (WINAPI
*pEndBufferedPaint
)(HPAINTBUFFER
, BOOL
);
33 static HRESULT (WINAPI
*pGetBufferedPaintBits
)(HPAINTBUFFER
, RGBQUAD
**, int *);
34 static HDC (WINAPI
*pGetBufferedPaintDC
)(HPAINTBUFFER
);
35 static HDC (WINAPI
*pGetBufferedPaintTargetDC
)(HPAINTBUFFER
);
36 static HRESULT (WINAPI
*pGetBufferedPaintTargetRect
)(HPAINTBUFFER
, RECT
*);
38 static void init_funcs(void)
40 HMODULE hUxtheme
= GetModuleHandleA("uxtheme.dll");
42 #define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func)
43 UXTHEME_GET_PROC(BeginBufferedPaint
);
44 UXTHEME_GET_PROC(BufferedPaintClear
);
45 UXTHEME_GET_PROC(EndBufferedPaint
);
46 UXTHEME_GET_PROC(GetBufferedPaintBits
);
47 UXTHEME_GET_PROC(GetBufferedPaintDC
);
48 UXTHEME_GET_PROC(GetBufferedPaintTargetDC
);
49 UXTHEME_GET_PROC(GetBufferedPaintTargetRect
);
50 UXTHEME_GET_PROC(BufferedPaintClear
);
52 UXTHEME_GET_PROC(OpenThemeDataEx
);
53 #undef UXTHEME_GET_PROC
56 static void test_IsThemed(void)
62 bThemeActive
= IsThemeActive();
63 trace("Theming is %s\n", (bThemeActive
) ? "active" : "inactive");
65 bAppThemed
= IsAppThemed();
66 trace("Test executable is %s\n", (bAppThemed
) ? "themed" : "not themed");
68 SetLastError(0xdeadbeef);
69 bTPDefined
= IsThemePartDefined(NULL
, 0 , 0);
70 ok( bTPDefined
== FALSE
, "Expected FALSE\n");
71 ok( GetLastError() == E_HANDLE
,
72 "Expected E_HANDLE, got 0x%08x\n",
76 static void test_GetWindowTheme(void)
82 SetLastError(0xdeadbeef);
83 hTheme
= GetWindowTheme(NULL
);
84 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
86 ok( GetLastError() == E_HANDLE
,
87 "Expected E_HANDLE, got 0x%08x\n",
90 /* Only do the bare minimum to get a valid hwnd */
91 hWnd
= CreateWindowExA(0, "static", "", WS_POPUP
, 0,0,100,100,0, 0, 0, NULL
);
94 SetLastError(0xdeadbeef);
95 hTheme
= GetWindowTheme(hWnd
);
96 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
97 ok( GetLastError() == 0xdeadbeef,
98 "Expected 0xdeadbeef, got 0x%08x\n",
101 bDestroyed
= DestroyWindow(hWnd
);
103 trace("Window %p couldn't be destroyed : 0x%08x\n",
104 hWnd
, GetLastError());
107 static void test_SetWindowTheme(void)
113 hRes
= SetWindowTheme(NULL
, NULL
, NULL
);
115 ok( hRes
== E_HANDLE
, "Expected E_HANDLE, got 0x%08x\n", hRes
);
117 /* Only do the bare minimum to get a valid hwnd */
118 hWnd
= CreateWindowExA(0, "static", "", WS_POPUP
, 0,0,100,100,0, 0, 0, NULL
);
121 hRes
= SetWindowTheme(hWnd
, NULL
, NULL
);
122 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
124 bDestroyed
= DestroyWindow(hWnd
);
126 trace("Window %p couldn't be destroyed : 0x%08x\n",
127 hWnd
, GetLastError());
130 static void test_OpenThemeData(void)
132 HTHEME hTheme
, hTheme2
;
139 WCHAR szInvalidClassList
[] = {'D','E','A','D','B','E','E','F', 0 };
140 WCHAR szButtonClassList
[] = {'B','u','t','t','o','n', 0 };
141 WCHAR szButtonClassList2
[] = {'b','U','t','T','o','N', 0 };
142 WCHAR szClassList
[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
144 bThemeActive
= IsThemeActive();
147 SetLastError(0xdeadbeef);
148 hTheme
= OpenThemeData(NULL
, NULL
);
149 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
150 ok( GetLastError() == E_POINTER
,
151 "Expected GLE() to be E_POINTER, got 0x%08x\n",
154 /* A NULL hWnd and an invalid classlist */
155 SetLastError(0xdeadbeef);
156 hTheme
= OpenThemeData(NULL
, szInvalidClassList
);
157 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
159 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
160 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
163 SetLastError(0xdeadbeef);
164 hTheme
= OpenThemeData(NULL
, szClassList
);
167 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
169 ok( GetLastError() == ERROR_SUCCESS
,
170 "Expected ERROR_SUCCESS, got 0x%08x\n",
175 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
177 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
178 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
182 /* Only do the bare minimum to get a valid hdc */
183 hWnd
= CreateWindowExA(0, "static", "", WS_POPUP
, 0,0,100,100,0, 0, 0, NULL
);
186 SetLastError(0xdeadbeef);
187 hTheme
= OpenThemeData(hWnd
, NULL
);
188 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
189 ok( GetLastError() == E_POINTER
,
190 "Expected GLE() to be E_POINTER, got 0x%08x\n",
193 SetLastError(0xdeadbeef);
194 hTheme
= OpenThemeData(hWnd
, szInvalidClassList
);
195 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
197 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
198 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
201 /* Close invalid handle */
202 hRes
= CloseThemeData((HTHEME
)0xdeadbeef);
203 ok( hRes
== E_HANDLE
, "Expected E_HANDLE, got 0x%08x\n", hRes
);
207 SetLastError(0xdeadbeef);
208 hTheme
= OpenThemeData(hWnd
, szButtonClassList
);
209 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
211 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
212 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
214 skip("No active theme, skipping rest of OpenThemeData tests\n");
218 /* Only do the next checks if we have an active theme */
220 SetLastError(0xdeadbeef);
221 hTheme
= OpenThemeData(hWnd
, szButtonClassList
);
222 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
224 ok( GetLastError() == ERROR_SUCCESS
,
225 "Expected ERROR_SUCCESS, got 0x%08x\n",
228 /* Test with bUtToN instead of Button */
229 SetLastError(0xdeadbeef);
230 hTheme
= OpenThemeData(hWnd
, szButtonClassList2
);
231 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
233 ok( GetLastError() == ERROR_SUCCESS
,
234 "Expected ERROR_SUCCESS, got 0x%08x\n",
237 SetLastError(0xdeadbeef);
238 hTheme
= OpenThemeData(hWnd
, szClassList
);
239 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
241 ok( GetLastError() == ERROR_SUCCESS
,
242 "Expected ERROR_SUCCESS, got 0x%08x\n",
245 /* GetWindowTheme should return the last handle opened by OpenThemeData */
246 SetLastError(0xdeadbeef);
247 hTheme2
= GetWindowTheme(hWnd
);
248 ok( hTheme
== hTheme2
, "Expected the same HTHEME handle (%p<->%p)\n",
250 ok( GetLastError() == 0xdeadbeef,
251 "Expected 0xdeadbeef, got 0x%08x\n",
254 hRes
= CloseThemeData(hTheme
);
255 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
257 /* Close a second time */
258 hRes
= CloseThemeData(hTheme
);
259 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
261 /* See if closing makes a difference for GetWindowTheme */
262 SetLastError(0xdeadbeef);
264 hTheme2
= GetWindowTheme(hWnd
);
265 ok( hTheme
== hTheme2
, "Expected the same HTHEME handle (%p<->%p)\n",
267 ok( GetLastError() == 0xdeadbeef,
268 "Expected 0xdeadbeef, got 0x%08x\n",
271 SetLastError(0xdeadbeef);
272 bTPDefined
= IsThemePartDefined(hTheme
, 0 , 0);
275 ok( bTPDefined
== FALSE
, "Expected FALSE\n");
276 ok( GetLastError() == ERROR_SUCCESS
,
277 "Expected ERROR_SUCCESS, got 0x%08x\n",
281 bDestroyed
= DestroyWindow(hWnd
);
283 trace("Window %p couldn't be destroyed : 0x%08x\n",
284 hWnd
, GetLastError());
287 static void test_OpenThemeDataEx(void)
294 WCHAR szInvalidClassList
[] = {'D','E','A','D','B','E','E','F', 0 };
295 WCHAR szButtonClassList
[] = {'B','u','t','t','o','n', 0 };
296 WCHAR szButtonClassList2
[] = {'b','U','t','T','o','N', 0 };
297 WCHAR szClassList
[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
299 if (!pOpenThemeDataEx
)
301 win_skip("OpenThemeDataEx not available\n");
305 bThemeActive
= IsThemeActive();
308 SetLastError(0xdeadbeef);
309 hTheme
= pOpenThemeDataEx(NULL
, NULL
, 0);
310 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
311 ok( GetLastError() == E_POINTER
,
312 "Expected GLE() to be E_POINTER, got 0x%08x\n",
315 /* A NULL hWnd and an invalid classlist without flags */
316 SetLastError(0xdeadbeef);
317 hTheme
= pOpenThemeDataEx(NULL
, szInvalidClassList
, 0);
318 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
320 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
321 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
324 SetLastError(0xdeadbeef);
325 hTheme
= pOpenThemeDataEx(NULL
, szClassList
, 0);
328 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
330 ok( GetLastError() == ERROR_SUCCESS
,
331 "Expected ERROR_SUCCESS, got 0x%08x\n",
336 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
338 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
339 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
343 /* Only do the bare minimum to get a valid hdc */
344 hWnd
= CreateWindowExA(0, "static", "", WS_POPUP
, 0,0,100,100,0, 0, 0, NULL
);
347 SetLastError(0xdeadbeef);
348 hTheme
= pOpenThemeDataEx(hWnd
, NULL
, 0);
349 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
350 ok( GetLastError() == E_POINTER
,
351 "Expected GLE() to be E_POINTER, got 0x%08x\n",
354 SetLastError(0xdeadbeef);
355 hTheme
= pOpenThemeDataEx(hWnd
, szInvalidClassList
, 0);
356 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
358 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
359 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
364 SetLastError(0xdeadbeef);
365 hTheme
= pOpenThemeDataEx(hWnd
, szButtonClassList
, 0);
366 ok( hTheme
== NULL
, "Expected a NULL return, got %p\n", hTheme
);
368 ok( GetLastError() == E_PROP_ID_UNSUPPORTED
,
369 "Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
371 skip("No active theme, skipping rest of OpenThemeDataEx tests\n");
375 /* Only do the next checks if we have an active theme */
377 SetLastError(0xdeadbeef);
378 hTheme
= pOpenThemeDataEx(hWnd
, szButtonClassList
, 0);
379 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
381 ok( GetLastError() == ERROR_SUCCESS
,
382 "Expected ERROR_SUCCESS, got 0x%08x\n",
385 SetLastError(0xdeadbeef);
386 hTheme
= pOpenThemeDataEx(hWnd
, szButtonClassList
, OTD_FORCE_RECT_SIZING
);
387 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
389 ok( GetLastError() == ERROR_SUCCESS
,
390 "Expected ERROR_SUCCESS, got 0x%08x\n",
393 SetLastError(0xdeadbeef);
394 hTheme
= pOpenThemeDataEx(hWnd
, szButtonClassList
, OTD_NONCLIENT
);
395 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
397 ok( GetLastError() == ERROR_SUCCESS
,
398 "Expected ERROR_SUCCESS, got 0x%08x\n",
401 SetLastError(0xdeadbeef);
402 hTheme
= pOpenThemeDataEx(hWnd
, szButtonClassList
, 0x3);
403 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
405 ok( GetLastError() == ERROR_SUCCESS
,
406 "Expected ERROR_SUCCESS, got 0x%08x\n",
409 /* Test with bUtToN instead of Button */
410 SetLastError(0xdeadbeef);
411 hTheme
= pOpenThemeDataEx(hWnd
, szButtonClassList2
, 0);
412 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
414 ok( GetLastError() == ERROR_SUCCESS
,
415 "Expected ERROR_SUCCESS, got 0x%08x\n",
418 SetLastError(0xdeadbeef);
419 hTheme
= pOpenThemeDataEx(hWnd
, szClassList
, 0);
420 ok( hTheme
!= NULL
, "got NULL, expected a HTHEME handle\n");
422 ok( GetLastError() == ERROR_SUCCESS
,
423 "Expected ERROR_SUCCESS, got 0x%08x\n",
426 bDestroyed
= DestroyWindow(hWnd
);
428 trace("Window %p couldn't be destroyed : 0x%08x\n",
429 hWnd
, GetLastError());
432 static void test_GetCurrentThemeName(void)
436 WCHAR currentTheme
[MAX_PATH
];
437 WCHAR currentColor
[MAX_PATH
];
438 WCHAR currentSize
[MAX_PATH
];
440 bThemeActive
= IsThemeActive();
443 hRes
= GetCurrentThemeName(NULL
, 0, NULL
, 0, NULL
, 0);
445 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
447 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
449 /* Number of characters given is 0 */
450 hRes
= GetCurrentThemeName(currentTheme
, 0, NULL
, 0, NULL
, 0);
452 ok( hRes
== S_OK
|| broken(hRes
== E_FAIL
/* WinXP SP1 */), "Expected S_OK, got 0x%08x\n", hRes
);
454 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
456 hRes
= GetCurrentThemeName(currentTheme
, 2, NULL
, 0, NULL
, 0);
459 ok(hRes
== E_NOT_SUFFICIENT_BUFFER
||
460 broken(hRes
== E_FAIL
/* WinXP SP1 */),
461 "Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes
);
463 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
465 /* The same is true if the number of characters is too small for Color and/or Size */
466 hRes
= GetCurrentThemeName(currentTheme
, sizeof(currentTheme
) / sizeof(WCHAR
),
468 currentSize
, sizeof(currentSize
) / sizeof(WCHAR
));
471 ok(hRes
== E_NOT_SUFFICIENT_BUFFER
||
472 broken(hRes
== E_FAIL
/* WinXP SP1 */),
473 "Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes
);
475 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
477 /* Given number of characters is correct */
478 hRes
= GetCurrentThemeName(currentTheme
, sizeof(currentTheme
) / sizeof(WCHAR
), NULL
, 0, NULL
, 0);
480 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
482 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
484 /* Given number of characters for the theme name is too large */
485 hRes
= GetCurrentThemeName(currentTheme
, sizeof(currentTheme
), NULL
, 0, NULL
, 0);
487 ok( hRes
== E_POINTER
|| hRes
== S_OK
, "Expected E_POINTER or S_OK, got 0x%08x\n", hRes
);
489 ok( hRes
== E_PROP_ID_UNSUPPORTED
||
490 hRes
== E_POINTER
, /* win2k3 */
491 "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
493 /* The too large case is only for the theme name, not for color name or size name */
494 hRes
= GetCurrentThemeName(currentTheme
, sizeof(currentTheme
) / sizeof(WCHAR
),
495 currentColor
, sizeof(currentTheme
),
496 currentSize
, sizeof(currentSize
) / sizeof(WCHAR
));
498 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
500 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
502 hRes
= GetCurrentThemeName(currentTheme
, sizeof(currentTheme
) / sizeof(WCHAR
),
503 currentColor
, sizeof(currentTheme
) / sizeof(WCHAR
),
504 currentSize
, sizeof(currentSize
));
506 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
508 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
511 hRes
= GetCurrentThemeName(currentTheme
, sizeof(currentTheme
) / sizeof(WCHAR
),
512 currentColor
, sizeof(currentColor
) / sizeof(WCHAR
),
513 currentSize
, sizeof(currentSize
) / sizeof(WCHAR
));
515 ok( hRes
== S_OK
, "Expected S_OK, got 0x%08x\n", hRes
);
517 ok( hRes
== E_PROP_ID_UNSUPPORTED
, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes
);
520 static void test_CloseThemeData(void)
524 hRes
= CloseThemeData(NULL
);
525 ok( hRes
== E_HANDLE
, "Expected E_HANDLE, got 0x%08x\n", hRes
);
526 hRes
= CloseThemeData(INVALID_HANDLE_VALUE
);
527 ok( hRes
== E_HANDLE
, "Expected E_HANDLE, got 0x%08x\n", hRes
);
530 static void test_buffered_paint(void)
532 BP_PAINTPARAMS params
= { 0 };
533 BP_BUFFERFORMAT format
;
534 HDC target
, src
, hdc
;
541 if (!pBeginBufferedPaint
)
543 win_skip("Buffered painting API is not supported.\n");
547 buffer
= pBeginBufferedPaint(NULL
, NULL
, BPBF_COMPATIBLEBITMAP
,
549 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
551 target
= CreateCompatibleDC(0);
552 buffer
= pBeginBufferedPaint(target
, NULL
, BPBF_COMPATIBLEBITMAP
,
554 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
556 params
.cbSize
= sizeof(params
);
557 buffer
= pBeginBufferedPaint(target
, NULL
, BPBF_COMPATIBLEBITMAP
,
559 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
561 src
= (void *)0xdeadbeef;
562 buffer
= pBeginBufferedPaint(target
, NULL
, BPBF_COMPATIBLEBITMAP
,
564 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
565 ok(src
== NULL
, "Unexpected buffered dc %p\n", src
);
567 /* target rect is mandatory */
569 src
= (void *)0xdeadbeef;
570 buffer
= pBeginBufferedPaint(target
, &rect
, BPBF_COMPATIBLEBITMAP
,
572 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
573 ok(src
== NULL
, "Unexpected buffered dc %p\n", src
);
575 /* inverted rectangle */
576 SetRect(&rect
, 10, 0, 5, 5);
577 src
= (void *)0xdeadbeef;
578 buffer
= pBeginBufferedPaint(target
, &rect
, BPBF_COMPATIBLEBITMAP
,
580 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
581 ok(src
== NULL
, "Unexpected buffered dc %p\n", src
);
583 SetRect(&rect
, 0, 10, 5, 0);
584 src
= (void *)0xdeadbeef;
585 buffer
= pBeginBufferedPaint(target
, &rect
, BPBF_COMPATIBLEBITMAP
,
587 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
588 ok(src
== NULL
, "Unexpected buffered dc %p\n", src
);
590 /* valid rectangle, no target dc */
591 SetRect(&rect
, 0, 0, 5, 5);
592 src
= (void *)0xdeadbeef;
593 buffer
= pBeginBufferedPaint(NULL
, &rect
, BPBF_COMPATIBLEBITMAP
,
595 ok(buffer
== NULL
, "Unexpected buffer %p\n", buffer
);
596 ok(src
== NULL
, "Unexpected buffered dc %p\n", src
);
598 SetRect(&rect
, 0, 0, 5, 5);
600 buffer
= pBeginBufferedPaint(target
, &rect
, BPBF_COMPATIBLEBITMAP
,
602 ok(buffer
!= NULL
, "Unexpected buffer %p\n", buffer
);
603 ok(src
!= NULL
, "Expected buffered dc\n");
604 hr
= pEndBufferedPaint(buffer
, FALSE
);
605 ok(hr
== S_OK
, "Unexpected return code %#x\n", hr
);
607 SetRect(&rect
, 0, 0, 5, 5);
608 buffer
= pBeginBufferedPaint(target
, &rect
, BPBF_COMPATIBLEBITMAP
,
610 ok(buffer
!= NULL
, "Unexpected buffer %p\n", buffer
);
613 hr
= pBufferedPaintClear(NULL
, NULL
);
615 ok(hr
== E_FAIL
, "Unexpected return code %#x\n", hr
);
617 hr
= pBufferedPaintClear(buffer
, NULL
);
619 ok(hr
== S_OK
, "Unexpected return code %#x\n", hr
);
621 /* access buffer attributes */
622 hdc
= pGetBufferedPaintDC(buffer
);
623 ok(hdc
== src
, "Unexpected hdc, %p, buffered dc %p\n", hdc
, src
);
625 hdc
= pGetBufferedPaintTargetDC(buffer
);
626 ok(hdc
== target
, "Unexpected target hdc %p, original %p\n", hdc
, target
);
628 hr
= pGetBufferedPaintTargetRect(NULL
, NULL
);
629 ok(hr
== E_POINTER
, "Unexpected return code %#x\n", hr
);
631 hr
= pGetBufferedPaintTargetRect(buffer
, NULL
);
632 ok(hr
== E_POINTER
, "Unexpected return code %#x\n", hr
);
634 hr
= pGetBufferedPaintTargetRect(NULL
, &rect2
);
635 ok(hr
== E_FAIL
, "Unexpected return code %#x\n", hr
);
637 SetRectEmpty(&rect2
);
638 hr
= pGetBufferedPaintTargetRect(buffer
, &rect2
);
639 ok(hr
== S_OK
, "Unexpected return code %#x\n", hr
);
640 ok(EqualRect(&rect
, &rect2
), "Wrong target rect\n");
642 hr
= pEndBufferedPaint(buffer
, FALSE
);
643 ok(hr
== S_OK
, "Unexpected return code %#x\n", hr
);
645 /* invalid buffer handle */
646 hr
= pEndBufferedPaint(NULL
, FALSE
);
647 ok(hr
== E_INVALIDARG
, "Unexpected return code %#x\n", hr
);
649 hdc
= pGetBufferedPaintDC(NULL
);
650 ok(hdc
== NULL
, "Unexpected hdc %p\n", hdc
);
652 hdc
= pGetBufferedPaintTargetDC(NULL
);
653 ok(hdc
== NULL
, "Unexpected target hdc %p\n", hdc
);
655 hr
= pGetBufferedPaintTargetRect(NULL
, &rect2
);
656 ok(hr
== E_FAIL
, "Unexpected return code %#x\n", hr
);
658 hr
= pGetBufferedPaintTargetRect(NULL
, NULL
);
659 ok(hr
== E_POINTER
, "Unexpected return code %#x\n", hr
);
661 bits
= (void *)0xdeadbeef;
663 hr
= pGetBufferedPaintBits(NULL
, &bits
, &row
);
664 ok(hr
== E_FAIL
, "Unexpected return code %#x\n", hr
);
665 ok(row
== 10, "Unexpected row count %d\n", row
);
666 ok(bits
== (void *)0xdeadbeef, "Unepexpected data pointer %p\n", bits
);
668 hr
= pGetBufferedPaintBits(NULL
, NULL
, NULL
);
669 ok(hr
== E_POINTER
, "Unexpected return code %#x\n", hr
);
671 hr
= pGetBufferedPaintBits(NULL
, &bits
, NULL
);
672 ok(hr
== E_POINTER
, "Unexpected return code %#x\n", hr
);
674 hr
= pGetBufferedPaintBits(NULL
, NULL
, &row
);
675 ok(hr
== E_POINTER
, "Unexpected return code %#x\n", hr
);
677 /* access buffer bits */
678 for (format
= BPBF_COMPATIBLEBITMAP
; format
<= BPBF_TOPDOWNMONODIB
; format
++)
680 buffer
= pBeginBufferedPaint(target
, &rect
, format
, ¶ms
, &src
);
682 /* only works for DIB buffers */
685 hr
= pGetBufferedPaintBits(buffer
, &bits
, &row
);
686 if (format
== BPBF_COMPATIBLEBITMAP
)
687 ok(hr
== E_FAIL
, "Unexpected return code %#x\n", hr
);
690 ok(hr
== S_OK
, "Unexpected return code %#x\n", hr
);
691 ok(bits
!= NULL
, "Bitmap bits %p\n", bits
);
692 ok(row
>= (rect
.right
- rect
.left
), "format %d: bitmap width %d\n", format
, row
);
695 hr
= pEndBufferedPaint(buffer
, FALSE
);
696 ok(hr
== S_OK
, "Unexpected return code %#x\n", hr
);
706 /* No real functional tests will be done (yet). The current tests
707 * only show input/return behaviour
710 /* IsThemeActive, IsAppThemed and IsThemePartDefined*/
711 trace("Starting test_IsThemed()\n");
715 trace("Starting test_GetWindowTheme()\n");
716 test_GetWindowTheme();
719 trace("Starting test_SetWindowTheme()\n");
720 test_SetWindowTheme();
722 /* OpenThemeData, a bit more functional now */
723 trace("Starting test_OpenThemeData()\n");
724 test_OpenThemeData();
726 /* OpenThemeDataEx */
727 trace("Starting test_OpenThemeDataEx()\n");
728 test_OpenThemeDataEx();
730 /* GetCurrentThemeName */
731 trace("Starting test_GetCurrentThemeName()\n");
732 test_GetCurrentThemeName();
735 trace("Starting test_CloseThemeData()\n");
736 test_CloseThemeData();
738 test_buffered_paint();