1
0
Fork 0
forked from forks/qmk_firmware

Refactoring successive press() -> release() calls (#23573)

This commit is contained in:
DavidSannier 2024-05-01 08:31:53 +02:00 committed by GitHub
parent 54c1ae55bf
commit c5fb6b4348
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,10 +32,7 @@ TEST_F(OneShot, OSMWithoutAdditionalKeypressDoesNothing) {
/* Press and release OSM key*/ /* Press and release OSM key*/
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key.press(); tap_key(osm_key);
run_one_scan_loop();
osm_key.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* OSM are added when an actual report is send */ /* OSM are added when an actual report is send */
@ -88,10 +85,7 @@ TEST_P(OneShotParametrizedTestFixture, OSMWithAdditionalKeypress) {
/* Press and release OSM */ /* Press and release OSM */
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key.press(); tap_key(osm_key);
run_one_scan_loop();
osm_key.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* Press regular key */ /* Press regular key */
@ -171,18 +165,12 @@ TEST_F(OneShot, OSMChainingTwoOSMs) {
/* Press and release OSM1 */ /* Press and release OSM1 */
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key1.press(); tap_key(osm_key1);
run_one_scan_loop();
osm_key1.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* Press and relesea OSM2 */ /* Press and relesea OSM2 */
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key2.press(); tap_key(osm_key2);
run_one_scan_loop();
osm_key2.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* Press regular key */ /* Press regular key */
@ -209,22 +197,13 @@ TEST_F(OneShot, OSMDoubleTapNotLockingOSMs) {
/* Press and release OSM1 */ /* Press and release OSM1 */
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key1.press(); tap_key(osm_key1);
run_one_scan_loop();
osm_key1.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* Press and release OSM2 twice */ /* Press and release OSM2 twice */
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key2.press(); tap_key(osm_key2);
run_one_scan_loop(); tap_key(osm_key2);
osm_key2.release();
run_one_scan_loop();
osm_key2.press();
run_one_scan_loop();
osm_key2.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* Press regular key */ /* Press regular key */
@ -263,10 +242,7 @@ TEST_F(OneShot, OSMHoldNotLockingOSMs) {
/* Press and release OSM1 */ /* Press and release OSM1 */
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key1.press(); tap_key(osm_key1);
run_one_scan_loop();
osm_key1.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* Press and hold OSM2 */ /* Press and hold OSM2 */
@ -279,10 +255,7 @@ TEST_F(OneShot, OSMHoldNotLockingOSMs) {
/* Press and release regular key */ /* Press and release regular key */
EXPECT_REPORT(driver, (osm_key1.report_code, osm_key2.report_code, regular_key.report_code)).Times(1); EXPECT_REPORT(driver, (osm_key1.report_code, osm_key2.report_code, regular_key.report_code)).Times(1);
EXPECT_REPORT(driver, (osm_key2.report_code)).Times(1); EXPECT_REPORT(driver, (osm_key2.report_code)).Times(1);
regular_key.press(); tap_key(regular_key);
run_one_scan_loop();
regular_key.release();
run_one_scan_loop();
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);
/* Release OSM2 */ /* Release OSM2 */
@ -362,10 +335,7 @@ TEST_F(OneShot, OSLWithOsmAndAdditionalKeypress) {
/* Press and release OSM */ /* Press and release OSM */
EXPECT_NO_REPORT(driver); EXPECT_NO_REPORT(driver);
osm_key.press(); tap_key(osm_key);
run_one_scan_loop();
osm_key.release();
run_one_scan_loop();
EXPECT_TRUE(layer_state_is(1)); EXPECT_TRUE(layer_state_is(1));
VERIFY_AND_CLEAR(driver); VERIFY_AND_CLEAR(driver);