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
4fc651db
Commit
4fc651db
authored
Dec 03, 2019
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Dec 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Import functions if possible.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5cf64084
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
90 deletions
+36
-90
monitor.c
dlls/user32/tests/monitor.c
+36
-90
No files found.
dlls/user32/tests/monitor.c
View file @
4fc651db
...
@@ -27,15 +27,6 @@
...
@@ -27,15 +27,6 @@
#include <stdio.h>
#include <stdio.h>
static
HMODULE
hdll
;
static
HMODULE
hdll
;
static
LONG
(
WINAPI
*
pChangeDisplaySettingsExA
)(
LPCSTR
,
LPDEVMODEA
,
HWND
,
DWORD
,
LPVOID
);
static
LONG
(
WINAPI
*
pChangeDisplaySettingsExW
)(
LPCWSTR
,
LPDEVMODEW
,
HWND
,
DWORD
,
LPVOID
);
static
BOOL
(
WINAPI
*
pEnumDisplayDevicesA
)(
LPCSTR
,
DWORD
,
LPDISPLAY_DEVICEA
,
DWORD
);
static
BOOL
(
WINAPI
*
pEnumDisplayMonitors
)(
HDC
,
LPRECT
,
MONITORENUMPROC
,
LPARAM
);
static
BOOL
(
WINAPI
*
pGetMonitorInfoA
)(
HMONITOR
,
LPMONITORINFO
);
static
BOOL
(
WINAPI
*
pGetMonitorInfoW
)(
HMONITOR
,
LPMONITORINFO
);
static
HMONITOR
(
WINAPI
*
pMonitorFromPoint
)(
POINT
,
DWORD
);
static
HMONITOR
(
WINAPI
*
pMonitorFromRect
)(
LPCRECT
,
DWORD
);
static
HMONITOR
(
WINAPI
*
pMonitorFromWindow
)(
HWND
,
DWORD
);
static
LONG
(
WINAPI
*
pGetDisplayConfigBufferSizes
)(
UINT32
,
UINT32
*
,
UINT32
*
);
static
LONG
(
WINAPI
*
pGetDisplayConfigBufferSizes
)(
UINT32
,
UINT32
*
,
UINT32
*
);
static
void
init_function_pointers
(
void
)
static
void
init_function_pointers
(
void
)
...
@@ -47,16 +38,7 @@ static void init_function_pointers(void)
...
@@ -47,16 +38,7 @@ static void init_function_pointers(void)
if(!p ## func) \
if(!p ## func) \
trace("GetProcAddress(%s) failed\n", #func);
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC
(
ChangeDisplaySettingsExA
)
GET_PROC
(
ChangeDisplaySettingsExW
)
GET_PROC
(
EnumDisplayDevicesA
)
GET_PROC
(
EnumDisplayMonitors
)
GET_PROC
(
GetDisplayConfigBufferSizes
)
GET_PROC
(
GetDisplayConfigBufferSizes
)
GET_PROC
(
GetMonitorInfoA
)
GET_PROC
(
GetMonitorInfoW
)
GET_PROC
(
MonitorFromPoint
)
GET_PROC
(
MonitorFromRect
)
GET_PROC
(
MonitorFromWindow
)
#undef GET_PROC
#undef GET_PROC
}
}
...
@@ -69,7 +51,7 @@ static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc,
...
@@ -69,7 +51,7 @@ static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc,
mi
.
cbSize
=
sizeof
(
mi
);
mi
.
cbSize
=
sizeof
(
mi
);
ok
(
p
GetMonitorInfoA
(
hmon
,
(
MONITORINFO
*
)
&
mi
),
"GetMonitorInfo failed
\n
"
);
ok
(
GetMonitorInfoA
(
hmon
,
(
MONITORINFO
*
)
&
mi
),
"GetMonitorInfo failed
\n
"
);
if
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
)
if
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
)
strcpy
(
primary
,
mi
.
szDevice
);
strcpy
(
primary
,
mi
.
szDevice
);
...
@@ -203,20 +185,14 @@ static void test_enumdisplaydevices(void)
...
@@ -203,20 +185,14 @@ static void test_enumdisplaydevices(void)
int
monitor_index
;
int
monitor_index
;
BOOL
ret
;
BOOL
ret
;
if
(
!
pEnumDisplayDevicesA
)
{
win_skip
(
"EnumDisplayDevicesA is not available
\n
"
);
return
;
}
/* Doesn't accept \\.\DISPLAY */
/* Doesn't accept \\.\DISPLAY */
dd
.
cb
=
sizeof
(
dd
);
dd
.
cb
=
sizeof
(
dd
);
ret
=
p
EnumDisplayDevicesA
(
"
\\\\
.
\\
DISPLAY"
,
0
,
&
dd
,
0
);
ret
=
EnumDisplayDevicesA
(
"
\\\\
.
\\
DISPLAY"
,
0
,
&
dd
,
0
);
ok
(
!
ret
,
"Expect failure
\n
"
);
ok
(
!
ret
,
"Expect failure
\n
"
);
/* Enumeration */
/* Enumeration */
for
(
flag_index
=
0
;
flag_index
<
ARRAY_SIZE
(
flags
);
flag_index
++
)
for
(
flag_index
=
0
;
flag_index
<
ARRAY_SIZE
(
flags
);
flag_index
++
)
for
(
adapter_index
=
0
;
p
EnumDisplayDevicesA
(
NULL
,
adapter_index
,
&
dd
,
flags
[
flag_index
]);
adapter_index
++
)
for
(
adapter_index
=
0
;
EnumDisplayDevicesA
(
NULL
,
adapter_index
,
&
dd
,
flags
[
flag_index
]);
adapter_index
++
)
{
{
lstrcpyA
(
adapter_name
,
dd
.
DeviceName
);
lstrcpyA
(
adapter_name
,
dd
.
DeviceName
);
...
@@ -228,7 +204,7 @@ static void test_enumdisplaydevices(void)
...
@@ -228,7 +204,7 @@ static void test_enumdisplaydevices(void)
test_enumdisplaydevices_adapter
(
adapter_index
,
&
dd
,
flags
[
flag_index
]);
test_enumdisplaydevices_adapter
(
adapter_index
,
&
dd
,
flags
[
flag_index
]);
for
(
monitor_index
=
0
;
p
EnumDisplayDevicesA
(
adapter_name
,
monitor_index
,
&
dd
,
flags
[
flag_index
]);
for
(
monitor_index
=
0
;
EnumDisplayDevicesA
(
adapter_name
,
monitor_index
,
&
dd
,
flags
[
flag_index
]);
monitor_index
++
)
monitor_index
++
)
test_enumdisplaydevices_monitor
(
adapter_index
,
monitor_index
,
adapter_name
,
&
dd
,
flags
[
flag_index
]);
test_enumdisplaydevices_monitor
(
adapter_index
,
monitor_index
,
adapter_name
,
&
dd
,
flags
[
flag_index
]);
}
}
...
@@ -237,18 +213,12 @@ static void test_enumdisplaydevices(void)
...
@@ -237,18 +213,12 @@ static void test_enumdisplaydevices(void)
/* XP on Testbot doesn't report a monitor, whereas XP on real machine does */
/* XP on Testbot doesn't report a monitor, whereas XP on real machine does */
ok
(
broken
(
monitor_count
==
0
)
||
monitor_count
>
0
,
"Expect at least one monitor found
\n
"
);
ok
(
broken
(
monitor_count
==
0
)
||
monitor_count
>
0
,
"Expect at least one monitor found
\n
"
);
if
(
!
pEnumDisplayMonitors
||
!
pGetMonitorInfoA
)
ret
=
EnumDisplayDevicesA
(
NULL
,
0
,
&
dd
,
0
);
{
win_skip
(
"EnumDisplayMonitors or GetMonitorInfoA are not available
\n
"
);
return
;
}
ret
=
pEnumDisplayDevicesA
(
NULL
,
0
,
&
dd
,
0
);
ok
(
ret
,
"Expect success
\n
"
);
ok
(
ret
,
"Expect success
\n
"
);
lstrcpyA
(
primary_device_name
,
dd
.
DeviceName
);
lstrcpyA
(
primary_device_name
,
dd
.
DeviceName
);
primary_monitor_device_name
[
0
]
=
0
;
primary_monitor_device_name
[
0
]
=
0
;
ret
=
p
EnumDisplayMonitors
(
NULL
,
NULL
,
monitor_enum_proc
,
(
LPARAM
)
primary_monitor_device_name
);
ret
=
EnumDisplayMonitors
(
NULL
,
NULL
,
monitor_enum_proc
,
(
LPARAM
)
primary_monitor_device_name
);
ok
(
ret
,
"EnumDisplayMonitors failed
\n
"
);
ok
(
ret
,
"EnumDisplayMonitors failed
\n
"
);
ok
(
!
strcmp
(
primary_monitor_device_name
,
primary_device_name
),
ok
(
!
strcmp
(
primary_monitor_device_name
,
primary_device_name
),
"monitor device name %s, device name %s
\n
"
,
primary_monitor_device_name
,
"monitor device name %s, device name %s
\n
"
,
primary_monitor_device_name
,
...
@@ -290,12 +260,6 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -290,12 +260,6 @@ static void test_ChangeDisplaySettingsEx(void)
LONG
res
;
LONG
res
;
int
i
;
int
i
;
if
(
!
pChangeDisplaySettingsExA
)
{
win_skip
(
"ChangeDisplaySettingsExA is not available
\n
"
);
return
;
}
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
EnumDisplaySettingsA
(
NULL
,
ENUM_CURRENT_SETTINGS
,
&
dm
);
res
=
EnumDisplaySettingsA
(
NULL
,
ENUM_CURRENT_SETTINGS
,
&
dm
);
ok
(
res
,
"EnumDisplaySettings error %u
\n
"
,
GetLastError
());
ok
(
res
,
"EnumDisplaySettings error %u
\n
"
,
GetLastError
());
...
@@ -311,7 +275,7 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -311,7 +275,7 @@ static void test_ChangeDisplaySettingsEx(void)
/* crashes under XP SP3 for large dmDriverExtra values */
/* crashes under XP SP3 for large dmDriverExtra values */
dm
.
dmDriverExtra
=
1
;
dm
.
dmDriverExtra
=
1
;
res
=
p
ChangeDisplaySettingsExA
(
NULL
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
res
=
ChangeDisplaySettingsExA
(
NULL
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
,
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
,
"ChangeDisplaySettingsExW returned %d, expected DISP_CHANGE_SUCCESSFUL
\n
"
,
res
);
"ChangeDisplaySettingsExW returned %d, expected DISP_CHANGE_SUCCESSFUL
\n
"
,
res
);
ok
(
dm
.
dmDriverExtra
==
1
,
"ChangeDisplaySettingsExA shouldn't reset dmDriverExtra to 0
\n
"
);
ok
(
dm
.
dmDriverExtra
==
1
,
"ChangeDisplaySettingsExA shouldn't reset dmDriverExtra to 0
\n
"
);
...
@@ -333,7 +297,7 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -333,7 +297,7 @@ static void test_ChangeDisplaySettingsEx(void)
/* Apparently XP treats dmDriverExtra being != 0 as an error */
/* Apparently XP treats dmDriverExtra being != 0 as an error */
dmW
.
dmDriverExtra
=
1
;
dmW
.
dmDriverExtra
=
1
;
res
=
p
ChangeDisplaySettingsExW
(
NULL
,
&
dmW
,
NULL
,
CDS_TEST
,
NULL
);
res
=
ChangeDisplaySettingsExW
(
NULL
,
&
dmW
,
NULL
,
CDS_TEST
,
NULL
);
if
(
GetLastError
()
!=
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
GetLastError
()
!=
ERROR_CALL_NOT_IMPLEMENTED
)
{
{
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
,
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
,
...
@@ -347,7 +311,7 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -347,7 +311,7 @@ static void test_ChangeDisplaySettingsEx(void)
memset
(
&
dm
,
0
,
sizeof
(
dm
));
memset
(
&
dm
,
0
,
sizeof
(
dm
));
dm
.
dmFields
=
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
dm
.
dmFields
=
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
dm
.
dmPelsWidth
=
width
;
dm
.
dmPelsWidth
=
width
;
res
=
p
ChangeDisplaySettingsExA
(
NULL
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
res
=
ChangeDisplaySettingsExA
(
NULL
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
||
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
||
res
==
DISP_CHANGE_BADMODE
||
/* Win98, WinMe */
res
==
DISP_CHANGE_BADMODE
||
/* Win98, WinMe */
res
==
DISP_CHANGE_FAILED
,
/* NT4 */
res
==
DISP_CHANGE_FAILED
,
/* NT4 */
...
@@ -357,7 +321,7 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -357,7 +321,7 @@ static void test_ChangeDisplaySettingsEx(void)
dmW
.
dmFields
=
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
dmW
.
dmFields
=
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
dmW
.
dmPelsWidth
=
width
;
dmW
.
dmPelsWidth
=
width
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
res
=
p
ChangeDisplaySettingsExW
(
NULL
,
&
dmW
,
NULL
,
CDS_TEST
,
NULL
);
res
=
ChangeDisplaySettingsExW
(
NULL
,
&
dmW
,
NULL
,
CDS_TEST
,
NULL
);
if
(
GetLastError
()
!=
ERROR_CALL_NOT_IMPLEMENTED
)
if
(
GetLastError
()
!=
ERROR_CALL_NOT_IMPLEMENTED
)
ok
(
res
==
DISP_CHANGE_FAILED
||
ok
(
res
==
DISP_CHANGE_FAILED
||
res
==
DISP_CHANGE_BADPARAM
||
/* NT4 */
res
==
DISP_CHANGE_BADPARAM
||
/* NT4 */
...
@@ -374,7 +338,7 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -374,7 +338,7 @@ static void test_ChangeDisplaySettingsEx(void)
dm
.
dmBitsPerPel
=
vid_modes_test
[
i
].
bpp
;
dm
.
dmBitsPerPel
=
vid_modes_test
[
i
].
bpp
;
dm
.
dmDisplayFrequency
=
vid_modes_test
[
i
].
freq
;
dm
.
dmDisplayFrequency
=
vid_modes_test
[
i
].
freq
;
dm
.
dmFields
=
vid_modes_test
[
i
].
fields
;
dm
.
dmFields
=
vid_modes_test
[
i
].
fields
;
res
=
p
ChangeDisplaySettingsExA
(
NULL
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
res
=
ChangeDisplaySettingsExA
(
NULL
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
ok
(
vid_modes_test
[
i
].
must_succeed
?
ok
(
vid_modes_test
[
i
].
must_succeed
?
(
res
==
DISP_CHANGE_SUCCESSFUL
||
res
==
DISP_CHANGE_RESTART
)
:
(
res
==
DISP_CHANGE_SUCCESSFUL
||
res
==
DISP_CHANGE_RESTART
)
:
(
res
==
DISP_CHANGE_SUCCESSFUL
||
res
==
DISP_CHANGE_RESTART
||
(
res
==
DISP_CHANGE_SUCCESSFUL
||
res
==
DISP_CHANGE_RESTART
||
...
@@ -420,7 +384,7 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -420,7 +384,7 @@ static void test_ChangeDisplaySettingsEx(void)
ClipCursor
(
&
virt
);
ClipCursor
(
&
virt
);
}
}
}
}
res
=
p
ChangeDisplaySettingsExA
(
NULL
,
NULL
,
NULL
,
CDS_RESET
,
NULL
);
res
=
ChangeDisplaySettingsExA
(
NULL
,
NULL
,
NULL
,
CDS_RESET
,
NULL
);
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
,
"Failed to reset default resolution: %d
\n
"
,
res
);
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
,
"Failed to reset default resolution: %d
\n
"
,
res
);
}
}
...
@@ -464,76 +428,64 @@ static void test_monitors(void)
...
@@ -464,76 +428,64 @@ static void test_monitors(void)
{
0xdeadbeef
,
FALSE
},
{
0xdeadbeef
,
FALSE
},
};
};
if
(
!
pMonitorFromPoint
||
!
pMonitorFromWindow
||
!
pMonitorFromRect
)
{
win_skip
(
"MonitorFromPoint, MonitorFromWindow, or MonitorFromRect is not available
\n
"
);
return
;
}
pt
.
x
=
pt
.
y
=
0
;
pt
.
x
=
pt
.
y
=
0
;
primary
=
p
MonitorFromPoint
(
pt
,
MONITOR_DEFAULTTOPRIMARY
);
primary
=
MonitorFromPoint
(
pt
,
MONITOR_DEFAULTTOPRIMARY
);
ok
(
primary
!=
0
,
"couldn't get primary monitor
\n
"
);
ok
(
primary
!=
0
,
"couldn't get primary monitor
\n
"
);
monitor
=
p
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTONULL
);
ok
(
!
monitor
,
"got %p, should not get a monitor for an invalid window
\n
"
,
monitor
);
ok
(
!
monitor
,
"got %p, should not get a monitor for an invalid window
\n
"
,
monitor
);
monitor
=
p
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTOPRIMARY
);
monitor
=
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTOPRIMARY
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p for MONITOR_DEFAULTTOPRIMARY
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p for MONITOR_DEFAULTTOPRIMARY
\n
"
,
monitor
,
primary
);
monitor
=
p
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTONEAREST
);
monitor
=
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTONEAREST
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p for MONITOR_DEFAULTTONEAREST
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p for MONITOR_DEFAULTTONEAREST
\n
"
,
monitor
,
primary
);
SetRect
(
&
rc
,
0
,
0
,
1
,
1
);
SetRect
(
&
rc
,
0
,
0
,
1
,
1
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTOPRIMARY
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTOPRIMARY
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONEAREST
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONEAREST
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
/* Empty rect at 0,0 is considered inside the primary monitor */
/* Empty rect at 0,0 is considered inside the primary monitor */
SetRect
(
&
rc
,
0
,
0
,
-
1
,
-
1
);
SetRect
(
&
rc
,
0
,
0
,
-
1
,
-
1
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
/* Even if there is a monitor left of the primary, the primary will have the most overlapping area */
/* Even if there is a monitor left of the primary, the primary will have the most overlapping area */
SetRect
(
&
rc
,
-
1
,
0
,
2
,
1
);
SetRect
(
&
rc
,
-
1
,
0
,
2
,
1
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
/* But the width of the rect doesn't matter if it's empty. */
/* But the width of the rect doesn't matter if it's empty. */
SetRect
(
&
rc
,
-
1
,
0
,
2
,
-
1
);
SetRect
(
&
rc
,
-
1
,
0
,
2
,
-
1
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
ok
(
monitor
!=
primary
,
"got primary %p
\n
"
,
monitor
);
ok
(
monitor
!=
primary
,
"got primary %p
\n
"
,
monitor
);
if
(
!
pGetMonitorInfoA
)
{
win_skip
(
"GetMonitorInfoA is not available
\n
"
);
return
;
}
/* Search for a monitor that has no others equally near to (left, top-1) */
/* Search for a monitor that has no others equally near to (left, top-1) */
SetRect
(
&
rc
,
-
1
,
-
2
,
2
,
0
);
SetRect
(
&
rc
,
-
1
,
-
2
,
2
,
0
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
nearest
=
primary
;
nearest
=
primary
;
while
(
monitor
!=
NULL
)
while
(
monitor
!=
NULL
)
{
{
ok
(
monitor
!=
primary
,
"got primary %p
\n
"
,
monitor
);
ok
(
monitor
!=
primary
,
"got primary %p
\n
"
,
monitor
);
nearest
=
monitor
;
nearest
=
monitor
;
mi
.
cbSize
=
sizeof
(
mi
);
mi
.
cbSize
=
sizeof
(
mi
);
ret
=
p
GetMonitorInfoA
(
monitor
,
&
mi
);
ret
=
GetMonitorInfoA
(
monitor
,
&
mi
);
ok
(
ret
,
"GetMonitorInfo failed
\n
"
);
ok
(
ret
,
"GetMonitorInfo failed
\n
"
);
SetRect
(
&
rc
,
mi
.
rcMonitor
.
left
-
1
,
mi
.
rcMonitor
.
top
-
2
,
mi
.
rcMonitor
.
left
+
2
,
mi
.
rcMonitor
.
top
);
SetRect
(
&
rc
,
mi
.
rcMonitor
.
left
-
1
,
mi
.
rcMonitor
.
top
-
2
,
mi
.
rcMonitor
.
left
+
2
,
mi
.
rcMonitor
.
top
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
}
}
/* tests for cbSize in MONITORINFO */
/* tests for cbSize in MONITORINFO */
monitor
=
p
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTOPRIMARY
);
monitor
=
MonitorFromWindow
(
0
,
MONITOR_DEFAULTTOPRIMARY
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
testdatami
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
testdatami
);
i
++
)
{
{
memset
(
&
mi
,
0
,
sizeof
(
mi
)
);
memset
(
&
mi
,
0
,
sizeof
(
mi
)
);
mi
.
cbSize
=
testdatami
[
i
].
cbSize
;
mi
.
cbSize
=
testdatami
[
i
].
cbSize
;
ret
=
p
GetMonitorInfoA
(
monitor
,
&
mi
);
ret
=
GetMonitorInfoA
(
monitor
,
&
mi
);
ok
(
ret
==
testdatami
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
ok
(
ret
==
testdatami
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
if
(
ret
)
if
(
ret
)
ok
(
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
ok
(
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
...
@@ -542,7 +494,7 @@ static void test_monitors(void)
...
@@ -542,7 +494,7 @@ static void test_monitors(void)
memset
(
&
miexw
,
0
,
sizeof
(
miexw
)
);
memset
(
&
miexw
,
0
,
sizeof
(
miexw
)
);
miexw
.
cbSize
=
testdatamiexw
[
i
].
cbSize
;
miexw
.
cbSize
=
testdatamiexw
[
i
].
cbSize
;
ret
=
p
GetMonitorInfoW
(
monitor
,
(
LPMONITORINFO
)
&
miexw
);
ret
=
GetMonitorInfoW
(
monitor
,
(
LPMONITORINFO
)
&
miexw
);
ok
(
ret
==
testdatamiexw
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
ok
(
ret
==
testdatamiexw
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
if
(
ret
)
if
(
ret
)
ok
(
(
miexw
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
ok
(
(
miexw
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
...
@@ -555,7 +507,7 @@ static void test_monitors(void)
...
@@ -555,7 +507,7 @@ static void test_monitors(void)
{
{
memset
(
&
miexa
,
0
,
sizeof
(
miexa
)
);
memset
(
&
miexa
,
0
,
sizeof
(
miexa
)
);
miexa
.
cbSize
=
testdatamiexa
[
i
].
cbSize
;
miexa
.
cbSize
=
testdatamiexa
[
i
].
cbSize
;
ret
=
p
GetMonitorInfoA
(
monitor
,
(
LPMONITORINFO
)
&
miexa
);
ret
=
GetMonitorInfoA
(
monitor
,
(
LPMONITORINFO
)
&
miexa
);
ok
(
ret
==
testdatamiexa
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
ok
(
ret
==
testdatamiexa
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
if
(
ret
)
if
(
ret
)
ok
(
(
miexa
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
ok
(
(
miexa
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
...
@@ -568,7 +520,7 @@ static void test_monitors(void)
...
@@ -568,7 +520,7 @@ static void test_monitors(void)
{
{
memset
(
&
miexw
,
0
,
sizeof
(
miexw
)
);
memset
(
&
miexw
,
0
,
sizeof
(
miexw
)
);
miexw
.
cbSize
=
testdatamiexw
[
i
].
cbSize
;
miexw
.
cbSize
=
testdatamiexw
[
i
].
cbSize
;
ret
=
p
GetMonitorInfoW
(
monitor
,
(
LPMONITORINFO
)
&
miexw
);
ret
=
GetMonitorInfoW
(
monitor
,
(
LPMONITORINFO
)
&
miexw
);
ok
(
ret
==
testdatamiexw
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
ok
(
ret
==
testdatamiexw
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
if
(
ret
)
if
(
ret
)
ok
(
(
miexw
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
ok
(
(
miexw
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
...
@@ -578,13 +530,13 @@ static void test_monitors(void)
...
@@ -578,13 +530,13 @@ static void test_monitors(void)
SetRect
(
&
rc
,
rc
.
left
+
1
,
rc
.
top
+
1
,
rc
.
left
+
2
,
rc
.
top
+
2
);
SetRect
(
&
rc
,
rc
.
left
+
1
,
rc
.
top
+
1
,
rc
.
left
+
2
,
rc
.
top
+
2
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
ok
(
monitor
==
NULL
,
"got %p
\n
"
,
monitor
);
ok
(
monitor
==
NULL
,
"got %p
\n
"
,
monitor
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTOPRIMARY
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTOPRIMARY
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
ok
(
monitor
==
primary
,
"got %p, should get primary %p
\n
"
,
monitor
,
primary
);
monitor
=
p
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONEAREST
);
monitor
=
MonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONEAREST
);
ok
(
monitor
==
nearest
,
"got %p, should get nearest %p
\n
"
,
monitor
,
nearest
);
ok
(
monitor
==
nearest
,
"got %p, should get nearest %p
\n
"
,
monitor
,
nearest
);
}
}
...
@@ -594,7 +546,7 @@ static BOOL CALLBACK find_primary_mon(HMONITOR hmon, HDC hdc, LPRECT rc, LPARAM
...
@@ -594,7 +546,7 @@ static BOOL CALLBACK find_primary_mon(HMONITOR hmon, HDC hdc, LPRECT rc, LPARAM
BOOL
ret
;
BOOL
ret
;
mi
.
cbSize
=
sizeof
(
mi
);
mi
.
cbSize
=
sizeof
(
mi
);
ret
=
p
GetMonitorInfoA
(
hmon
,
&
mi
);
ret
=
GetMonitorInfoA
(
hmon
,
&
mi
);
ok
(
ret
,
"GetMonitorInfo failed
\n
"
);
ok
(
ret
,
"GetMonitorInfo failed
\n
"
);
if
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
)
if
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
)
{
{
...
@@ -613,19 +565,13 @@ static void test_work_area(void)
...
@@ -613,19 +565,13 @@ static void test_work_area(void)
WINDOWPLACEMENT
wp
;
WINDOWPLACEMENT
wp
;
BOOL
ret
;
BOOL
ret
;
if
(
!
pEnumDisplayMonitors
||
!
pGetMonitorInfoA
)
{
win_skip
(
"EnumDisplayMonitors or GetMonitorInfoA are not available
\n
"
);
return
;
}
hmon
=
0
;
hmon
=
0
;
ret
=
p
EnumDisplayMonitors
(
NULL
,
NULL
,
find_primary_mon
,
(
LPARAM
)
&
hmon
);
ret
=
EnumDisplayMonitors
(
NULL
,
NULL
,
find_primary_mon
,
(
LPARAM
)
&
hmon
);
ok
(
!
ret
&&
hmon
!=
0
,
"Failed to find primary monitor
\n
"
);
ok
(
!
ret
&&
hmon
!=
0
,
"Failed to find primary monitor
\n
"
);
mi
.
cbSize
=
sizeof
(
mi
);
mi
.
cbSize
=
sizeof
(
mi
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
p
GetMonitorInfoA
(
hmon
,
&
mi
);
ret
=
GetMonitorInfoA
(
hmon
,
&
mi
);
ok
(
ret
,
"GetMonitorInfo error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"GetMonitorInfo error %u
\n
"
,
GetLastError
());
ok
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
,
"not a primary monitor
\n
"
);
ok
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
,
"not a primary monitor
\n
"
);
trace
(
"primary monitor %s
\n
"
,
wine_dbgstr_rect
(
&
mi
.
rcMonitor
));
trace
(
"primary monitor %s
\n
"
,
wine_dbgstr_rect
(
&
mi
.
rcMonitor
));
...
...
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