Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d69c1bef
Commit
d69c1bef
authored
Mar 23, 2011
by
André Hentschel
Committed by
Alexandre Julliard
Mar 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uxtheme/tests: Add tests for OpenThemeDataEx.
parent
0304a3e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
157 additions
and
7 deletions
+157
-7
system.c
dlls/uxtheme/tests/system.c
+157
-7
No files found.
dlls/uxtheme/tests/system.c
View file @
d69c1bef
...
...
@@ -33,17 +33,12 @@ static BOOL (WINAPI * pIsAppThemed)(VOID);
static
BOOL
(
WINAPI
*
pIsThemeActive
)(
VOID
);
static
BOOL
(
WINAPI
*
pIsThemePartDefined
)(
HTHEME
,
int
,
int
);
static
HTHEME
(
WINAPI
*
pOpenThemeData
)(
HWND
,
LPCWSTR
);
static
HTHEME
(
WINAPI
*
pOpenThemeDataEx
)(
HWND
,
LPCWSTR
,
DWORD
);
static
HRESULT
(
WINAPI
*
pSetWindowTheme
)(
HWND
,
LPCWSTR
,
LPCWSTR
);
static
HMODULE
hUxtheme
=
0
;
#define UXTHEME_GET_PROC(func) \
p ## func = (void*)GetProcAddress(hUxtheme, #func); \
if(!p ## func) { \
trace("GetProcAddress(%s) failed\n", #func); \
FreeLibrary(hUxtheme); \
return FALSE; \
}
#define UXTHEME_GET_PROC(func) p ## func = (void*)GetProcAddress(hUxtheme, #func);
static
BOOL
InitFunctionPtrs
(
void
)
{
...
...
@@ -61,6 +56,7 @@ static BOOL InitFunctionPtrs(void)
UXTHEME_GET_PROC
(
IsThemeActive
)
UXTHEME_GET_PROC
(
IsThemePartDefined
)
UXTHEME_GET_PROC
(
OpenThemeData
)
UXTHEME_GET_PROC
(
OpenThemeDataEx
)
UXTHEME_GET_PROC
(
SetWindowTheme
)
}
/* The following functions should be available, if not return FALSE. The Vista functions will
...
...
@@ -71,7 +67,10 @@ static BOOL InitFunctionPtrs(void)
!
pGetWindowTheme
||
!
pIsAppThemed
||
!
pIsThemeActive
||
!
pIsThemePartDefined
||
!
pOpenThemeData
||
!
pSetWindowTheme
)
{
FreeLibrary
(
hUxtheme
);
return
FALSE
;
}
return
TRUE
;
}
...
...
@@ -336,6 +335,153 @@ static void test_OpenThemeData(void)
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
)
{
BOOL
bThemeActive
;
...
...
@@ -498,6 +644,10 @@ START_TEST(system)
trace
(
"Starting test_OpenThemeData()
\n
"
);
test_OpenThemeData
();
/* OpenThemeDataEx */
trace
(
"Starting test_OpenThemeDataEx()
\n
"
);
test_OpenThemeDataEx
();
/* GetCurrentThemeName */
trace
(
"Starting test_GetCurrentThemeName()
\n
"
);
test_GetCurrentThemeName
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment