uxtheme/tests: Add tests for OpenThemeDataEx.
This commit is contained in:
parent
0304a3e998
commit
d69c1bef4c
|
@ -33,17 +33,12 @@ static BOOL (WINAPI * pIsAppThemed)(VOID);
|
||||||
static BOOL (WINAPI * pIsThemeActive)(VOID);
|
static BOOL (WINAPI * pIsThemeActive)(VOID);
|
||||||
static BOOL (WINAPI * pIsThemePartDefined)(HTHEME, int, int);
|
static BOOL (WINAPI * pIsThemePartDefined)(HTHEME, int, int);
|
||||||
static HTHEME (WINAPI * pOpenThemeData)(HWND, LPCWSTR);
|
static HTHEME (WINAPI * pOpenThemeData)(HWND, LPCWSTR);
|
||||||
|
static HTHEME (WINAPI * pOpenThemeDataEx)(HWND, LPCWSTR, DWORD);
|
||||||
static HRESULT (WINAPI * pSetWindowTheme)(HWND, LPCWSTR, LPCWSTR);
|
static HRESULT (WINAPI * pSetWindowTheme)(HWND, LPCWSTR, LPCWSTR);
|
||||||
|
|
||||||
static HMODULE hUxtheme = 0;
|
static HMODULE hUxtheme = 0;
|
||||||
|
|
||||||
#define UXTHEME_GET_PROC(func) \
|
#define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func);
|
||||||
p ## func = (void*)GetProcAddress(hUxtheme, #func); \
|
|
||||||
if(!p ## func) { \
|
|
||||||
trace("GetProcAddress(%s) failed\n", #func); \
|
|
||||||
FreeLibrary(hUxtheme); \
|
|
||||||
return FALSE; \
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL InitFunctionPtrs(void)
|
static BOOL InitFunctionPtrs(void)
|
||||||
{
|
{
|
||||||
|
@ -61,6 +56,7 @@ static BOOL InitFunctionPtrs(void)
|
||||||
UXTHEME_GET_PROC(IsThemeActive)
|
UXTHEME_GET_PROC(IsThemeActive)
|
||||||
UXTHEME_GET_PROC(IsThemePartDefined)
|
UXTHEME_GET_PROC(IsThemePartDefined)
|
||||||
UXTHEME_GET_PROC(OpenThemeData)
|
UXTHEME_GET_PROC(OpenThemeData)
|
||||||
|
UXTHEME_GET_PROC(OpenThemeDataEx)
|
||||||
UXTHEME_GET_PROC(SetWindowTheme)
|
UXTHEME_GET_PROC(SetWindowTheme)
|
||||||
}
|
}
|
||||||
/* The following functions should be available, if not return FALSE. The Vista functions will
|
/* The following functions should be available, if not return FALSE. The Vista functions will
|
||||||
|
@ -71,7 +67,10 @@ static BOOL InitFunctionPtrs(void)
|
||||||
!pGetWindowTheme || !pIsAppThemed ||
|
!pGetWindowTheme || !pIsAppThemed ||
|
||||||
!pIsThemeActive || !pIsThemePartDefined ||
|
!pIsThemeActive || !pIsThemePartDefined ||
|
||||||
!pOpenThemeData || !pSetWindowTheme)
|
!pOpenThemeData || !pSetWindowTheme)
|
||||||
|
{
|
||||||
|
FreeLibrary(hUxtheme);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -336,6 +335,153 @@ static void test_OpenThemeData(void)
|
||||||
hWnd, GetLastError());
|
hWnd, GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
todo_wine
|
||||||
|
ok( GetLastError() == E_POINTER,
|
||||||
|
"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);
|
||||||
|
todo_wine
|
||||||
|
ok( GetLastError() == E_POINTER,
|
||||||
|
"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());
|
||||||
|
skip("No active theme, skipping rest of OpenThemeData tests\n");
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
static void test_GetCurrentThemeName(void)
|
static void test_GetCurrentThemeName(void)
|
||||||
{
|
{
|
||||||
BOOL bThemeActive;
|
BOOL bThemeActive;
|
||||||
|
@ -498,6 +644,10 @@ START_TEST(system)
|
||||||
trace("Starting test_OpenThemeData()\n");
|
trace("Starting test_OpenThemeData()\n");
|
||||||
test_OpenThemeData();
|
test_OpenThemeData();
|
||||||
|
|
||||||
|
/* OpenThemeDataEx */
|
||||||
|
trace("Starting test_OpenThemeDataEx()\n");
|
||||||
|
test_OpenThemeDataEx();
|
||||||
|
|
||||||
/* GetCurrentThemeName */
|
/* GetCurrentThemeName */
|
||||||
trace("Starting test_GetCurrentThemeName()\n");
|
trace("Starting test_GetCurrentThemeName()\n");
|
||||||
test_GetCurrentThemeName();
|
test_GetCurrentThemeName();
|
||||||
|
|
Loading…
Reference in New Issue