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
98146e1b
Commit
98146e1b
authored
Aug 22, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add tests for desktop size and DPI scaling.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
83e481fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
2 deletions
+46
-2
sysparams.c
dlls/user32/tests/sysparams.c
+46
-2
No files found.
dlls/user32/tests/sysparams.c
View file @
98146e1b
...
@@ -3193,11 +3193,14 @@ static void scale_rect_dpi( RECT *rect, UINT src_dpi, UINT target_dpi )
...
@@ -3193,11 +3193,14 @@ static void scale_rect_dpi( RECT *rect, UINT src_dpi, UINT target_dpi )
static
void
test_dpi_mapping
(
void
)
static
void
test_dpi_mapping
(
void
)
{
{
HWND
hwnd
;
HWND
hwnd
;
HDC
hdc
;
UINT
win_dpi
;
UINT
win_dpi
;
POINT
point
;
POINT
point
;
BOOL
ret
,
todo
;
BOOL
ret
,
todo
;
RECT
rect
,
orig
,
client
,
expect
;
RECT
rect
,
orig
,
client
,
desktop
,
expect
;
ULONG_PTR
i
,
j
;
ULONG_PTR
i
,
j
;
HMONITOR
monitor
;
MONITORINFO
mon_info
;
DPI_AWARENESS_CONTEXT
context
;
DPI_AWARENESS_CONTEXT
context
;
if
(
!
pLogicalToPhysicalPointForPerMonitorDPI
)
if
(
!
pLogicalToPhysicalPointForPerMonitorDPI
)
...
@@ -3205,7 +3208,48 @@ static void test_dpi_mapping(void)
...
@@ -3205,7 +3208,48 @@ static void test_dpi_mapping(void)
win_skip
(
"LogicalToPhysicalPointForPerMonitorDPI not supported
\n
"
);
win_skip
(
"LogicalToPhysicalPointForPerMonitorDPI not supported
\n
"
);
return
;
return
;
}
}
context
=
pGetThreadDpiAwarenessContext
();
context
=
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
GetWindowRect
(
GetDesktopWindow
(),
&
desktop
);
for
(
i
=
DPI_AWARENESS_UNAWARE
;
i
<=
DPI_AWARENESS_PER_MONITOR_AWARE
;
i
++
)
{
pSetThreadDpiAwarenessContext
(
(
DPI_AWARENESS_CONTEXT
)
~
i
);
/* test desktop rect */
GetWindowRect
(
GetDesktopWindow
(),
&
rect
);
expect
=
desktop
;
if
(
i
==
DPI_AWARENESS_UNAWARE
)
scale_rect_dpi
(
&
expect
,
real_dpi
,
USER_DEFAULT_SCREEN_DPI
);
ok
(
EqualRect
(
&
expect
,
&
rect
),
"%lu: wrong desktop rect %s expected %s
\n
"
,
i
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
expect
)
);
SetRect
(
&
rect
,
0
,
0
,
GetSystemMetrics
(
SM_CXSCREEN
),
GetSystemMetrics
(
SM_CYSCREEN
));
ok
(
EqualRect
(
&
expect
,
&
rect
),
"%lu: wrong desktop rect %s expected %s
\n
"
,
i
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
expect
)
);
SetRect
(
&
rect
,
0
,
0
,
GetSystemMetrics
(
SM_CXVIRTUALSCREEN
),
GetSystemMetrics
(
SM_CYVIRTUALSCREEN
));
ok
(
EqualRect
(
&
expect
,
&
rect
),
"%lu: wrong virt desktop rect %s expected %s
\n
"
,
i
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
expect
)
);
SetRect
(
&
rect
,
0
,
0
,
1
,
1
);
monitor
=
MonitorFromRect
(
&
rect
,
MONITOR_DEFAULTTOPRIMARY
);
ok
(
monitor
!=
0
,
"failed to get monitor
\n
"
);
mon_info
.
cbSize
=
sizeof
(
mon_info
);
ok
(
GetMonitorInfoW
(
monitor
,
&
mon_info
),
"GetMonitorInfoExW failed
\n
"
);
ok
(
EqualRect
(
&
expect
,
&
mon_info
.
rcMonitor
),
"%lu: wrong monitor rect %s expected %s
\n
"
,
i
,
wine_dbgstr_rect
(
&
mon_info
.
rcMonitor
),
wine_dbgstr_rect
(
&
expect
)
);
hdc
=
CreateDCA
(
"display"
,
NULL
,
NULL
,
NULL
);
SetRect
(
&
rect
,
0
,
0
,
GetDeviceCaps
(
hdc
,
HORZRES
),
GetDeviceCaps
(
hdc
,
VERTRES
));
ok
(
EqualRect
(
&
expect
,
&
rect
),
"%lu: wrong caps desktop rect %s expected %s
\n
"
,
i
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
expect
)
);
SetRect
(
&
rect
,
0
,
0
,
GetDeviceCaps
(
hdc
,
DESKTOPHORZRES
),
GetDeviceCaps
(
hdc
,
DESKTOPVERTRES
));
ok
(
EqualRect
(
&
desktop
,
&
rect
),
"%lu: wrong caps virt desktop rect %s expected %s
\n
"
,
i
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
desktop
)
);
DeleteDC
(
hdc
);
/* test message window rect */
hwnd
=
CreateWindowA
(
"SysParamsTestClass"
,
"test"
,
WS_CHILD
,
10
,
10
,
20
,
20
,
HWND_MESSAGE
,
0
,
GetModuleHandleA
(
0
),
NULL
);
GetWindowRect
(
GetAncestor
(
hwnd
,
GA_PARENT
),
&
rect
);
SetRect
(
&
expect
,
0
,
0
,
100
,
100
);
if
(
i
==
DPI_AWARENESS_UNAWARE
)
scale_rect_dpi
(
&
expect
,
real_dpi
,
USER_DEFAULT_SCREEN_DPI
);
ok
(
EqualRect
(
&
expect
,
&
rect
),
"%lu: wrong message rect %s expected %s
\n
"
,
i
,
wine_dbgstr_rect
(
&
rect
),
wine_dbgstr_rect
(
&
expect
)
);
DestroyWindow
(
hwnd
);
}
for
(
i
=
DPI_AWARENESS_UNAWARE
;
i
<=
DPI_AWARENESS_PER_MONITOR_AWARE
;
i
++
)
for
(
i
=
DPI_AWARENESS_UNAWARE
;
i
<=
DPI_AWARENESS_PER_MONITOR_AWARE
;
i
++
)
{
{
pSetThreadDpiAwarenessContext
(
(
DPI_AWARENESS_CONTEXT
)
~
i
);
pSetThreadDpiAwarenessContext
(
(
DPI_AWARENESS_CONTEXT
)
~
i
);
...
...
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