From: Alexandros Frantzis alexandros.frantzis@collabora.com
--- dlls/user32/tests/input.c | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 527ee6d8785..540701bd2a7 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 ); @@ -4889,27 +4916,34 @@ static void test_SendInput( WORD vkey, WCHAR wch ) ok_ne( NULL, hwnd, HWND, "%p" ); wait_messages( 100, FALSE );
+ trace( "hkl=%p\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 +4951,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 +4978,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 +4994,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 +5012,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 +5024,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 +5752,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();