From c5fb6b4348dc01aa02846bf7b56e1b0a8a11013c Mon Sep 17 00:00:00 2001 From: DavidSannier Date: Wed, 1 May 2024 08:31:53 +0200 Subject: [PATCH] Refactoring successive press() -> release() calls (#23573) --- tests/basic/test_one_shot_keys.cpp | 50 ++++++------------------------ 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/tests/basic/test_one_shot_keys.cpp b/tests/basic/test_one_shot_keys.cpp index 9748dad7da..64a8673a5c 100644 --- a/tests/basic/test_one_shot_keys.cpp +++ b/tests/basic/test_one_shot_keys.cpp @@ -32,10 +32,7 @@ TEST_F(OneShot, OSMWithoutAdditionalKeypressDoesNothing) { /* Press and release OSM key*/ EXPECT_NO_REPORT(driver); - osm_key.press(); - run_one_scan_loop(); - osm_key.release(); - run_one_scan_loop(); + tap_key(osm_key); VERIFY_AND_CLEAR(driver); /* OSM are added when an actual report is send */ @@ -88,10 +85,7 @@ TEST_P(OneShotParametrizedTestFixture, OSMWithAdditionalKeypress) { /* Press and release OSM */ EXPECT_NO_REPORT(driver); - osm_key.press(); - run_one_scan_loop(); - osm_key.release(); - run_one_scan_loop(); + tap_key(osm_key); VERIFY_AND_CLEAR(driver); /* Press regular key */ @@ -171,18 +165,12 @@ TEST_F(OneShot, OSMChainingTwoOSMs) { /* Press and release OSM1 */ EXPECT_NO_REPORT(driver); - osm_key1.press(); - run_one_scan_loop(); - osm_key1.release(); - run_one_scan_loop(); + tap_key(osm_key1); VERIFY_AND_CLEAR(driver); /* Press and relesea OSM2 */ EXPECT_NO_REPORT(driver); - osm_key2.press(); - run_one_scan_loop(); - osm_key2.release(); - run_one_scan_loop(); + tap_key(osm_key2); VERIFY_AND_CLEAR(driver); /* Press regular key */ @@ -209,22 +197,13 @@ TEST_F(OneShot, OSMDoubleTapNotLockingOSMs) { /* Press and release OSM1 */ EXPECT_NO_REPORT(driver); - osm_key1.press(); - run_one_scan_loop(); - osm_key1.release(); - run_one_scan_loop(); + tap_key(osm_key1); VERIFY_AND_CLEAR(driver); /* Press and release OSM2 twice */ EXPECT_NO_REPORT(driver); - osm_key2.press(); - run_one_scan_loop(); - osm_key2.release(); - run_one_scan_loop(); - osm_key2.press(); - run_one_scan_loop(); - osm_key2.release(); - run_one_scan_loop(); + tap_key(osm_key2); + tap_key(osm_key2); VERIFY_AND_CLEAR(driver); /* Press regular key */ @@ -263,10 +242,7 @@ TEST_F(OneShot, OSMHoldNotLockingOSMs) { /* Press and release OSM1 */ EXPECT_NO_REPORT(driver); - osm_key1.press(); - run_one_scan_loop(); - osm_key1.release(); - run_one_scan_loop(); + tap_key(osm_key1); VERIFY_AND_CLEAR(driver); /* Press and hold OSM2 */ @@ -279,10 +255,7 @@ TEST_F(OneShot, OSMHoldNotLockingOSMs) { /* 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_key2.report_code)).Times(1); - regular_key.press(); - run_one_scan_loop(); - regular_key.release(); - run_one_scan_loop(); + tap_key(regular_key); VERIFY_AND_CLEAR(driver); /* Release OSM2 */ @@ -362,10 +335,7 @@ TEST_F(OneShot, OSLWithOsmAndAdditionalKeypress) { /* Press and release OSM */ EXPECT_NO_REPORT(driver); - osm_key.press(); - run_one_scan_loop(); - osm_key.release(); - run_one_scan_loop(); + tap_key(osm_key); EXPECT_TRUE(layer_state_is(1)); VERIFY_AND_CLEAR(driver);