@@ -81,21 +81,41 @@ TEST(ProjectSceneTest, HandleKeyPressAndRelease)
8181 for (const auto &[qtKey, scratchKey] : SPECIAL_KEY_MAP) {
8282 KeyEvent event (scratchKey);
8383 EXPECT_CALL (engine, setKeyState (event.name (), true ));
84+ EXPECT_CALL (engine, setAnyKeyPressed (true ));
8485 scene.handleKeyPress (qtKey, " test" );
8586
8687 EXPECT_CALL (engine, setKeyState (event.name (), false ));
88+ EXPECT_CALL (engine, setAnyKeyPressed (false ));
8789 scene.handleKeyRelease (qtKey, " test" );
8890 }
8991
9092 EXPECT_CALL (engine, setKeyState (" a" , true ));
93+ EXPECT_CALL (engine, setAnyKeyPressed (true ));
9194 scene.handleKeyPress (Qt::Key_A, " a" );
9295
9396 EXPECT_CALL (engine, setKeyState (" a" , false ));
97+ EXPECT_CALL (engine, setAnyKeyPressed (false ));
9498 scene.handleKeyRelease (Qt::Key_A, " a" );
9599
96100 EXPECT_CALL (engine, setKeyState (" 0" , true ));
101+ EXPECT_CALL (engine, setAnyKeyPressed (true ));
97102 scene.handleKeyPress (Qt::Key_0, " 0" );
98103
99104 EXPECT_CALL (engine, setKeyState (" 0" , false ));
105+ EXPECT_CALL (engine, setAnyKeyPressed (false ));
100106 scene.handleKeyRelease (Qt::Key_0, " 0" );
107+
108+ EXPECT_CALL (engine, setAnyKeyPressed (true ));
109+ scene.handleKeyPress (Qt::Key_Control, " " );
110+
111+ EXPECT_CALL (engine, setKeyState (" a" , true ));
112+ EXPECT_CALL (engine, setAnyKeyPressed (true ));
113+ scene.handleKeyPress (Qt::Key_A, " a" );
114+
115+ EXPECT_CALL (engine, setKeyState (" a" , false ));
116+ EXPECT_CALL (engine, setAnyKeyPressed).Times (0 );
117+ scene.handleKeyRelease (Qt::Key_A, " a" );
118+
119+ EXPECT_CALL (engine, setAnyKeyPressed (false ));
120+ scene.handleKeyRelease (Qt::Key_Control, " " );
101121}
0 commit comments