Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
bc4d22b3
Commit
bc4d22b3
authored
4 years ago
by
Zhiyi Zhang
Committed by
Alexandre Julliard
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Test that monitor handles are user32 handles.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2d0fefbc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
monitor.c
dlls/user32/tests/monitor.c
+81
-0
No files found.
dlls/user32/tests/monitor.c
View file @
bc4d22b3
...
...
@@ -1862,6 +1862,86 @@ static void test_display_config(void)
test_DisplayConfigGetDeviceInfo
();
}
static
BOOL
CALLBACK
test_handle_proc
(
HMONITOR
full_monitor
,
HDC
hdc
,
LPRECT
rect
,
LPARAM
lparam
)
{
MONITORINFO
monitor_info
=
{
sizeof
(
monitor_info
)};
HMONITOR
monitor
;
BOOL
ret
;
#ifdef _WIN64
if
((
ULONG_PTR
)
full_monitor
>>
32
)
monitor
=
full_monitor
;
else
monitor
=
(
HMONITOR
)((
ULONG_PTR
)
full_monitor
|
((
ULONG_PTR
)
~
0u
<<
32
));
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
ok
(
ret
,
"GetMonitorInfoW failed, error %#x.
\n
"
,
GetLastError
());
monitor
=
(
HMONITOR
)((
ULONG_PTR
)
full_monitor
&
0xffffffff
);
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
ok
(
ret
,
"GetMonitorInfoW failed, error %#x.
\n
"
,
GetLastError
());
monitor
=
(
HMONITOR
)(((
ULONG_PTR
)
full_monitor
&
0xffffffff
)
|
((
ULONG_PTR
)
0x1234
<<
32
));
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
ok
(
ret
,
"GetMonitorInfoW failed, error %#x.
\n
"
,
GetLastError
());
monitor
=
(
HMONITOR
)((
ULONG_PTR
)
full_monitor
&
0xffff
);
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
todo_wine
ok
(
!
ret
,
"GetMonitorInfoW succeeded.
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_MONITOR_HANDLE
,
"Expected error code %#x, got %#x.
\n
"
,
ERROR_INVALID_MONITOR_HANDLE
,
GetLastError
());
monitor
=
(
HMONITOR
)(((
ULONG_PTR
)
full_monitor
&
0xffff
)
|
((
ULONG_PTR
)
0x9876
<<
16
));
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
ok
(
!
ret
,
"GetMonitorInfoW succeeded.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MONITOR_HANDLE
,
"Expected error code %#x, got %#x.
\n
"
,
ERROR_INVALID_MONITOR_HANDLE
,
GetLastError
());
monitor
=
(
HMONITOR
)(((
ULONG_PTR
)
full_monitor
&
0xffff
)
|
((
ULONG_PTR
)
0x12345678
<<
16
));
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
ok
(
!
ret
,
"GetMonitorInfoW succeeded.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MONITOR_HANDLE
,
"Expected error code %#x, got %#x.
\n
"
,
ERROR_INVALID_MONITOR_HANDLE
,
GetLastError
());
#else
if
((
ULONG_PTR
)
full_monitor
>>
16
)
monitor
=
full_monitor
;
else
monitor
=
(
HMONITOR
)((
ULONG_PTR
)
full_monitor
|
((
ULONG_PTR
)
~
0u
<<
16
));
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
todo_wine_if
(((
ULONG_PTR
)
full_monitor
>>
16
)
==
0
)
ok
(
ret
,
"GetMonitorInfoW failed, error %#x.
\n
"
,
GetLastError
());
monitor
=
(
HMONITOR
)((
ULONG_PTR
)
full_monitor
&
0xffff
);
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
ok
(
ret
,
"GetMonitorInfoW failed, error %#x.
\n
"
,
GetLastError
());
monitor
=
(
HMONITOR
)(((
ULONG_PTR
)
full_monitor
&
0xffff
)
|
((
ULONG_PTR
)
0x1234
<<
16
));
SetLastError
(
0xdeadbeef
);
ret
=
GetMonitorInfoW
(
monitor
,
&
monitor_info
);
ok
(
!
ret
,
"GetMonitorInfoW succeeded.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_MONITOR_HANDLE
,
"Expected error code %#x, got %#x.
\n
"
,
ERROR_INVALID_MONITOR_HANDLE
,
GetLastError
());
#endif
return
TRUE
;
}
static
void
test_handles
(
void
)
{
BOOL
ret
;
/* Test that monitor handles are user32 handles */
ret
=
EnumDisplayMonitors
(
NULL
,
NULL
,
test_handle_proc
,
0
);
ok
(
ret
,
"EnumDisplayMonitors failed, error %#x.
\n
"
,
GetLastError
());
}
START_TEST
(
monitor
)
{
init_function_pointers
();
...
...
@@ -1871,4 +1951,5 @@ START_TEST(monitor)
test_monitors
();
test_work_area
();
test_display_config
();
test_handles
();
}
This diff is collapsed.
Click to expand it.
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