@@ -349,6 +349,7 @@ constexpr uint64_t kScanCodeKeyE = 0x12;
349349constexpr uint64_t kScanCodeKeyQ = 0x10 ;
350350constexpr uint64_t kScanCodeKeyW = 0x11 ;
351351constexpr uint64_t kScanCodeDigit1 = 0x02 ;
352+ constexpr uint64_t kScanCodeDigit6 = 0x07 ;
352353// constexpr uint64_t kScanCodeNumpad1 = 0x4f;
353354// constexpr uint64_t kScanCodeNumLock = 0x45;
354355constexpr uint64_t kScanCodeControl = 0x1d ;
@@ -860,8 +861,112 @@ TEST(KeyboardTest, DeadKeyThatCombines) {
860861 EXPECT_EQ (key_calls.size (), 0 );
861862}
862863
864+ // This tests dead key ^ then E on a US INTL keyboard, which should be combined
865+ // into ê.
866+ //
867+ // It is different from French AZERTY because the character that the ^ key is
868+ // mapped to does not contain the dead key character somehow.
869+ TEST (KeyboardTest, DeadKeyWithoutDeadMaskThatCombines) {
870+ KeyboardTester tester;
871+ tester.Responding (false );
872+
873+ // Press ShiftLeft
874+ tester.SetKeyState (VK_LSHIFT, true , true );
875+ tester.InjectMessages (
876+ 1 ,
877+ WmKeyDownInfo{VK_SHIFT, kScanCodeShiftLeft , kNotExtended , kWasUp }.Build (
878+ kWmResultZero ));
879+
880+ EXPECT_EQ (key_calls.size (), 1 );
881+ EXPECT_CALL_IS_EVENT (key_calls[0 ], kFlutterKeyEventTypeDown ,
882+ kPhysicalShiftLeft , kLogicalShiftLeft , " " ,
883+ kNotSynthesized );
884+ clear_key_calls ();
885+
886+ tester.InjectPendingEvents ();
887+ EXPECT_EQ (key_calls.size (), 0 );
888+ clear_key_calls ();
889+
890+ // Press 6^
891+ tester.InjectMessages (
892+ 2 ,
893+ WmKeyDownInfo{' 6' , kScanCodeDigit6 , kNotExtended , kWasUp }.Build (
894+ kWmResultZero ),
895+ WmDeadCharInfo{' ^' , kScanCodeDigit6 , kNotExtended , kWasUp }.Build (
896+ kWmResultZero ));
897+
898+ EXPECT_EQ (key_calls.size (), 1 );
899+ EXPECT_CALL_IS_EVENT (key_calls[0 ], kFlutterKeyEventTypeDown , kPhysicalDigit6 ,
900+ kLogicalDigit6 , " 6" , kNotSynthesized );
901+ clear_key_calls ();
902+
903+ EXPECT_EQ (tester.InjectPendingEvents (), 0 );
904+ EXPECT_EQ (key_calls.size (), 0 );
905+ clear_key_calls ();
906+
907+ // Release 6^
908+ tester.InjectMessages (
909+ 1 , WmKeyUpInfo{' 6' , kScanCodeDigit6 , kNotExtended }.Build (kWmResultZero ));
910+
911+ EXPECT_EQ (key_calls.size (), 1 );
912+ EXPECT_CALL_IS_EVENT (key_calls[0 ], kFlutterKeyEventTypeUp , kPhysicalDigit6 ,
913+ kLogicalDigit6 , " " , kNotSynthesized );
914+ clear_key_calls ();
915+
916+ tester.InjectPendingEvents ();
917+ EXPECT_EQ (key_calls.size (), 0 );
918+ clear_key_calls ();
919+
920+ // Release ShiftLeft
921+ tester.SetKeyState (VK_LSHIFT, false , true );
922+ tester.InjectMessages (
923+ 1 , WmKeyUpInfo{VK_SHIFT, kScanCodeShiftLeft , kNotExtended }.Build (
924+ kWmResultZero ));
925+
926+ EXPECT_EQ (key_calls.size (), 1 );
927+ EXPECT_CALL_IS_EVENT (key_calls[0 ], kFlutterKeyEventTypeUp , kPhysicalShiftLeft ,
928+ kLogicalShiftLeft , " " , kNotSynthesized );
929+ clear_key_calls ();
930+
931+ tester.InjectPendingEvents ();
932+ EXPECT_EQ (key_calls.size (), 0 );
933+ clear_key_calls ();
934+
935+ // Press E
936+ tester.InjectMessages (
937+ 2 ,
938+ WmKeyDownInfo{kVirtualKeyE , kScanCodeKeyE , kNotExtended , kWasUp }.Build (
939+ kWmResultZero ),
940+ WmCharInfo{0xEA , kScanCodeKeyE , kNotExtended , kWasUp }.Build (
941+ kWmResultZero ));
942+
943+ EXPECT_EQ (key_calls.size (), 1 );
944+ EXPECT_CALL_IS_EVENT (key_calls[0 ], kFlutterKeyEventTypeDown , kPhysicalKeyE ,
945+ kLogicalKeyE , " ê" , kNotSynthesized );
946+ clear_key_calls ();
947+
948+ tester.InjectPendingEvents (
949+ 0xEA ); // The redispatched event uses unmodified 'e'
950+ EXPECT_EQ (key_calls.size (), 1 );
951+ EXPECT_CALL_IS_TEXT (key_calls[0 ], u" ê" );
952+ clear_key_calls ();
953+
954+ // Release E
955+ tester.InjectMessages (
956+ 1 , WmKeyUpInfo{kVirtualKeyE , kScanCodeKeyE , kNotExtended }.Build (
957+ kWmResultZero ));
958+
959+ EXPECT_EQ (key_calls.size (), 1 );
960+ EXPECT_CALL_IS_EVENT (key_calls[0 ], kFlutterKeyEventTypeUp , kPhysicalKeyE ,
961+ kLogicalKeyE , " " , kNotSynthesized );
962+ clear_key_calls ();
963+
964+ tester.InjectPendingEvents ();
965+ EXPECT_EQ (key_calls.size (), 0 );
966+ }
967+
863968// This tests dead key ^ then & (US: 1) on a French keyboard, which do not
864- // combine and should output "^$ ".
969+ // combine and should output "^& ".
865970TEST (KeyboardTest, DeadKeyThatDoesNotCombine) {
866971 KeyboardTester tester;
867972 tester.Responding (false );
0 commit comments