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
ed0568a5
Commit
ed0568a5
authored
Feb 14, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add tests for GetWindowPlacement() and SetWindowPlacement().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
145b4109
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
192 additions
and
0 deletions
+192
-0
win.c
dlls/user32/tests/win.c
+192
-0
No files found.
dlls/user32/tests/win.c
View file @
ed0568a5
...
...
@@ -10766,6 +10766,197 @@ static void test_IsWindowEnabled(void)
DestroyWindow
(
hwnd
);
}
static
void
test_window_placement
(
void
)
{
RECT
orig
=
{
100
,
200
,
300
,
400
},
orig2
=
{
200
,
300
,
400
,
500
},
rect
;
WINDOWPLACEMENT
wp
=
{
sizeof
(
wp
)};
HWND
hwnd
;
BOOL
ret
;
hwnd
=
CreateWindowA
(
"MainWindowClass"
,
"wp"
,
WS_OVERLAPPEDWINDOW
,
orig
.
left
,
orig
.
top
,
orig
.
right
-
orig
.
left
,
orig
.
bottom
-
orig
.
top
,
0
,
0
,
0
,
0
);
ok
(
!!
hwnd
,
"failed to create window, error %u
\n
"
,
GetLastError
());
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWNORMAL
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
1
&&
wp
.
ptMinPosition
.
y
==
-
1
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_MINIMIZE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
!
wp
.
flags
,
"got flags %#x
\n
"
,
wp
.
flags
);
ok
(
wp
.
showCmd
==
SW_SHOWMINIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_RESTORE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWNORMAL
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_MAXIMIZE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWMAXIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
SetWindowPos
(
hwnd
,
0
,
100
,
100
,
100
,
100
,
SWP_NOZORDER
|
SWP_NOACTIVATE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWMAXIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
ok
(
wp
.
ptMaxPosition
.
x
==
100
&&
wp
.
ptMaxPosition
.
y
==
100
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_MINIMIZE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
flags
==
WPF_RESTORETOMAXIMIZED
,
"got flags %#x
\n
"
,
wp
.
flags
);
ok
(
wp
.
showCmd
==
SW_SHOWMINIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_RESTORE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWMAXIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_RESTORE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWNORMAL
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
wp
.
flags
=
WPF_SETMINPOSITION
;
wp
.
ptMinPosition
.
x
=
wp
.
ptMinPosition
.
y
=
100
;
wp
.
ptMaxPosition
.
x
=
wp
.
ptMaxPosition
.
y
=
100
;
wp
.
rcNormalPosition
=
orig2
;
ret
=
SetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to set window placement, error %u
\n
"
,
GetLastError
());
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWNORMAL
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
100
&&
wp
.
ptMinPosition
.
y
==
100
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig2
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
GetWindowRect
(
hwnd
,
&
rect
);
ok
(
EqualRect
(
&
rect
,
&
orig2
),
"got window rect %s
\n
"
,
wine_dbgstr_rect
(
&
rect
));
ShowWindow
(
hwnd
,
SW_MINIMIZE
);
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
!
wp
.
flags
,
"got flags %#x
\n
"
,
wp
.
flags
);
ok
(
wp
.
showCmd
==
SW_SHOWMINIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig2
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_RESTORE
);
wp
.
flags
=
WPF_SETMINPOSITION
;
wp
.
showCmd
=
SW_MINIMIZE
;
wp
.
ptMinPosition
.
x
=
wp
.
ptMinPosition
.
y
=
100
;
wp
.
ptMaxPosition
.
x
=
wp
.
ptMaxPosition
.
y
=
100
;
wp
.
rcNormalPosition
=
orig
;
ret
=
SetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to set window placement, error %u
\n
"
,
GetLastError
());
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
!
wp
.
flags
,
"got flags %#x
\n
"
,
wp
.
flags
);
ok
(
wp
.
showCmd
==
SW_SHOWMINIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
-
32000
&&
wp
.
ptMinPosition
.
y
==
-
32000
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
ShowWindow
(
hwnd
,
SW_RESTORE
);
wp
.
flags
=
WPF_SETMINPOSITION
;
wp
.
showCmd
=
SW_MAXIMIZE
;
wp
.
ptMinPosition
.
x
=
wp
.
ptMinPosition
.
y
=
100
;
wp
.
ptMaxPosition
.
x
=
wp
.
ptMaxPosition
.
y
=
100
;
wp
.
rcNormalPosition
=
orig
;
ret
=
SetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to set window placement, error %u
\n
"
,
GetLastError
());
ret
=
GetWindowPlacement
(
hwnd
,
&
wp
);
ok
(
ret
,
"failed to get window placement, error %u
\n
"
,
GetLastError
());
ok
(
wp
.
showCmd
==
SW_SHOWMAXIMIZED
,
"got show cmd %u
\n
"
,
wp
.
showCmd
);
ok
(
wp
.
ptMinPosition
.
x
==
100
&&
wp
.
ptMinPosition
.
y
==
100
,
"got minimized pos (%d,%d)
\n
"
,
wp
.
ptMinPosition
.
x
,
wp
.
ptMinPosition
.
y
);
todo_wine
ok
(
wp
.
ptMaxPosition
.
x
==
-
1
&&
wp
.
ptMaxPosition
.
y
==
-
1
,
"got maximized pos (%d,%d)
\n
"
,
wp
.
ptMaxPosition
.
x
,
wp
.
ptMaxPosition
.
y
);
ok
(
EqualRect
(
&
wp
.
rcNormalPosition
,
&
orig
),
"got normal pos %s
\n
"
,
wine_dbgstr_rect
(
&
wp
.
rcNormalPosition
));
DestroyWindow
(
hwnd
);
}
START_TEST
(
win
)
{
char
**
argv
;
...
...
@@ -10922,6 +11113,7 @@ START_TEST(win)
test_minimize_window
(
hwndMain
);
test_destroy_quit
();
test_IsWindowEnabled
();
test_window_placement
();
/* add the tests above this line */
if
(
hhook
)
UnhookWindowsHookEx
(
hhook
);
...
...
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