From 9f65e808c0c24f656a3ad77ea4d85adafa99c64c Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 15 Jun 2021 00:19:49 -0500 Subject: [PATCH] Add override of OneShot.isStickable() to testcase Signed-off-by: Michael Richters --- tests/issues/1061/1061.ino | 8 ++++- tests/issues/1061/test.ktest | 68 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/tests/issues/1061/1061.ino b/tests/issues/1061/1061.ino index f9d8b275..df2c20cd 100644 --- a/tests/issues/1061/1061.ino +++ b/tests/issues/1061/1061.ino @@ -21,7 +21,7 @@ KEYMAPS( [0] = KEYMAP_STACKED ( - Key_Insert, ___, ___, ___, ___, ___, ___, + Key_Insert, OSM(LeftAlt), OSM(RightAlt), ___, ___, ___, ___, Key_A, Key_B, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, @@ -51,6 +51,12 @@ class OneShotInsert : public Plugin { } }; +bool OneShot::isStickable(Key key) { + if (key == Key_LeftAlt) + return false; + return OneShot::isStickableDefault(key); +} + } // namespace plugin } // namespace kaleidoscope diff --git a/tests/issues/1061/test.ktest b/tests/issues/1061/test.ktest index 1d72c372..ee4aecd9 100644 --- a/tests/issues/1061/test.ktest +++ b/tests/issues/1061/test.ktest @@ -1,6 +1,8 @@ VERSION 1 KEYSWITCH INSERT 0 0 +KEYSWITCH LALT 0 1 +KEYSWITCH RALT 0 2 KEYSWITCH A 1 0 KEYSWITCH B 1 1 @@ -98,3 +100,69 @@ RUN 1 cycle EXPECT keyboard-report empty RUN 5 ms + +# ============================================================================== +NAME OneShot left alt not sticky + +RUN 4 ms +PRESS LALT +RUN 1 cycle +EXPECT keyboard-report Key_LeftAlt + +RUN 4 ms +RELEASE LALT +RUN 1 cycle + +RUN 4 ms +PRESS LALT +RUN 1 cycle + +RUN 4 ms +RELEASE LALT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms + +# ============================================================================== +NAME OneShot right alt sticky + +RUN 4 ms +PRESS RALT +RUN 1 cycle +EXPECT keyboard-report Key_RightAlt + +RUN 4 ms +RELEASE RALT +RUN 1 cycle + +RUN 4 ms +PRESS RALT +RUN 1 cycle + +RUN 4 ms +RELEASE RALT +RUN 1 cycle + +RUN 4 ms +PRESS A +RUN 1 cycle +EXPECT keyboard-report Key_RightAlt Key_A + +RUN 4 ms +RELEASE A +RUN 1 cycle +EXPECT keyboard-report Key_RightAlt + +RUN 100 ms + +RUN 4 ms +PRESS RALT +RUN 1 cycle + +RUN 4 ms +RELEASE RALT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms