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
ad3e0b78
Commit
ad3e0b78
authored
Jun 03, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
Jun 08, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add test for flags on keyboard messages.
parent
5173f9f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
0 deletions
+126
-0
msg.c
dlls/user32/tests/msg.c
+126
-0
No files found.
dlls/user32/tests/msg.c
View file @
ad3e0b78
...
...
@@ -12895,6 +12895,131 @@ static void test_SetParent(void)
flush_sequence
();
}
static
const
struct
message
WmKeyReleaseOnly
[]
=
{
{
HCBT_KEYSKIPPED
,
hook
|
wparam
|
lparam
|
optional
,
0x41
,
0x80000001
},
{
WM_KEYUP
,
sent
|
wparam
|
lparam
,
0x41
,
0x80000001
},
{
0
}
};
static
const
struct
message
WmKeyPressNormal
[]
=
{
{
HCBT_KEYSKIPPED
,
hook
|
wparam
|
lparam
|
optional
,
0x41
,
0x1
},
{
WM_KEYDOWN
,
sent
|
wparam
|
lparam
,
0x41
,
0x1
},
{
0
}
};
static
const
struct
message
WmKeyPressRepeat
[]
=
{
{
HCBT_KEYSKIPPED
,
hook
|
wparam
|
lparam
|
optional
,
0x41
,
0x40000001
},
{
WM_KEYDOWN
,
sent
|
wparam
|
lparam
,
0x41
,
0x40000001
},
{
0
}
};
static
const
struct
message
WmKeyReleaseNormal
[]
=
{
{
HCBT_KEYSKIPPED
,
hook
|
wparam
|
lparam
|
optional
,
0x41
,
0xc0000001
},
{
WM_KEYUP
,
sent
|
wparam
|
lparam
,
0x41
,
0xc0000001
},
{
0
}
};
static
void
test_keyflags
(
void
)
{
HWND
test_window
;
SHORT
key_state
;
BYTE
keyboard_state
[
256
];
MSG
msg
;
test_window
=
CreateWindowEx
(
0
,
"TestWindowClass"
,
NULL
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
flush_sequence
();
/* keyup without a keydown */
keybd_event
(
0x41
,
0
,
KEYEVENTF_KEYUP
,
0
);
while
(
PeekMessage
(
&
msg
,
NULL
,
WM_KEYFIRST
,
WM_KEYLAST
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
WmKeyReleaseOnly
,
"key release only"
,
TRUE
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0
,
"unexpected key state %x
\n
"
,
key_state
);
key_state
=
GetKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0
,
"unexpected key state %x
\n
"
,
key_state
);
/* keydown */
keybd_event
(
0x41
,
0
,
0
,
0
);
while
(
PeekMessage
(
&
msg
,
NULL
,
WM_KEYFIRST
,
WM_KEYLAST
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
WmKeyPressNormal
,
"key press only"
,
FALSE
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0x8000
,
"unexpected key state %x
\n
"
,
key_state
);
key_state
=
GetKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0x8000
,
"unexpected key state %x
\n
"
,
key_state
);
/* keydown repeat */
keybd_event
(
0x41
,
0
,
0
,
0
);
while
(
PeekMessage
(
&
msg
,
NULL
,
WM_KEYFIRST
,
WM_KEYLAST
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
WmKeyPressRepeat
,
"key press repeat"
,
FALSE
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0x8000
,
"unexpected key state %x
\n
"
,
key_state
);
key_state
=
GetKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0x8000
,
"unexpected key state %x
\n
"
,
key_state
);
/* keyup */
keybd_event
(
0x41
,
0
,
KEYEVENTF_KEYUP
,
0
);
while
(
PeekMessage
(
&
msg
,
NULL
,
WM_KEYFIRST
,
WM_KEYLAST
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
WmKeyReleaseNormal
,
"key release repeat"
,
FALSE
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0
,
"unexpected key state %x
\n
"
,
key_state
);
key_state
=
GetKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0
,
"unexpected key state %x
\n
"
,
key_state
);
/* set the key state in this thread */
GetKeyboardState
(
keyboard_state
);
keyboard_state
[
0x41
]
=
0x80
;
SetKeyboardState
(
keyboard_state
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0
,
"unexpected key state %x
\n
"
,
key_state
);
/* keydown */
keybd_event
(
0x41
,
0
,
0
,
0
);
while
(
PeekMessage
(
&
msg
,
NULL
,
WM_KEYFIRST
,
WM_KEYLAST
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
WmKeyPressRepeat
,
"key press after setkeyboardstate"
,
TRUE
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0x8000
,
"unexpected key state %x
\n
"
,
key_state
);
key_state
=
GetKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0x8000
,
"unexpected key state %x
\n
"
,
key_state
);
/* clear the key state in this thread */
GetKeyboardState
(
keyboard_state
);
keyboard_state
[
0x41
]
=
0
;
SetKeyboardState
(
keyboard_state
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0x8000
,
"unexpected key state %x
\n
"
,
key_state
);
/* keyup */
keybd_event
(
0x41
,
0
,
KEYEVENTF_KEYUP
,
0
);
while
(
PeekMessage
(
&
msg
,
NULL
,
WM_KEYFIRST
,
WM_KEYLAST
,
PM_REMOVE
))
DispatchMessage
(
&
msg
);
ok_sequence
(
WmKeyReleaseOnly
,
"key release after setkeyboardstate"
,
TRUE
);
key_state
=
GetAsyncKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0
,
"unexpected key state %x
\n
"
,
key_state
);
key_state
=
GetKeyState
(
0x41
);
ok
((
key_state
&
0x8000
)
==
0
,
"unexpected key state %x
\n
"
,
key_state
);
DestroyWindow
(
test_window
);
flush_sequence
();
}
static
const
struct
message
WmHotkeyPressLWIN
[]
=
{
{
WM_KEYDOWN
,
kbd_hook
|
wparam
|
lparam
,
VK_LWIN
,
LLKHF_INJECTED
},
{
HCBT_KEYSKIPPED
,
hook
|
wparam
|
lparam
|
optional
,
VK_LWIN
,
1
},
...
...
@@ -13248,6 +13373,7 @@ START_TEST(msg)
test_paintingloop
();
test_defwinproc
();
test_clipboard_viewers
();
test_keyflags
();
test_hotkey
();
/* keep it the last test, under Windows it tends to break the tests
* which rely on active/foreground windows being correct.
...
...
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