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
363b2bb9
Commit
363b2bb9
authored
May 25, 2011
by
Vincent Povirk
Committed by
Alexandre Julliard
May 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add test for RegisterHotKey/UnregisterHotKey.
parent
27ff2ae9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
msg.c
dlls/user32/tests/msg.c
+112
-0
No files found.
dlls/user32/tests/msg.c
View file @
363b2bb9
...
...
@@ -12883,6 +12883,117 @@ static void test_SetParent(void)
flush_sequence
();
}
static
void
test_hotkey
(
void
)
{
HWND
test_window
,
taskbar_window
;
BOOL
ret
;
int
hotkey_letter
;
SetLastError
(
0xdeadbeef
);
ret
=
UnregisterHotKey
(
NULL
,
0
);
todo_wine
ok
(
ret
==
FALSE
,
"expected FALSE, got %i
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
ERROR_HOTKEY_NOT_REGISTERED
,
"unexpected error %d
\n
"
,
GetLastError
());
if
(
ret
==
TRUE
)
{
skip
(
"hotkeys not supported
\n
"
);
return
;
}
test_window
=
CreateWindowEx
(
0
,
"TestWindowClass"
,
NULL
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
100
,
100
,
200
,
200
,
0
,
0
,
0
,
NULL
);
SetLastError
(
0xdeadbeef
);
ret
=
UnregisterHotKey
(
test_window
,
0
);
ok
(
ret
==
FALSE
,
"expected FALSE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_HOTKEY_NOT_REGISTERED
,
"unexpected error %d
\n
"
,
GetLastError
());
/* Search for a Windows Key + letter combination that hasn't been registered */
for
(
hotkey_letter
=
0x41
;
hotkey_letter
<=
0x51
;
hotkey_letter
++
)
{
SetLastError
(
0xdeadbeef
);
ret
=
RegisterHotKey
(
test_window
,
5
,
MOD_WIN
,
hotkey_letter
);
if
(
ret
==
TRUE
)
{
ok
(
GetLastError
()
==
0xdeadbeef
,
"unexpected error %d
\n
"
,
GetLastError
());
break
;
}
else
{
ok
(
GetLastError
()
==
ERROR_HOTKEY_ALREADY_REGISTERED
,
"unexpected error %d
\n
"
,
GetLastError
());
}
}
if
(
hotkey_letter
==
0x52
)
{
ok
(
0
,
"Couldn't find any free Windows Key + letter combination
\n
"
);
goto
end
;
}
/* Same key combination, different id */
SetLastError
(
0xdeadbeef
);
ret
=
RegisterHotKey
(
test_window
,
4
,
MOD_WIN
,
hotkey_letter
);
ok
(
ret
==
FALSE
,
"expected FALSE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_HOTKEY_ALREADY_REGISTERED
,
"unexpected error %d
\n
"
,
GetLastError
());
/* Same key combination, different window */
SetLastError
(
0xdeadbeef
);
ret
=
RegisterHotKey
(
NULL
,
5
,
MOD_WIN
,
hotkey_letter
);
ok
(
ret
==
FALSE
,
"expected FALSE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_HOTKEY_ALREADY_REGISTERED
,
"unexpected error %d
\n
"
,
GetLastError
());
/* Register the same hotkey twice */
SetLastError
(
0xdeadbeef
);
ret
=
RegisterHotKey
(
test_window
,
5
,
MOD_WIN
,
hotkey_letter
);
ok
(
ret
==
FALSE
,
"expected FALSE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_HOTKEY_ALREADY_REGISTERED
,
"unexpected error %d
\n
"
,
GetLastError
());
/* Window on another thread */
taskbar_window
=
FindWindowA
(
"Shell_TrayWnd"
,
NULL
);
if
(
!
taskbar_window
)
{
skip
(
"no taskbar?
\n
"
);
}
else
{
SetLastError
(
0xdeadbeef
);
ret
=
RegisterHotKey
(
taskbar_window
,
5
,
0
,
hotkey_letter
);
ok
(
ret
==
FALSE
,
"expected FALSE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_WINDOW_OF_OTHER_THREAD
,
"unexpected error %d
\n
"
,
GetLastError
());
}
/* Unregister hotkey properly */
SetLastError
(
0xdeadbeef
);
ret
=
UnregisterHotKey
(
test_window
,
5
);
ok
(
ret
==
TRUE
,
"expected TRUE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"unexpected error %d
\n
"
,
GetLastError
());
/* Unregister hotkey again */
SetLastError
(
0xdeadbeef
);
ret
=
UnregisterHotKey
(
test_window
,
5
);
ok
(
ret
==
FALSE
,
"expected FALSE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_HOTKEY_NOT_REGISTERED
,
"unexpected error %d
\n
"
,
GetLastError
());
/* Register thread hotkey */
SetLastError
(
0xdeadbeef
);
ret
=
RegisterHotKey
(
NULL
,
5
,
MOD_WIN
,
hotkey_letter
);
ok
(
ret
==
TRUE
,
"expected TRUE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"unexpected error %d
\n
"
,
GetLastError
());
/* Unregister thread hotkey */
SetLastError
(
0xdeadbeef
);
ret
=
UnregisterHotKey
(
NULL
,
5
);
ok
(
ret
==
TRUE
,
"expected TRUE, got %i
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"unexpected error %d
\n
"
,
GetLastError
());
end:
UnregisterHotKey
(
NULL
,
5
);
UnregisterHotKey
(
test_window
,
5
);
DestroyWindow
(
test_window
);
flush_sequence
();
}
START_TEST
(
msg
)
{
char
**
test_argv
;
...
...
@@ -12991,6 +13102,7 @@ START_TEST(msg)
test_paintingloop
();
test_defwinproc
();
test_clipboard_viewers
();
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