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
59007aae
Commit
59007aae
authored
Nov 02, 2021
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Nov 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uxtheme/tests: Add GetThemeTransitionDuration() tests.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
36ed40e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
154 additions
and
0 deletions
+154
-0
system.c
dlls/uxtheme/tests/system.c
+154
-0
No files found.
dlls/uxtheme/tests/system.c
View file @
59007aae
...
...
@@ -43,6 +43,7 @@ static HDC (WINAPI *pGetBufferedPaintDC)(HPAINTBUFFER);
static
HDC
(
WINAPI
*
pGetBufferedPaintTargetDC
)(
HPAINTBUFFER
);
static
HRESULT
(
WINAPI
*
pGetBufferedPaintTargetRect
)(
HPAINTBUFFER
,
RECT
*
);
static
HRESULT
(
WINAPI
*
pGetThemeIntList
)(
HTHEME
,
int
,
int
,
int
,
INTLIST
*
);
static
HRESULT
(
WINAPI
*
pGetThemeTransitionDuration
)(
HTHEME
,
int
,
int
,
int
,
int
,
DWORD
*
);
static
LONG
(
WINAPI
*
pDisplayConfigGetDeviceInfo
)(
DISPLAYCONFIG_DEVICE_INFO_HEADER
*
);
static
LONG
(
WINAPI
*
pDisplayConfigSetDeviceInfo
)(
DISPLAYCONFIG_DEVICE_INFO_HEADER
*
);
...
...
@@ -81,6 +82,7 @@ static void init_funcs(void)
GET_PROC
(
uxtheme
,
GetBufferedPaintTargetDC
)
GET_PROC
(
uxtheme
,
GetBufferedPaintTargetRect
)
GET_PROC
(
uxtheme
,
GetThemeIntList
)
GET_PROC
(
uxtheme
,
GetThemeTransitionDuration
)
GET_PROC
(
uxtheme
,
OpenThemeDataEx
)
GET_PROC
(
uxtheme
,
OpenThemeDataForDpi
)
...
...
@@ -1299,6 +1301,157 @@ static void test_GetThemeIntList(void)
DestroyWindow
(
hwnd
);
}
static
void
test_GetThemeTransitionDuration
(
void
)
{
int
from_state
,
to_state
,
expected
;
INTLIST
intlist
;
DWORD
duration
;
HTHEME
theme
;
HRESULT
hr
;
HWND
hwnd
;
if
(
!
pGetThemeTransitionDuration
||
!
pGetThemeIntList
)
{
win_skip
(
"GetThemeTransitionDuration or GetThemeIntList is unavailable.
\n
"
);
return
;
}
hwnd
=
CreateWindowA
(
"static"
,
""
,
WS_POPUP
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
NULL
);
theme
=
OpenThemeData
(
hwnd
,
L"Button"
);
if
(
!
theme
)
{
skip
(
"Theming is not active.
\n
"
);
DestroyWindow
(
hwnd
);
return
;
}
/* Invalid parameter tests */
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
NULL
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
PBS_DEFAULTED_ANIMATING
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_HANDLE
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
ok
(
duration
==
0xdeadbeef
,
"Expected duration %#x, got %#x.
\n
"
,
0xdeadbeef
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
((
HTHEME
)
0xdeadbeef
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
PBS_DEFAULTED_ANIMATING
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_HANDLE
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
ok
(
duration
==
0xdeadbeef
,
"Expected duration %#x, got %#x.
\n
"
,
0xdeadbeef
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
0xdeadbeef
,
PBS_NORMAL
,
PBS_DEFAULTED_ANIMATING
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_PROP_ID_UNSUPPORTED
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
duration
==
0
,
"Expected duration %#x, got %#x.
\n
"
,
0
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
PBS_NORMAL
-
1
,
PBS_DEFAULTED_ANIMATING
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
ok
(
duration
==
0xdeadbeef
,
"Expected duration %#x, got %#x.
\n
"
,
0xdeadbeef
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
PBS_DEFAULTED_ANIMATING
+
1
,
PBS_DEFAULTED_ANIMATING
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
duration
==
0
,
"Expected duration %#x, got %#x.
\n
"
,
0
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
PBS_NORMAL
-
1
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
ok
(
duration
==
0xdeadbeef
,
"Expected duration %#x, got %#x.
\n
"
,
0xdeadbeef
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
PBS_DEFAULTED_ANIMATING
+
1
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
duration
==
0
,
"Expected duration %#x, got %#x.
\n
"
,
0
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
PBS_DEFAULTED_ANIMATING
,
TMT_BACKGROUND
,
&
duration
);
todo_wine
ok
(
hr
==
E_PROP_ID_UNSUPPORTED
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
duration
==
0
,
"Expected duration %#x, got %#x.
\n
"
,
0
,
duration
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
PBS_DEFAULTED_ANIMATING
,
0xdeadbeef
,
&
duration
);
todo_wine
ok
(
hr
==
E_PROP_ID_UNSUPPORTED
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
duration
==
0
,
"Expected duration %#x, got %#x.
\n
"
,
0
,
duration
);
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
PBS_DEFAULTED_ANIMATING
,
TMT_TRANSITIONDURATIONS
,
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
/* Parts that don't have TMT_TRANSITIONDURATIONS */
hr
=
GetThemeIntList
(
theme
,
BP_GROUPBOX
,
GBS_NORMAL
,
TMT_TRANSITIONDURATIONS
,
&
intlist
);
ok
(
hr
==
E_PROP_ID_UNSUPPORTED
,
"GetThemeIntList failed, hr %#x.
\n
"
,
hr
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_GROUPBOX
,
GBS_NORMAL
,
GBS_DISABLED
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
E_PROP_ID_UNSUPPORTED
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
duration
==
0
,
"Expected duration %#x, got %#x.
\n
"
,
0
,
duration
);
/* Test parsing TMT_TRANSITIONDURATIONS property. TMT_TRANSITIONDURATIONS is a vista+ property */
if
(
LOBYTE
(
LOWORD
(
GetVersion
()))
<
6
)
goto
done
;
hr
=
pGetThemeIntList
(
theme
,
BP_PUSHBUTTON
,
PBS_NORMAL
,
TMT_TRANSITIONDURATIONS
,
&
intlist
);
ok
(
hr
==
S_OK
,
"GetThemeIntList failed, hr %#x.
\n
"
,
hr
);
/* The first value is the theme part state count. The following are the values from every state
* to every state. So the total value count should be 1 + state ^ 2 */
expected
=
PBS_DEFAULTED_ANIMATING
-
PBS_NORMAL
+
1
;
ok
(
intlist
.
iValues
[
0
]
==
expected
,
"Expected the first value %d, got %d.
\n
"
,
expected
,
intlist
.
iValues
[
0
]);
expected
=
1
+
intlist
.
iValues
[
0
]
*
intlist
.
iValues
[
0
];
ok
(
intlist
.
iValueCount
==
expected
,
"Expected value count %d, got %d.
\n
"
,
expected
,
intlist
.
iValueCount
);
if
(
hr
==
S_OK
)
{
for
(
from_state
=
PBS_NORMAL
;
from_state
<=
PBS_DEFAULTED_ANIMATING
;
++
from_state
)
{
for
(
to_state
=
PBS_NORMAL
;
to_state
<=
PBS_DEFAULTED_ANIMATING
;
++
to_state
)
{
winetest_push_context
(
"from state %d to %d"
,
from_state
,
to_state
);
duration
=
0xdeadbeef
;
hr
=
pGetThemeTransitionDuration
(
theme
,
BP_PUSHBUTTON
,
from_state
,
to_state
,
TMT_TRANSITIONDURATIONS
,
&
duration
);
todo_wine
ok
(
hr
==
S_OK
,
"GetThemeTransitionDuration failed, hr %#x.
\n
"
,
hr
);
expected
=
intlist
.
iValues
[
1
+
intlist
.
iValues
[
0
]
*
(
from_state
-
1
)
+
(
to_state
-
1
)];
todo_wine
ok
(
duration
==
expected
,
"Expected duration %d, got %d.
\n
"
,
expected
,
duration
);
winetest_pop_context
();
}
}
}
done:
CloseThemeData
(
theme
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
system
)
{
init_funcs
();
...
...
@@ -1319,6 +1472,7 @@ START_TEST(system)
test_CloseThemeData
();
test_buffered_paint
();
test_GetThemeIntList
();
test_GetThemeTransitionDuration
();
/* Test EnableTheming() in the end because it may disable theming */
test_EnableTheming
();
...
...
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