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
24c57287
Commit
24c57287
authored
Apr 18, 2014
by
Patrick Rudolph
Committed by
Alexandre Julliard
Apr 22, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add tests for valid cbSize in GetMonitorInfoA.
parent
8be5dd16
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
2 deletions
+52
-2
monitor.c
dlls/user32/tests/monitor.c
+52
-2
No files found.
dlls/user32/tests/monitor.c
View file @
24c57287
...
...
@@ -296,6 +296,31 @@ static void test_monitors(void)
HMONITOR
monitor
,
primary
,
nearest
;
POINT
pt
;
RECT
rc
;
MONITORINFO
mi
;
MONITORINFOEXA
miex
;
BOOL
ret
;
DWORD
i
;
static
const
struct
{
DWORD
cbSize
;
BOOL
ret
;
}
testdatami
[]
=
{
{
0
,
FALSE
},
{
sizeof
(
MONITORINFO
)
+
1
,
FALSE
},
{
sizeof
(
MONITORINFO
)
-
1
,
FALSE
},
{
sizeof
(
MONITORINFO
),
TRUE
},
{
-
1
,
FALSE
},
{
0xdeadbeef
,
FALSE
},
},
testdatamiex
[]
=
{
{
0
,
FALSE
},
{
sizeof
(
MONITORINFOEXA
)
+
1
,
FALSE
},
{
sizeof
(
MONITORINFOEXA
)
-
1
,
FALSE
},
{
sizeof
(
MONITORINFOEXA
),
TRUE
},
{
-
1
,
FALSE
},
{
0xdeadbeef
,
FALSE
},
};
if
(
!
pMonitorFromPoint
||
!
pMonitorFromWindow
||
!
pMonitorFromRect
)
{
...
...
@@ -351,8 +376,6 @@ static void test_monitors(void)
nearest
=
primary
;
while
(
monitor
!=
NULL
)
{
MONITORINFO
mi
;
BOOL
ret
;
ok
(
monitor
!=
primary
,
"got primary %p
\n
"
,
monitor
);
nearest
=
monitor
;
mi
.
cbSize
=
sizeof
(
mi
);
...
...
@@ -362,6 +385,33 @@ static void test_monitors(void)
monitor
=
pMonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
}
/* tests for cbSize in MONITORINFO */
monitor
=
pMonitorFromWindow
(
0
,
MONITOR_DEFAULTTOPRIMARY
);
for
(
i
=
0
;
i
<
(
sizeof
(
testdatami
)
/
sizeof
(
testdatami
[
0
]));
i
++
)
{
memset
(
&
mi
,
0
,
sizeof
(
mi
)
);
mi
.
cbSize
=
testdatami
[
i
].
cbSize
;
ret
=
pGetMonitorInfoA
(
monitor
,
&
mi
);
ok
(
ret
==
testdatami
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
if
(
ret
)
ok
(
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
else
ok
(
!
(
mi
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag is set
\n
"
);
}
/* tests for cbSize in MONITORINFOEXA */
for
(
i
=
0
;
i
<
(
sizeof
(
testdatamiex
)
/
sizeof
(
testdatamiex
[
0
]));
i
++
)
{
memset
(
&
miex
,
0
,
sizeof
(
miex
)
);
miex
.
cbSize
=
testdatamiex
[
i
].
cbSize
;
ret
=
pGetMonitorInfoA
(
monitor
,
(
LPMONITORINFO
)
&
miex
);
ok
(
ret
==
testdatamiex
[
i
].
ret
,
"GetMonitorInfo returned wrong value
\n
"
);
if
(
ret
)
ok
(
(
miex
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag isn't set
\n
"
);
else
ok
(
!
(
miex
.
dwFlags
&
MONITORINFOF_PRIMARY
),
"MONITORINFOF_PRIMARY flag is set
\n
"
);
}
SetRect
(
&
rc
,
rc
.
left
+
1
,
rc
.
top
+
1
,
rc
.
left
+
2
,
rc
.
top
+
2
);
monitor
=
pMonitorFromRect
(
&
rc
,
MONITOR_DEFAULTTONULL
);
...
...
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