From: Alexandros Frantzis alexandros.frantzis@collabora.com
--- dlls/user32/tests/input.c | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 527ee6d8785..88869300d9b 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -1169,6 +1169,7 @@ static void test_SendInput_keyboard_messages( WORD vkey, WORD scan, WCHAR wch, W HHOOK hook; HWND hwnd;
+ trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); /* on 32-bit with ALTGR keyboard, the CONTROL key is sent to the hooks without the * LLKHF_INJECTED flag, skip the tests to keep it simple */ if (altgr && sizeof(void *) == 4 && !is_wow64) skip_altgr = TRUE; @@ -1193,38 +1194,64 @@ static void test_SendInput_keyboard_messages( WORD vkey, WORD scan, WCHAR wch, W
/* test peeked messages */ winetest_push_context( "peek" ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lmenu_vkey_peeked, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lcontrol_vkey, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lmenu_lcontrol_vkey, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( shift_vkey, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( rshift, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lshift_ext, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( rshift_ext, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( shift, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( shift_ext, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( rcontrol, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lcontrol_ext, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( rcontrol_ext, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( control, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( control_ext, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); if (skip_altgr) skip( "skipping rmenu_altgr test\n" ); else if (altgr) check_send_input_keyboard_test( rmenu_altgr, TRUE ); else check_send_input_keyboard_test( rmenu_peeked, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lmenu_ext_peeked, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); if (skip_altgr) skip( "skipping rmenu_ext_altgr test\n" ); else if (altgr) check_send_input_keyboard_test( rmenu_ext_altgr, TRUE ); else check_send_input_keyboard_test( rmenu_ext_peeked, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( menu_peeked, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); if (skip_altgr) skip( "skipping menu_ext_altgr test\n" ); else if (altgr) check_send_input_keyboard_test( menu_ext_altgr, TRUE ); else check_send_input_keyboard_test( menu_ext_peeked, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lrshift_ext, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( rshift_scan, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); /* TODO: The Win10 Japanese testbot setup is misbehaving, skip for now. */ if (LOWORD(hkl) != 0x0411) check_send_input_keyboard_test( rctrl_scan, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( unicode, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( lmenu_unicode_peeked, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); check_send_input_keyboard_test( unicode_vkey, TRUE ); + trace( "hkl=%p\n", GetKeyboardLayout( 0 ) ); winetest_pop_context();
wait_messages( 100, FALSE ); @@ -4885,31 +4912,40 @@ static void test_SendInput( WORD vkey, WCHAR wch ) UINT res, i; HWND hwnd;
+ trace( "hkl=%p before create window\n", GetKeyboardLayout ( 0 ) ); hwnd = CreateWindowW( L"static", NULL, WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL ); + trace( "hkl=%p after create window\n", GetKeyboardLayout ( 0 ) ); ok_ne( NULL, hwnd, HWND, "%p" ); wait_messages( 100, FALSE ); + trace( "hkl=%p after create window messages\n", GetKeyboardLayout ( 0 ) );
SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 0, NULL, 0 ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 1, NULL, 0 ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 1, NULL, sizeof(*input) ) ); ok( GetLastError() == ERROR_NOACCESS || GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError returned %#lx\n", GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 0, input, sizeof(*input) ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 0, NULL, sizeof(*input) ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() );
+ trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); memset( input, 0, sizeof(input) ); SetLastError( 0xdeadbeef ); ok_ret( 1, SendInput( 1, input, sizeof(*input) ) ); ok_ret( 0xdeadbeef, GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 16, SendInput( 16, input, sizeof(*input) ) ); ok_ret( 0xdeadbeef, GetLastError() ); @@ -4917,17 +4953,21 @@ static void test_SendInput( WORD vkey, WCHAR wch ) SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 1, input, 0 ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 1, input, sizeof(*input) + 1 ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 1, input, sizeof(*input) - 1 ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() );
+ trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); for (i = 0; i < ARRAY_SIZE(input); ++i) input[i].type = INPUT_KEYBOARD; SetLastError( 0xdeadbeef ); ok_ret( 0, SendInput( 16, input, offsetof( INPUT, ki ) + sizeof(KEYBDINPUT) ) ); ok_ret( ERROR_INVALID_PARAMETER, GetLastError() ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); SetLastError( 0xdeadbeef ); ok_ret( 16, SendInput( 16, input, sizeof(*input) ) ); ok_ret( 0xdeadbeef, GetLastError() ); @@ -4940,6 +4980,7 @@ static void test_SendInput( WORD vkey, WCHAR wch ) wait_messages( 100, FALSE ); ok_seq( empty_sequence ); p_accept_message = is_keyboard_message; + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) );
input[0].hi.uMsg = WM_KEYDOWN; input[0].hi.wParamL = 0; @@ -4955,6 +4996,7 @@ static void test_SendInput( WORD vkey, WCHAR wch ) wait_messages( 100, TRUE ); ok_seq( empty_sequence );
+ trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); memset( input, 0, sizeof(input) ); input[0].type = INPUT_HARDWARE; input[1].type = INPUT_KEYBOARD; @@ -4972,6 +5014,7 @@ static void test_SendInput( WORD vkey, WCHAR wch ) if (broken(res == 16)) ok_seq( broken_sequence ); else ok_seq( empty_sequence );
+ trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); for (i = 0; i < ARRAY_SIZE(input); ++i) input[i].type = INPUT_HARDWARE + 1; SetLastError( 0xdeadbeef ); ok_ret( 16, SendInput( 16, input, sizeof(*input) ) ); @@ -4983,6 +5026,7 @@ static void test_SendInput( WORD vkey, WCHAR wch ) wait_messages( 100, FALSE ); ok_seq( empty_sequence ); p_accept_message = NULL; + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); }
#define check_pointer_info( a, b ) check_pointer_info_( __LINE__, a, b ) @@ -5710,8 +5754,11 @@ static void test_input_desktop( char **argv ) ok_ret( 1, GetCursorPos( &pos ) ); test_SetCursorPos();
+ trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); get_test_scan( 'F', &scan, &wch, &wch_shift ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); test_SendInput( 'F', wch ); + trace( "hkl=%p\n", GetKeyboardLayout ( 0 ) ); test_SendInput_keyboard_messages( 'F', scan, wch, wch_shift, '\x06' ); test_SendInput_mouse_messages();
@@ -5756,10 +5803,16 @@ START_TEST(input) char **argv; int argc; POINT pos; + HKL layouts[32] = {0}; + int i;
init_function_pointers(); GetCursorPos( &pos );
+ GetKeyboardLayoutList(31, layouts); + trace("pid=%lx\n", (LONG)GetCurrentProcessId()); + for (i = 0; i < 32 && layouts[i]; ++i) trace("hkl[%d]=%p\n", i, layouts[i]); + argc = winetest_get_mainargs(&argv); if (argc >= 3 && !strcmp( argv[2], "rawinput_test" )) return rawinput_test_process(); @@ -5776,6 +5829,7 @@ START_TEST(input) if (argc >= 3 && !strcmp( argv[2], "test_input_desktop" )) return test_input_desktop( argv );
+ run_in_desktop( argv, "test_input_desktop", 1 ); test_keynames(); test_key_map();