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
d47b13c4
Commit
d47b13c4
authored
Mar 08, 2024
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Mar 08, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add some ReleaseCapture() tests.
parent
c51c257b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
win.c
dlls/user32/tests/win.c
+77
-0
No files found.
dlls/user32/tests/win.c
View file @
d47b13c4
...
...
@@ -13064,6 +13064,82 @@ static void test_shell_tray(void)
DestroyWindow
(
hwnd
);
}
static
int
wm_mousemove_count
;
static
BOOL
do_release_capture
;
static
LRESULT
WINAPI
test_ReleaseCapture_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wp
,
LPARAM
lp
)
{
if
(
msg
==
WM_MOUSEMOVE
)
{
wm_mousemove_count
++
;
if
(
wm_mousemove_count
>=
100
)
return
1
;
if
(
do_release_capture
)
ReleaseCapture
();
return
0
;
}
return
DefWindowProcA
(
hwnd
,
msg
,
wp
,
lp
);
}
static
void
test_ReleaseCapture
(
void
)
{
WNDCLASSA
cls
=
{
0
};
ATOM
atom
;
HWND
hwnd
;
POINT
pt
;
BOOL
ret
;
cls
.
lpfnWndProc
=
test_ReleaseCapture_proc
;
cls
.
hInstance
=
GetModuleHandleA
(
0
);
cls
.
hCursor
=
LoadCursorA
(
0
,
(
LPCSTR
)
IDC_ARROW
);
cls
.
hbrBackground
=
GetStockObject
(
BLACK_BRUSH
);
cls
.
lpszClassName
=
"test_ReleaseCapture_class"
;
atom
=
RegisterClassA
(
&
cls
);
ok
(
!!
atom
,
"RegisterClassA failed, error %#lx.
\n
"
,
GetLastError
());
hwnd
=
CreateWindowExA
(
WS_EX_TOPMOST
,
cls
.
lpszClassName
,
""
,
WS_POPUP
|
WS_VISIBLE
,
100
,
100
,
100
,
100
,
NULL
,
NULL
,
0
,
NULL
);
ok
(
!!
hwnd
,
"CreateWindowA failed, error %#lx.
\n
"
,
GetLastError
());
ret
=
SetForegroundWindow
(
hwnd
);
ok
(
ret
,
"SetForegroundWindow failed, error %#lx.
\n
"
,
GetLastError
());
GetCursorPos
(
&
pt
);
ret
=
SetCursorPos
(
150
,
150
);
ok
(
ret
,
"SetCursorPos failed, error %#lx.
\n
"
,
GetLastError
());
flush_events
(
TRUE
);
/* Test a Wine bug that WM_MOUSEMOVE is post too many times when calling ReleaseCapture() during
* handling WM_MOUSEMOVE and the cursor is on the window */
do_release_capture
=
TRUE
;
ret
=
ReleaseCapture
();
ok
(
ret
,
"ReleaseCapture failed, error %#lx.
\n
"
,
GetLastError
());
flush_events
(
TRUE
);
do_release_capture
=
FALSE
;
todo_wine
ok
(
wm_mousemove_count
<
10
,
"Got too many WM_MOUSEMOVE.
\n
"
);
/* Test that ReleaseCapture() should send a WM_MOUSEMOVE if a window is captured */
SetCapture
(
hwnd
);
wm_mousemove_count
=
0
;
ret
=
ReleaseCapture
();
ok
(
ret
,
"ReleaseCapture failed, error %#lx.
\n
"
,
GetLastError
());
flush_events
(
TRUE
);
ok
(
wm_mousemove_count
==
1
,
"Got no WM_MOUSEMOVE.
\n
"
);
/* Test that ReleaseCapture() shouldn't send WM_MOUSEMOVE if no window is captured */
wm_mousemove_count
=
0
;
ret
=
ReleaseCapture
();
ok
(
ret
,
"ReleaseCapture failed, error %#lx.
\n
"
,
GetLastError
());
flush_events
(
TRUE
);
todo_wine
ok
(
wm_mousemove_count
==
0
,
"Got WM_MOUSEMOVE.
\n
"
);
ret
=
SetCursorPos
(
pt
.
x
,
pt
.
y
);
ok
(
ret
,
"SetCursorPos failed, error %#lx.
\n
"
,
GetLastError
());
DestroyWindow
(
hwnd
);
UnregisterClassA
(
cls
.
lpszClassName
,
GetModuleHandleA
(
0
));
}
START_TEST
(
win
)
{
char
**
argv
;
...
...
@@ -13246,6 +13322,7 @@ START_TEST(win)
test_cancel_mode
();
test_DragDetect
();
test_WM_NCCALCSIZE
();
test_ReleaseCapture
();
/* 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