2006-06-13 14:16:58 +02:00
|
|
|
/* Unit test suite for uxtheme API functions
|
|
|
|
*
|
|
|
|
* Copyright 2006 Paul Vriens
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windows.h"
|
2006-11-08 00:57:55 +01:00
|
|
|
#include "vfwmsgs.h"
|
2006-06-13 14:16:58 +02:00
|
|
|
#include "uxtheme.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2011-03-23 17:54:55 +01:00
|
|
|
static HTHEME (WINAPI * pOpenThemeDataEx)(HWND, LPCWSTR, DWORD);
|
2017-01-19 15:13:29 +01:00
|
|
|
static HPAINTBUFFER (WINAPI *pBeginBufferedPaint)(HDC, const RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *);
|
|
|
|
static HRESULT (WINAPI *pBufferedPaintClear)(HPAINTBUFFER, const RECT *);
|
|
|
|
static HRESULT (WINAPI *pEndBufferedPaint)(HPAINTBUFFER, BOOL);
|
|
|
|
static HRESULT (WINAPI *pGetBufferedPaintBits)(HPAINTBUFFER, RGBQUAD **, int *);
|
|
|
|
static HDC (WINAPI *pGetBufferedPaintDC)(HPAINTBUFFER);
|
|
|
|
static HDC (WINAPI *pGetBufferedPaintTargetDC)(HPAINTBUFFER);
|
|
|
|
static HRESULT (WINAPI *pGetBufferedPaintTargetRect)(HPAINTBUFFER, RECT *);
|
2006-06-13 14:16:58 +02:00
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
static void init_funcs(void)
|
2006-06-13 14:16:58 +02:00
|
|
|
{
|
2016-04-26 20:57:23 +02:00
|
|
|
HMODULE hUxtheme = GetModuleHandleA("uxtheme.dll");
|
2017-01-19 15:13:29 +01:00
|
|
|
|
|
|
|
#define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func)
|
|
|
|
UXTHEME_GET_PROC(BeginBufferedPaint);
|
|
|
|
UXTHEME_GET_PROC(BufferedPaintClear);
|
|
|
|
UXTHEME_GET_PROC(EndBufferedPaint);
|
|
|
|
UXTHEME_GET_PROC(GetBufferedPaintBits);
|
|
|
|
UXTHEME_GET_PROC(GetBufferedPaintDC);
|
|
|
|
UXTHEME_GET_PROC(GetBufferedPaintTargetDC);
|
|
|
|
UXTHEME_GET_PROC(GetBufferedPaintTargetRect);
|
|
|
|
UXTHEME_GET_PROC(BufferedPaintClear);
|
|
|
|
|
|
|
|
UXTHEME_GET_PROC(OpenThemeDataEx);
|
|
|
|
#undef UXTHEME_GET_PROC
|
2006-06-13 14:16:58 +02:00
|
|
|
}
|
|
|
|
|
2006-06-19 21:02:56 +02:00
|
|
|
static void test_IsThemed(void)
|
|
|
|
{
|
|
|
|
BOOL bThemeActive;
|
|
|
|
BOOL bAppThemed;
|
2006-06-27 16:34:33 +02:00
|
|
|
BOOL bTPDefined;
|
2006-06-19 21:02:56 +02:00
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
bThemeActive = IsThemeActive();
|
2006-06-19 21:02:56 +02:00
|
|
|
trace("Theming is %s\n", (bThemeActive) ? "active" : "inactive");
|
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
bAppThemed = IsAppThemed();
|
2013-04-02 15:42:26 +02:00
|
|
|
trace("Test executable is %s\n", (bAppThemed) ? "themed" : "not themed");
|
2006-06-27 16:34:33 +02:00
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
bTPDefined = IsThemePartDefined(NULL, 0 , 0);
|
2006-06-27 16:34:33 +02:00
|
|
|
ok( bTPDefined == FALSE, "Expected FALSE\n");
|
|
|
|
ok( GetLastError() == E_HANDLE,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected E_HANDLE, got 0x%08x\n",
|
2006-06-27 16:34:33 +02:00
|
|
|
GetLastError());
|
2006-06-19 21:02:56 +02:00
|
|
|
}
|
|
|
|
|
2006-06-21 18:51:00 +02:00
|
|
|
static void test_GetWindowTheme(void)
|
|
|
|
{
|
|
|
|
HTHEME hTheme;
|
|
|
|
HWND hWnd;
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = GetWindowTheme(NULL);
|
2006-06-21 18:51:00 +02:00
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_HANDLE,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected E_HANDLE, got 0x%08x\n",
|
2006-06-21 18:51:00 +02:00
|
|
|
GetLastError());
|
|
|
|
|
2008-01-16 12:20:50 +01:00
|
|
|
/* Only do the bare minimum to get a valid hwnd */
|
2006-06-21 18:51:00 +02:00
|
|
|
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
|
2018-04-23 09:45:13 +02:00
|
|
|
ok(hWnd != NULL, "Failed to create a test window.\n");
|
2006-06-21 18:51:00 +02:00
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = GetWindowTheme(hWnd);
|
2006-06-21 18:51:00 +02:00
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
ok( GetLastError() == 0xdeadbeef,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected 0xdeadbeef, got 0x%08x\n",
|
2006-06-21 18:51:00 +02:00
|
|
|
GetLastError());
|
2006-06-22 15:01:25 +02:00
|
|
|
|
2018-04-23 09:45:13 +02:00
|
|
|
DestroyWindow(hWnd);
|
2006-06-21 18:51:00 +02:00
|
|
|
}
|
|
|
|
|
2006-06-13 14:16:58 +02:00
|
|
|
static void test_SetWindowTheme(void)
|
|
|
|
{
|
|
|
|
HRESULT hRes;
|
|
|
|
HWND hWnd;
|
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = SetWindowTheme(NULL, NULL, NULL);
|
2014-04-23 16:28:17 +02:00
|
|
|
todo_wine
|
|
|
|
ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
|
2006-06-13 14:16:58 +02:00
|
|
|
|
2008-01-16 12:20:50 +01:00
|
|
|
/* Only do the bare minimum to get a valid hwnd */
|
2006-06-13 14:16:58 +02:00
|
|
|
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
|
2018-04-23 09:45:13 +02:00
|
|
|
ok(hWnd != NULL, "Failed to create a test window.\n");
|
2006-06-13 14:16:58 +02:00
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = SetWindowTheme(hWnd, NULL, NULL);
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-22 15:01:25 +02:00
|
|
|
|
2018-04-23 09:45:13 +02:00
|
|
|
DestroyWindow(hWnd);
|
2006-06-13 14:16:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_OpenThemeData(void)
|
|
|
|
{
|
2006-06-22 17:14:18 +02:00
|
|
|
HTHEME hTheme, hTheme2;
|
2006-06-13 14:16:58 +02:00
|
|
|
HWND hWnd;
|
|
|
|
BOOL bThemeActive;
|
2006-06-22 17:14:18 +02:00
|
|
|
HRESULT hRes;
|
2006-06-27 16:34:33 +02:00
|
|
|
BOOL bTPDefined;
|
2006-06-13 14:16:58 +02:00
|
|
|
|
|
|
|
WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
|
|
|
|
WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
|
2006-06-22 14:38:32 +02:00
|
|
|
WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
|
2006-06-13 14:16:58 +02:00
|
|
|
WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
|
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
bThemeActive = IsThemeActive();
|
2006-06-13 14:16:58 +02:00
|
|
|
|
|
|
|
/* All NULL */
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(NULL, NULL);
|
2006-06-13 14:16:58 +02:00
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
2011-08-30 15:15:25 +02:00
|
|
|
ok( GetLastError() == E_POINTER,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected GLE() to be E_POINTER, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
/* A NULL hWnd and an invalid classlist */
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(NULL, szInvalidClassList);
|
2006-06-13 14:16:58 +02:00
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(NULL, szClassList);
|
2006-06-13 14:16:58 +02:00
|
|
|
if (bThemeActive)
|
|
|
|
{
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
2006-06-19 17:49:36 +02:00
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
|
|
|
}
|
|
|
|
|
2008-01-16 12:20:50 +01:00
|
|
|
/* Only do the bare minimum to get a valid hdc */
|
2006-06-13 14:16:58 +02:00
|
|
|
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
|
|
|
|
if (!hWnd) return;
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(hWnd, NULL);
|
2006-06-13 14:16:58 +02:00
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
2011-08-30 15:15:25 +02:00
|
|
|
ok( GetLastError() == E_POINTER,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected GLE() to be E_POINTER, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(hWnd, szInvalidClassList);
|
2006-06-13 14:16:58 +02:00
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
if (!bThemeActive)
|
|
|
|
{
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(hWnd, szButtonClassList);
|
2006-06-13 14:16:58 +02:00
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
2008-10-20 23:03:05 +02:00
|
|
|
skip("No active theme, skipping rest of OpenThemeData tests\n");
|
2006-06-13 14:16:58 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only do the next checks if we have an active theme */
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(hWnd, szButtonClassList);
|
2006-06-13 14:16:58 +02:00
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
2006-06-19 17:49:36 +02:00
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
|
|
|
|
2006-06-22 14:38:32 +02:00
|
|
|
/* Test with bUtToN instead of Button */
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(hWnd, szButtonClassList2);
|
2006-06-22 14:38:32 +02:00
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
2006-06-22 14:38:32 +02:00
|
|
|
GetLastError());
|
|
|
|
|
2006-06-13 14:16:58 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme = OpenThemeData(hWnd, szClassList);
|
2006-06-13 14:16:58 +02:00
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
2006-06-19 17:49:36 +02:00
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
2006-06-13 14:16:58 +02:00
|
|
|
GetLastError());
|
2006-06-22 15:01:25 +02:00
|
|
|
|
2006-06-22 17:14:18 +02:00
|
|
|
/* GetWindowTheme should return the last handle opened by OpenThemeData */
|
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme2 = GetWindowTheme(hWnd);
|
2006-06-22 17:14:18 +02:00
|
|
|
ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
|
|
|
|
hTheme, hTheme2);
|
|
|
|
ok( GetLastError() == 0xdeadbeef,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected 0xdeadbeef, got 0x%08x\n",
|
2006-06-22 17:14:18 +02:00
|
|
|
GetLastError());
|
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = CloseThemeData(hTheme);
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-22 17:14:18 +02:00
|
|
|
|
|
|
|
/* Close a second time */
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = CloseThemeData(hTheme);
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-22 17:14:18 +02:00
|
|
|
|
|
|
|
/* See if closing makes a difference for GetWindowTheme */
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme2 = NULL;
|
2016-04-26 20:57:23 +02:00
|
|
|
hTheme2 = GetWindowTheme(hWnd);
|
2006-06-22 17:14:18 +02:00
|
|
|
ok( hTheme == hTheme2, "Expected the same HTHEME handle (%p<->%p)\n",
|
|
|
|
hTheme, hTheme2);
|
|
|
|
ok( GetLastError() == 0xdeadbeef,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected 0xdeadbeef, got 0x%08x\n",
|
2006-06-22 17:14:18 +02:00
|
|
|
GetLastError());
|
|
|
|
|
2006-06-27 16:34:33 +02:00
|
|
|
SetLastError(0xdeadbeef);
|
2016-04-26 20:57:23 +02:00
|
|
|
bTPDefined = IsThemePartDefined(hTheme, 0 , 0);
|
2006-06-27 16:34:33 +02:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok( bTPDefined == FALSE, "Expected FALSE\n");
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
2006-10-10 15:51:05 +02:00
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
2006-06-27 16:34:33 +02:00
|
|
|
GetLastError());
|
|
|
|
}
|
|
|
|
|
2018-04-23 09:45:13 +02:00
|
|
|
DestroyWindow(hWnd);
|
2006-06-13 14:16:58 +02:00
|
|
|
}
|
|
|
|
|
2011-03-23 17:54:55 +01:00
|
|
|
static void test_OpenThemeDataEx(void)
|
|
|
|
{
|
|
|
|
HTHEME hTheme;
|
|
|
|
HWND hWnd;
|
|
|
|
BOOL bThemeActive;
|
|
|
|
|
|
|
|
WCHAR szInvalidClassList[] = {'D','E','A','D','B','E','E','F', 0 };
|
|
|
|
WCHAR szButtonClassList[] = {'B','u','t','t','o','n', 0 };
|
|
|
|
WCHAR szButtonClassList2[] = {'b','U','t','T','o','N', 0 };
|
|
|
|
WCHAR szClassList[] = {'B','u','t','t','o','n',';','L','i','s','t','B','o','x', 0 };
|
|
|
|
|
|
|
|
if (!pOpenThemeDataEx)
|
|
|
|
{
|
|
|
|
win_skip("OpenThemeDataEx not available\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
bThemeActive = IsThemeActive();
|
2011-03-23 17:54:55 +01:00
|
|
|
|
|
|
|
/* All NULL */
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(NULL, NULL, 0);
|
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
2011-08-30 15:15:25 +02:00
|
|
|
ok( GetLastError() == E_POINTER,
|
2011-03-23 17:54:55 +01:00
|
|
|
"Expected GLE() to be E_POINTER, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
/* A NULL hWnd and an invalid classlist without flags */
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(NULL, szInvalidClassList, 0);
|
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(NULL, szClassList, 0);
|
|
|
|
if (bThemeActive)
|
|
|
|
{
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only do the bare minimum to get a valid hdc */
|
|
|
|
hWnd = CreateWindowExA(0, "static", "", WS_POPUP, 0,0,100,100,0, 0, 0, NULL);
|
|
|
|
if (!hWnd) return;
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, NULL, 0);
|
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
2011-08-30 15:15:25 +02:00
|
|
|
ok( GetLastError() == E_POINTER,
|
2011-03-23 17:54:55 +01:00
|
|
|
"Expected GLE() to be E_POINTER, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szInvalidClassList, 0);
|
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
if (!bThemeActive)
|
|
|
|
{
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
|
|
|
|
ok( hTheme == NULL, "Expected a NULL return, got %p\n", hTheme);
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == E_PROP_ID_UNSUPPORTED,
|
|
|
|
"Expected GLE() to be E_PROP_ID_UNSUPPORTED, got 0x%08x\n",
|
|
|
|
GetLastError());
|
2011-03-30 21:51:02 +02:00
|
|
|
skip("No active theme, skipping rest of OpenThemeDataEx tests\n");
|
2011-03-23 17:54:55 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only do the next checks if we have an active theme */
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0);
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_FORCE_RECT_SIZING);
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, OTD_NONCLIENT);
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szButtonClassList, 0x3);
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
/* Test with bUtToN instead of Button */
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szButtonClassList2, 0);
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeDataEx(hWnd, szClassList, 0);
|
|
|
|
ok( hTheme != NULL, "got NULL, expected a HTHEME handle\n");
|
|
|
|
todo_wine
|
|
|
|
ok( GetLastError() == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got 0x%08x\n",
|
|
|
|
GetLastError());
|
|
|
|
|
2018-04-23 09:45:13 +02:00
|
|
|
DestroyWindow(hWnd);
|
2011-03-23 17:54:55 +01:00
|
|
|
}
|
|
|
|
|
2006-06-26 13:41:02 +02:00
|
|
|
static void test_GetCurrentThemeName(void)
|
|
|
|
{
|
|
|
|
BOOL bThemeActive;
|
|
|
|
HRESULT hRes;
|
|
|
|
WCHAR currentTheme[MAX_PATH];
|
|
|
|
WCHAR currentColor[MAX_PATH];
|
|
|
|
WCHAR currentSize[MAX_PATH];
|
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
bThemeActive = IsThemeActive();
|
2006-06-26 13:41:02 +02:00
|
|
|
|
|
|
|
/* All NULLs */
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = GetCurrentThemeName(NULL, 0, NULL, 0, NULL, 0);
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
|
|
|
/* Number of characters given is 0 */
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, 0, NULL, 0, NULL, 0);
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
2011-04-01 18:50:30 +02:00
|
|
|
ok( hRes == S_OK || broken(hRes == E_FAIL /* WinXP SP1 */), "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, 2, NULL, 0, NULL, 0);
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
|
|
|
todo_wine
|
2014-10-08 06:44:50 +02:00
|
|
|
ok(hRes == E_NOT_SUFFICIENT_BUFFER ||
|
2011-04-01 18:50:30 +02:00
|
|
|
broken(hRes == E_FAIL /* WinXP SP1 */),
|
2014-10-08 06:44:50 +02:00
|
|
|
"Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
|
|
|
/* The same is true if the number of characters is too small for Color and/or Size */
|
2018-05-30 21:15:37 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor, 2,
|
|
|
|
currentSize, ARRAY_SIZE(currentSize));
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
|
|
|
todo_wine
|
2014-10-08 06:44:50 +02:00
|
|
|
ok(hRes == E_NOT_SUFFICIENT_BUFFER ||
|
2011-04-01 18:50:30 +02:00
|
|
|
broken(hRes == E_FAIL /* WinXP SP1 */),
|
2014-10-08 06:44:50 +02:00
|
|
|
"Expected E_NOT_SUFFICIENT_BUFFER, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
|
|
|
/* Given number of characters is correct */
|
2018-05-30 21:15:37 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), NULL, 0, NULL, 0);
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
|
|
|
/* Given number of characters for the theme name is too large */
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, sizeof(currentTheme), NULL, 0, NULL, 0);
|
2008-02-07 09:12:25 +01:00
|
|
|
if (bThemeActive)
|
|
|
|
ok( hRes == E_POINTER || hRes == S_OK, "Expected E_POINTER or S_OK, got 0x%08x\n", hRes);
|
|
|
|
else
|
2008-04-24 02:07:19 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED ||
|
|
|
|
hRes == E_POINTER, /* win2k3 */
|
|
|
|
"Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
|
|
|
/* The too large case is only for the theme name, not for color name or size name */
|
2018-05-30 21:15:37 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor,
|
|
|
|
sizeof(currentTheme), currentSize, ARRAY_SIZE(currentSize));
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
2018-05-30 21:15:37 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor,
|
|
|
|
ARRAY_SIZE(currentTheme), currentSize, sizeof(currentSize));
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
|
|
|
|
/* Correct call */
|
2018-05-30 21:15:37 +02:00
|
|
|
hRes = GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme), currentColor,
|
|
|
|
ARRAY_SIZE(currentColor), currentSize, ARRAY_SIZE(currentSize));
|
2006-06-26 13:41:02 +02:00
|
|
|
if (bThemeActive)
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == S_OK, "Expected S_OK, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
else
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_PROP_ID_UNSUPPORTED, "Expected E_PROP_ID_UNSUPPORTED, got 0x%08x\n", hRes);
|
2006-06-26 13:41:02 +02:00
|
|
|
}
|
|
|
|
|
2006-06-13 14:16:58 +02:00
|
|
|
static void test_CloseThemeData(void)
|
|
|
|
{
|
|
|
|
HRESULT hRes;
|
|
|
|
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = CloseThemeData(NULL);
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
|
2016-04-26 20:57:23 +02:00
|
|
|
hRes = CloseThemeData(INVALID_HANDLE_VALUE);
|
2016-02-12 10:51:42 +01:00
|
|
|
ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
|
2006-06-13 14:16:58 +02:00
|
|
|
}
|
|
|
|
|
2017-04-25 07:54:07 +02:00
|
|
|
static void test_buffer_dc_props(HDC hdc, const RECT *rect)
|
|
|
|
{
|
|
|
|
static const XFORM ident = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f };
|
|
|
|
XFORM xform;
|
|
|
|
POINT org;
|
|
|
|
RECT box;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
ret = GetWorldTransform(hdc, &xform);
|
|
|
|
ok(ret, "Failed to get world transform\n");
|
|
|
|
ok(!memcmp(&xform, &ident, sizeof(xform)), "Unexpected world transform\n");
|
|
|
|
|
|
|
|
ret = GetViewportOrgEx(hdc, &org);
|
|
|
|
ok(ret, "Failed to get vport origin\n");
|
|
|
|
ok(org.x == 0 && org.y == 0, "Unexpected vport origin\n");
|
|
|
|
|
|
|
|
ret = GetWindowOrgEx(hdc, &org);
|
|
|
|
ok(ret, "Failed to get vport origin\n");
|
|
|
|
ok(org.x == rect->left && org.y == rect->top, "Unexpected window origin\n");
|
|
|
|
|
|
|
|
ret = GetClipBox(hdc, &box);
|
|
|
|
ok(ret, "Failed to get clip box\n");
|
|
|
|
ok(box.left == rect->left && box.top == rect->top, "Unexpected clip box\n");
|
|
|
|
|
|
|
|
ok(GetGraphicsMode(hdc) == GM_COMPATIBLE, "wrong graphics mode\n");
|
|
|
|
}
|
|
|
|
|
2017-01-19 15:13:29 +01:00
|
|
|
static void test_buffered_paint(void)
|
|
|
|
{
|
2017-04-25 07:54:07 +02:00
|
|
|
HDC target, src, hdc, screen_dc;
|
2017-01-19 15:13:29 +01:00
|
|
|
BP_PAINTPARAMS params = { 0 };
|
|
|
|
BP_BUFFERFORMAT format;
|
|
|
|
HPAINTBUFFER buffer;
|
|
|
|
RECT rect, rect2;
|
2017-02-08 23:42:40 +01:00
|
|
|
RGBQUAD *bits;
|
2017-04-25 07:54:07 +02:00
|
|
|
HBITMAP hbm;
|
2017-01-19 15:13:29 +01:00
|
|
|
HRESULT hr;
|
2017-02-08 23:42:40 +01:00
|
|
|
int row;
|
2017-01-19 15:13:29 +01:00
|
|
|
|
|
|
|
if (!pBeginBufferedPaint)
|
|
|
|
{
|
|
|
|
win_skip("Buffered painting API is not supported.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = pBeginBufferedPaint(NULL, NULL, BPBF_COMPATIBLEBITMAP,
|
|
|
|
NULL, NULL);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
|
|
|
|
|
|
|
target = CreateCompatibleDC(0);
|
|
|
|
buffer = pBeginBufferedPaint(target, NULL, BPBF_COMPATIBLEBITMAP,
|
|
|
|
NULL, NULL);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
|
|
|
|
|
|
|
params.cbSize = sizeof(params);
|
|
|
|
buffer = pBeginBufferedPaint(target, NULL, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, NULL);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
|
|
|
|
2017-02-08 23:42:34 +01:00
|
|
|
src = (void *)0xdeadbeef;
|
2017-01-19 15:13:29 +01:00
|
|
|
buffer = pBeginBufferedPaint(target, NULL, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, &src);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
2017-02-08 23:42:34 +01:00
|
|
|
ok(src == NULL, "Unexpected buffered dc %p\n", src);
|
2017-01-19 15:13:29 +01:00
|
|
|
|
|
|
|
/* target rect is mandatory */
|
2017-02-08 23:42:34 +01:00
|
|
|
SetRectEmpty(&rect);
|
|
|
|
src = (void *)0xdeadbeef;
|
2017-01-19 15:13:29 +01:00
|
|
|
buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, &src);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
2017-02-08 23:42:34 +01:00
|
|
|
ok(src == NULL, "Unexpected buffered dc %p\n", src);
|
2017-01-19 15:13:29 +01:00
|
|
|
|
2017-02-08 23:42:34 +01:00
|
|
|
/* inverted rectangle */
|
|
|
|
SetRect(&rect, 10, 0, 5, 5);
|
|
|
|
src = (void *)0xdeadbeef;
|
|
|
|
buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, &src);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
|
|
|
ok(src == NULL, "Unexpected buffered dc %p\n", src);
|
|
|
|
|
|
|
|
SetRect(&rect, 0, 10, 5, 0);
|
|
|
|
src = (void *)0xdeadbeef;
|
|
|
|
buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, &src);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
|
|
|
ok(src == NULL, "Unexpected buffered dc %p\n", src);
|
|
|
|
|
|
|
|
/* valid rectangle, no target dc */
|
|
|
|
SetRect(&rect, 0, 0, 5, 5);
|
|
|
|
src = (void *)0xdeadbeef;
|
|
|
|
buffer = pBeginBufferedPaint(NULL, &rect, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, &src);
|
|
|
|
ok(buffer == NULL, "Unexpected buffer %p\n", buffer);
|
|
|
|
ok(src == NULL, "Unexpected buffered dc %p\n", src);
|
|
|
|
|
|
|
|
SetRect(&rect, 0, 0, 5, 5);
|
|
|
|
src = NULL;
|
2017-01-19 15:13:29 +01:00
|
|
|
buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, &src);
|
|
|
|
ok(buffer != NULL, "Unexpected buffer %p\n", buffer);
|
2017-02-08 23:42:34 +01:00
|
|
|
ok(src != NULL, "Expected buffered dc\n");
|
2017-01-19 15:13:29 +01:00
|
|
|
hr = pEndBufferedPaint(buffer, FALSE);
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
|
2017-02-08 23:42:34 +01:00
|
|
|
SetRect(&rect, 0, 0, 5, 5);
|
2017-01-19 15:13:29 +01:00
|
|
|
buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP,
|
|
|
|
¶ms, &src);
|
|
|
|
ok(buffer != NULL, "Unexpected buffer %p\n", buffer);
|
|
|
|
|
|
|
|
/* clearing */
|
|
|
|
hr = pBufferedPaintClear(NULL, NULL);
|
|
|
|
todo_wine
|
|
|
|
ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
hr = pBufferedPaintClear(buffer, NULL);
|
|
|
|
todo_wine
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
/* access buffer attributes */
|
|
|
|
hdc = pGetBufferedPaintDC(buffer);
|
|
|
|
ok(hdc == src, "Unexpected hdc, %p, buffered dc %p\n", hdc, src);
|
|
|
|
|
|
|
|
hdc = pGetBufferedPaintTargetDC(buffer);
|
|
|
|
ok(hdc == target, "Unexpected target hdc %p, original %p\n", hdc, target);
|
|
|
|
|
2017-02-08 23:42:38 +01:00
|
|
|
hr = pGetBufferedPaintTargetRect(NULL, NULL);
|
|
|
|
ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
|
|
|
|
|
2017-01-19 15:13:29 +01:00
|
|
|
hr = pGetBufferedPaintTargetRect(buffer, NULL);
|
|
|
|
ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
|
|
|
|
|
2017-02-08 23:42:38 +01:00
|
|
|
hr = pGetBufferedPaintTargetRect(NULL, &rect2);
|
|
|
|
ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
|
|
|
|
|
2017-01-19 15:13:29 +01:00
|
|
|
SetRectEmpty(&rect2);
|
|
|
|
hr = pGetBufferedPaintTargetRect(buffer, &rect2);
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
ok(EqualRect(&rect, &rect2), "Wrong target rect\n");
|
2017-02-08 23:42:38 +01:00
|
|
|
|
2017-01-19 15:13:29 +01:00
|
|
|
hr = pEndBufferedPaint(buffer, FALSE);
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
|
2017-02-08 23:42:40 +01:00
|
|
|
/* invalid buffer handle */
|
|
|
|
hr = pEndBufferedPaint(NULL, FALSE);
|
|
|
|
ok(hr == E_INVALIDARG, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
hdc = pGetBufferedPaintDC(NULL);
|
|
|
|
ok(hdc == NULL, "Unexpected hdc %p\n", hdc);
|
|
|
|
|
|
|
|
hdc = pGetBufferedPaintTargetDC(NULL);
|
|
|
|
ok(hdc == NULL, "Unexpected target hdc %p\n", hdc);
|
|
|
|
|
|
|
|
hr = pGetBufferedPaintTargetRect(NULL, &rect2);
|
|
|
|
ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
hr = pGetBufferedPaintTargetRect(NULL, NULL);
|
|
|
|
ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
bits = (void *)0xdeadbeef;
|
|
|
|
row = 10;
|
|
|
|
hr = pGetBufferedPaintBits(NULL, &bits, &row);
|
|
|
|
ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
|
|
|
|
ok(row == 10, "Unexpected row count %d\n", row);
|
2017-06-09 16:48:16 +02:00
|
|
|
ok(bits == (void *)0xdeadbeef, "Unexpected data pointer %p\n", bits);
|
2017-02-08 23:42:40 +01:00
|
|
|
|
|
|
|
hr = pGetBufferedPaintBits(NULL, NULL, NULL);
|
|
|
|
ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
hr = pGetBufferedPaintBits(NULL, &bits, NULL);
|
|
|
|
ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
hr = pGetBufferedPaintBits(NULL, NULL, &row);
|
|
|
|
ok(hr == E_POINTER, "Unexpected return code %#x\n", hr);
|
|
|
|
|
2017-04-25 07:54:07 +02:00
|
|
|
screen_dc = GetDC(0);
|
|
|
|
|
|
|
|
hdc = CreateCompatibleDC(screen_dc);
|
|
|
|
ok(hdc != NULL, "Failed to create a DC\n");
|
|
|
|
hbm = CreateCompatibleBitmap(screen_dc, 64, 64);
|
|
|
|
ok(hbm != NULL, "Failed to create a bitmap\n");
|
|
|
|
SelectObject(hdc, hbm);
|
|
|
|
|
|
|
|
ReleaseDC(0, screen_dc);
|
|
|
|
|
|
|
|
SetRect(&rect, 1, 2, 34, 56);
|
|
|
|
|
|
|
|
buffer = pBeginBufferedPaint(hdc, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src);
|
|
|
|
test_buffer_dc_props(src, &rect);
|
|
|
|
hr = pEndBufferedPaint(buffer, FALSE);
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
|
|
|
|
DeleteObject(hbm);
|
|
|
|
DeleteDC(hdc);
|
|
|
|
|
|
|
|
buffer = pBeginBufferedPaint(target, &rect, BPBF_COMPATIBLEBITMAP, NULL, &src);
|
|
|
|
test_buffer_dc_props(src, &rect);
|
|
|
|
hr = pEndBufferedPaint(buffer, FALSE);
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
|
2017-01-19 15:13:29 +01:00
|
|
|
/* access buffer bits */
|
|
|
|
for (format = BPBF_COMPATIBLEBITMAP; format <= BPBF_TOPDOWNMONODIB; format++)
|
|
|
|
{
|
|
|
|
buffer = pBeginBufferedPaint(target, &rect, format, ¶ms, &src);
|
|
|
|
|
|
|
|
/* only works for DIB buffers */
|
|
|
|
bits = NULL;
|
|
|
|
row = 0;
|
|
|
|
hr = pGetBufferedPaintBits(buffer, &bits, &row);
|
|
|
|
if (format == BPBF_COMPATIBLEBITMAP)
|
|
|
|
ok(hr == E_FAIL, "Unexpected return code %#x\n", hr);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
ok(bits != NULL, "Bitmap bits %p\n", bits);
|
2017-02-08 23:42:40 +01:00
|
|
|
ok(row >= (rect.right - rect.left), "format %d: bitmap width %d\n", format, row);
|
2017-01-19 15:13:29 +01:00
|
|
|
}
|
2017-02-08 23:42:39 +01:00
|
|
|
|
2017-01-19 15:13:29 +01:00
|
|
|
hr = pEndBufferedPaint(buffer, FALSE);
|
|
|
|
ok(hr == S_OK, "Unexpected return code %#x\n", hr);
|
|
|
|
}
|
|
|
|
|
|
|
|
DeleteDC(target);
|
|
|
|
}
|
|
|
|
|
2006-06-13 14:16:58 +02:00
|
|
|
START_TEST(system)
|
|
|
|
{
|
2016-04-26 20:57:23 +02:00
|
|
|
init_funcs();
|
2006-06-13 14:16:58 +02:00
|
|
|
|
2017-04-26 09:34:28 +02:00
|
|
|
/* No real functional theme API tests will be done (yet). The current tests
|
2006-06-13 14:16:58 +02:00
|
|
|
* only show input/return behaviour
|
|
|
|
*/
|
|
|
|
|
2006-06-21 20:37:10 +02:00
|
|
|
test_IsThemed();
|
|
|
|
test_GetWindowTheme();
|
|
|
|
test_SetWindowTheme();
|
|
|
|
test_OpenThemeData();
|
2011-03-23 17:54:55 +01:00
|
|
|
test_OpenThemeDataEx();
|
2006-06-26 13:41:02 +02:00
|
|
|
test_GetCurrentThemeName();
|
2006-06-21 20:37:10 +02:00
|
|
|
test_CloseThemeData();
|
2017-01-19 15:13:29 +01:00
|
|
|
test_buffered_paint();
|
2006-06-13 14:16:58 +02:00
|
|
|
}
|