Commit 7a39a7a3 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

user32/tests: Recognize undefined characters in OemKeyScan tests.

This reverts commit 72ab2d5b. Signed-off-by: 's avatarAlex Henrie <alexhenrie24@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 72ab2d5b
TESTDLL = user32.dll TESTDLL = user32.dll
IMPORTS = user32 gdi32 advapi32 imm32 IMPORTS = user32 gdi32 advapi32
C_SRCS = \ C_SRCS = \
broadcast.c \ broadcast.c \
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
#include "winnls.h" #include "winnls.h"
#include "imm.h"
#include "wine/test.h" #include "wine/test.h"
...@@ -2516,23 +2515,23 @@ static void test_OemKeyScan(void) ...@@ -2516,23 +2515,23 @@ static void test_OemKeyScan(void)
DWORD ret, expect, vkey, scan; DWORD ret, expect, vkey, scan;
WCHAR oem, wchr; WCHAR oem, wchr;
char oem_char; char oem_char;
BOOL ime = ImmIsIME(GetKeyboardLayout(0));
for (oem = 0; oem < 0x200; oem++) for (oem = 0; oem < 0x200; oem++)
{ {
ret = OemKeyScan( oem ); ret = OemKeyScan( oem );
oem_char = LOBYTE( oem ); oem_char = LOBYTE( oem );
if (!OemToCharBuffW( &oem_char, &wchr, 1 )) /* OemKeyScan returns -1 for any character that cannot be mapped,
* whereas OemToCharBuff changes unmappable characters to question
* marks. The ASCII characters 0-127, including the real question mark
* character, are all mappable and are the same in all OEM codepages. */
if (!OemToCharBuffW( &oem_char, &wchr, 1 ) || (wchr == '?' && oem_char < 0))
expect = -1; expect = -1;
else else
{ {
vkey = VkKeyScanW( wchr ); vkey = VkKeyScanW( wchr );
scan = MapVirtualKeyW( LOBYTE( vkey ), MAPVK_VK_TO_VSC ); scan = MapVirtualKeyW( LOBYTE( vkey ), MAPVK_VK_TO_VSC );
/* OemKeyScan returns -1 for any character that has to go through if (!scan)
* the IME, whereas VkKeyScan returns the virtual key code for the
* question mark key */
if (!scan || (ime && wchr != '?' && vkey == VkKeyScanW( '?' )))
expect = -1; expect = -1;
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment