Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
dbd2c6eb
Commit
dbd2c6eb
authored
Oct 08, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Oct 10, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user: Add test for LL mouse hook and [Get|Set]CursorPos.
parent
cc5e9106
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
input.c
dlls/user/tests/input.c
+79
-0
No files found.
dlls/user/tests/input.c
View file @
dbd2c6eb
...
...
@@ -534,9 +534,88 @@ static void test_keynames(void)
}
}
static
POINT
pt_old
,
pt_new
;
#define STEP 20
static
LRESULT
CALLBACK
hook_proc1
(
int
code
,
WPARAM
wparam
,
LPARAM
lparam
)
{
MSLLHOOKSTRUCT
*
hook
=
(
MSLLHOOKSTRUCT
*
)
lparam
;
POINT
pt
,
pt1
;
if
(
code
==
HC_ACTION
)
{
/* This is our new cursor position */
pt_new
=
hook
->
pt
;
/* Should return previous position */
GetCursorPos
(
&
pt
);
ok
(
pt
.
x
==
pt_old
.
x
&&
pt
.
y
==
pt_old
.
y
,
"GetCursorPos: (%d,%d)
\n
"
,
pt
.
x
,
pt
.
y
);
/* Should set new position until hook chain is finished. */
pt
.
x
=
pt_old
.
x
+
STEP
;
pt
.
y
=
pt_old
.
y
+
STEP
;
SetCursorPos
(
pt
.
x
,
pt
.
y
);
GetCursorPos
(
&
pt1
);
ok
(
pt
.
x
==
pt1
.
x
&&
pt
.
y
==
pt1
.
y
,
"Wrong set pos: (%d,%d)
\n
"
,
pt1
.
x
,
pt1
.
y
);
}
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
}
static
LRESULT
CALLBACK
hook_proc2
(
int
code
,
WPARAM
wparam
,
LPARAM
lparam
)
{
MSLLHOOKSTRUCT
*
hook
=
(
MSLLHOOKSTRUCT
*
)
lparam
;
POINT
pt
;
if
(
code
==
HC_ACTION
)
{
ok
(
hook
->
pt
.
x
==
pt_new
.
x
&&
hook
->
pt
.
y
==
pt_new
.
y
,
"Wrong hook coords: (%d,%d)
\n
"
,
pt_new
.
x
,
pt_new
.
y
);
/* Should match position set above */
GetCursorPos
(
&
pt
);
ok
(
pt
.
x
==
pt_old
.
x
+
STEP
&&
pt
.
y
==
pt_old
.
y
+
STEP
,
"GetCursorPos: (%d,%d)
\n
"
,
pt
.
x
,
pt
.
y
);
}
return
CallNextHookEx
(
0
,
code
,
wparam
,
lparam
);
}
static
void
test_mouse_ll_hook
(
void
)
{
HWND
hwnd
;
HHOOK
hook1
,
hook2
;
POINT
pt_org
;
GetCursorPos
(
&
pt_org
);
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
,
10
,
10
,
200
,
200
,
NULL
,
NULL
,
NULL
,
NULL
);
SetCursorPos
(
300
,
300
);
hook2
=
SetWindowsHookExA
(
WH_MOUSE_LL
,
hook_proc2
,
GetModuleHandleA
(
0
),
0
);
hook1
=
SetWindowsHookExA
(
WH_MOUSE_LL
,
hook_proc1
,
GetModuleHandleA
(
0
),
0
);
GetCursorPos
(
&
pt_old
);
mouse_event
(
MOUSEEVENTF_MOVE
,
-
STEP
,
0
,
0
,
0
);
GetCursorPos
(
&
pt_old
);
ok
(
pt_old
.
x
==
pt_new
.
x
&&
pt_old
.
y
==
pt_new
.
y
,
"Wrong new pos: (%d,%d)
\n
"
,
pt_old
.
x
,
pt_old
.
y
);
mouse_event
(
MOUSEEVENTF_MOVE
,
+
STEP
,
0
,
0
,
0
);
GetCursorPos
(
&
pt_old
);
ok
(
pt_old
.
x
==
pt_new
.
x
&&
pt_old
.
y
==
pt_new
.
y
,
"Wrong new pos: (%d,%d)
\n
"
,
pt_old
.
x
,
pt_old
.
y
);
mouse_event
(
MOUSEEVENTF_MOVE
,
0
,
-
STEP
,
0
,
0
);
GetCursorPos
(
&
pt_old
);
ok
(
pt_old
.
x
==
pt_new
.
x
&&
pt_old
.
y
==
pt_new
.
y
,
"Wrong new pos: (%d,%d)
\n
"
,
pt_old
.
x
,
pt_old
.
y
);
mouse_event
(
MOUSEEVENTF_MOVE
,
0
,
+
STEP
,
0
,
0
);
GetCursorPos
(
&
pt_old
);
ok
(
pt_old
.
x
==
pt_new
.
x
&&
pt_old
.
y
==
pt_new
.
y
,
"Wrong new pos: (%d,%d)
\n
"
,
pt_old
.
x
,
pt_old
.
y
);
UnhookWindowsHookEx
(
hook1
);
UnhookWindowsHookEx
(
hook2
);
DestroyWindow
(
hwnd
);
SetCursorPos
(
pt_org
.
x
,
pt_org
.
y
);
}
START_TEST
(
input
)
{
test_Input_whitebox
();
test_Input_blackbox
();
test_keynames
();
test_mouse_ll_hook
();
}
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