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"
|
|
|
|
|
|
|
|
static HRESULT (WINAPI * pCloseThemeData)(HTHEME);
|
2006-06-26 13:41:02 +02:00
|
|
|
static HRESULT (WINAPI * pGetCurrentThemeName)(LPWSTR, int, LPWSTR, int, LPWSTR, int);
|
2006-06-21 18:51:00 +02:00
|
|
|
static HTHEME (WINAPI * pGetWindowTheme)(HWND);
|
2006-06-19 21:02:56 +02:00
|
|
|
static BOOL (WINAPI * pIsAppThemed)(VOID);
|
2006-06-13 14:16:58 +02:00
|
|
|
static BOOL (WINAPI * pIsThemeActive)(VOID);
|
2006-06-27 16:34:33 +02:00
|
|
|
static BOOL (WINAPI * pIsThemePartDefined)(HTHEME, int, int);
|
2006-06-13 14:16:58 +02:00
|
|
|
static HTHEME (WINAPI * pOpenThemeData)(HWND, LPCWSTR);
|
2011-03-23 17:54:55 +01:00
|
|
|
static HTHEME (WINAPI * pOpenThemeDataEx)(HWND, LPCWSTR, DWORD);
|
2006-06-13 14:16:58 +02:00
|
|
|
static HRESULT (WINAPI * pSetWindowTheme)(HWND, LPCWSTR, LPCWSTR);
|
|
|
|
|
|
|
|
static HMODULE hUxtheme = 0;
|
|
|
|
|
2011-03-23 17:54:55 +01:00
|
|
|
#define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func);
|
2006-06-13 14:16:58 +02:00
|
|
|
|
|
|
|
static BOOL InitFunctionPtrs(void)
|
|
|
|
{
|
|
|
|
hUxtheme = LoadLibraryA("uxtheme.dll");
|
|
|
|
if(!hUxtheme) {
|
|
|
|
trace("Could not load uxtheme.dll\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (hUxtheme)
|
|
|
|
{
|
|
|
|
UXTHEME_GET_PROC(CloseThemeData)
|
2006-06-26 13:41:02 +02:00
|
|
|
UXTHEME_GET_PROC(GetCurrentThemeName)
|
2006-06-21 18:51:00 +02:00
|
|
|
UXTHEME_GET_PROC(GetWindowTheme)
|
2006-06-19 21:02:56 +02:00
|
|
|
UXTHEME_GET_PROC(IsAppThemed)
|
2006-06-13 14:16:58 +02:00
|
|
|
UXTHEME_GET_PROC(IsThemeActive)
|
2006-06-27 16:34:33 +02:00
|
|
|
UXTHEME_GET_PROC(IsThemePartDefined)
|
2006-06-13 14:16:58 +02:00
|
|
|
UXTHEME_GET_PROC(OpenThemeData)
|
2011-03-23 17:54:55 +01:00
|
|
|
UXTHEME_GET_PROC(OpenThemeDataEx)
|
2006-06-13 14:16:58 +02:00
|
|
|
UXTHEME_GET_PROC(SetWindowTheme)
|
|
|
|
}
|
2006-06-21 20:37:10 +02:00
|
|
|
/* The following functions should be available, if not return FALSE. The Vista functions will
|
|
|
|
* be checked (at some point in time) within the single tests if needed. All used functions for
|
|
|
|
* now are present on WinXP, W2K3 and Wine.
|
|
|
|
*/
|
2006-06-27 16:34:33 +02:00
|
|
|
if (!pCloseThemeData || !pGetCurrentThemeName ||
|
|
|
|
!pGetWindowTheme || !pIsAppThemed ||
|
|
|
|
!pIsThemeActive || !pIsThemePartDefined ||
|
|
|
|
!pOpenThemeData || !pSetWindowTheme)
|
2011-03-23 17:54:55 +01:00
|
|
|
{
|
|
|
|
FreeLibrary(hUxtheme);
|
2006-06-21 20:37:10 +02:00
|
|
|
return FALSE;
|
2011-03-23 17:54:55 +01:00
|
|
|
}
|
2006-06-21 20:37:10 +02:00
|
|
|
|
2006-06-13 14:16:58 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
bThemeActive = pIsThemeActive();
|
|
|
|
trace("Theming is %s\n", (bThemeActive) ? "active" : "inactive");
|
|
|
|
|
|
|
|
bAppThemed = pIsAppThemed();
|
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);
|
|
|
|
bTPDefined = pIsThemePartDefined(NULL, 0 , 0);
|
|
|
|
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;
|
2006-06-22 15:01:25 +02:00
|
|
|
BOOL bDestroyed;
|
2006-06-21 18:51:00 +02:00
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pGetWindowTheme(NULL);
|
|
|
|
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);
|
|
|
|
if (!hWnd) return;
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pGetWindowTheme(hWnd);
|
|
|
|
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
|
|
|
|
|
|
|
bDestroyed = DestroyWindow(hWnd);
|
|
|
|
if (!bDestroyed)
|
2006-10-10 15:51:05 +02:00
|
|
|
trace("Window %p couldn't be destroyed : 0x%08x\n",
|
2006-06-22 15:01:25 +02:00
|
|
|
hWnd, GetLastError());
|
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;
|
2006-06-22 15:01:25 +02:00
|
|
|
BOOL bDestroyed;
|
2006-06-13 14:16:58 +02:00
|
|
|
|
|
|
|
hRes = pSetWindowTheme(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);
|
|
|
|
if (!hWnd) return;
|
|
|
|
|
|
|
|
hRes = pSetWindowTheme(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
|
|
|
|
|
|
|
bDestroyed = DestroyWindow(hWnd);
|
|
|
|
if (!bDestroyed)
|
2006-10-10 15:51:05 +02:00
|
|
|
trace("Window %p couldn't be destroyed : 0x%08x\n",
|
2006-06-22 15:01:25 +02:00
|
|
|
hWnd, GetLastError());
|
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-22 15:01:25 +02:00
|
|
|
BOOL bDestroyed;
|
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 };
|
|
|
|
|
|
|
|
bThemeActive = pIsThemeActive();
|
|
|
|
|
|
|
|
/* All NULL */
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hTheme = pOpenThemeData(NULL, NULL);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(NULL, szInvalidClassList);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(NULL, szClassList);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(hWnd, NULL);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(hWnd, szInvalidClassList);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(hWnd, szButtonClassList);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(hWnd, szButtonClassList);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(hWnd, szButtonClassList2);
|
|
|
|
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);
|
|
|
|
hTheme = pOpenThemeData(hWnd, szClassList);
|
|
|
|
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);
|
|
|
|
hTheme2 = pGetWindowTheme(hWnd);
|
|
|
|
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());
|
|
|
|
|
|
|
|
hRes = pCloseThemeData(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 */
|
|
|
|
hRes = pCloseThemeData(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;
|
|
|
|
hTheme2 = pGetWindowTheme(hWnd);
|
|
|
|
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);
|
|
|
|
bTPDefined = pIsThemePartDefined(hTheme, 0 , 0);
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
2006-06-22 15:01:25 +02:00
|
|
|
bDestroyed = DestroyWindow(hWnd);
|
|
|
|
if (!bDestroyed)
|
2006-10-10 15:51:05 +02:00
|
|
|
trace("Window %p couldn't be destroyed : 0x%08x\n",
|
2006-06-22 15:01:25 +02:00
|
|
|
hWnd, GetLastError());
|
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;
|
|
|
|
BOOL bDestroyed;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
bThemeActive = pIsThemeActive();
|
|
|
|
|
|
|
|
/* 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());
|
|
|
|
|
|
|
|
bDestroyed = DestroyWindow(hWnd);
|
|
|
|
if (!bDestroyed)
|
|
|
|
trace("Window %p couldn't be destroyed : 0x%08x\n",
|
|
|
|
hWnd, GetLastError());
|
|
|
|
}
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
bThemeActive = pIsThemeActive();
|
|
|
|
|
|
|
|
/* All NULLs */
|
|
|
|
hRes = pGetCurrentThemeName(NULL, 0, NULL, 0, NULL, 0);
|
|
|
|
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 */
|
|
|
|
hRes = pGetCurrentThemeName(currentTheme, 0, NULL, 0, NULL, 0);
|
|
|
|
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
|
|
|
|
|
|
|
hRes = pGetCurrentThemeName(currentTheme, 2, NULL, 0, NULL, 0);
|
|
|
|
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 */
|
|
|
|
hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
|
|
|
|
currentColor, 2,
|
|
|
|
currentSize, sizeof(currentSize) / sizeof(WCHAR));
|
|
|
|
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 */
|
|
|
|
hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR), NULL, 0, NULL, 0);
|
|
|
|
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 */
|
|
|
|
hRes = pGetCurrentThemeName(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 */
|
|
|
|
hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
|
|
|
|
currentColor, sizeof(currentTheme),
|
|
|
|
currentSize, sizeof(currentSize) / sizeof(WCHAR));
|
|
|
|
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
|
|
|
|
|
|
|
hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
|
|
|
|
currentColor, sizeof(currentTheme) / sizeof(WCHAR),
|
|
|
|
currentSize, sizeof(currentSize));
|
|
|
|
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 */
|
|
|
|
hRes = pGetCurrentThemeName(currentTheme, sizeof(currentTheme) / sizeof(WCHAR),
|
|
|
|
currentColor, sizeof(currentColor) / sizeof(WCHAR),
|
|
|
|
currentSize, sizeof(currentSize) / sizeof(WCHAR));
|
|
|
|
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;
|
|
|
|
|
|
|
|
hRes = pCloseThemeData(NULL);
|
2006-10-10 15:51:05 +02:00
|
|
|
ok( hRes == E_HANDLE, "Expected E_HANDLE, got 0x%08x\n", hRes);
|
2006-06-13 14:16:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(system)
|
|
|
|
{
|
|
|
|
if(!InitFunctionPtrs())
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* No real functional tests will be done (yet). The current tests
|
|
|
|
* only show input/return behaviour
|
|
|
|
*/
|
|
|
|
|
2006-06-27 16:34:33 +02:00
|
|
|
/* IsThemeActive, IsAppThemed and IsThemePartDefined*/
|
2006-06-19 21:02:56 +02:00
|
|
|
trace("Starting test_IsThemed()\n");
|
2006-06-21 20:37:10 +02:00
|
|
|
test_IsThemed();
|
2006-06-19 21:02:56 +02:00
|
|
|
|
2006-06-21 18:51:00 +02:00
|
|
|
/* GetWindowTheme */
|
|
|
|
trace("Starting test_GetWindowTheme()\n");
|
2006-06-21 20:37:10 +02:00
|
|
|
test_GetWindowTheme();
|
2006-06-21 18:51:00 +02:00
|
|
|
|
2006-06-13 14:16:58 +02:00
|
|
|
/* SetWindowTheme */
|
|
|
|
trace("Starting test_SetWindowTheme()\n");
|
2006-06-21 20:37:10 +02:00
|
|
|
test_SetWindowTheme();
|
2006-06-13 14:16:58 +02:00
|
|
|
|
2006-06-22 17:14:18 +02:00
|
|
|
/* OpenThemeData, a bit more functional now */
|
2006-06-13 14:16:58 +02:00
|
|
|
trace("Starting test_OpenThemeData()\n");
|
2006-06-21 20:37:10 +02:00
|
|
|
test_OpenThemeData();
|
2006-06-13 14:16:58 +02:00
|
|
|
|
2011-03-23 17:54:55 +01:00
|
|
|
/* OpenThemeDataEx */
|
|
|
|
trace("Starting test_OpenThemeDataEx()\n");
|
|
|
|
test_OpenThemeDataEx();
|
|
|
|
|
2006-06-26 13:41:02 +02:00
|
|
|
/* GetCurrentThemeName */
|
|
|
|
trace("Starting test_GetCurrentThemeName()\n");
|
|
|
|
test_GetCurrentThemeName();
|
|
|
|
|
2006-06-13 14:16:58 +02:00
|
|
|
/* CloseThemeData */
|
|
|
|
trace("Starting test_CloseThemeData()\n");
|
2006-06-21 20:37:10 +02:00
|
|
|
test_CloseThemeData();
|
2006-06-13 14:16:58 +02:00
|
|
|
|
|
|
|
FreeLibrary(hUxtheme);
|
|
|
|
}
|