Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

One-shot modifier doesn't work with the same key on a different layer #1395

Open
shajra opened this issue Feb 24, 2024 · 0 comments
Open

One-shot modifier doesn't work with the same key on a different layer #1395

shajra opened this issue Feb 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@shajra
Copy link

shajra commented Feb 24, 2024

Describe the bug
Hopefully, the title says it all. I forked the project and wrote some tests. There's some prose there with more detail.

To Reproduce
The forked repo should have what you need to reproduce this problem. There are two tests. The first test illustrates that you can indeed have One-shot modifiers on a different layer, and it works when they are on a different key. The second test shows the same setup failing when you use the one-shot modifier in a different layer for the same key.

If you have everything set up to build Kaleidoscope, then the following should run my tests:

rm -rf _build
make simulator-tests TESTS=plugins/OneShot/layered

Here's the output:

Kaleidoscope on  testcase/oneshot-layered 
❯ make simulator-tests TESTS=plugins/OneShot/layered
Building in quiet mode. For a lot more information, add 'VERBOSE=1' to the beginning of your call to make
make -C tests all
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/AbsoluteMouseReport.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/ConsumerControlReport.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/ExpectedKeyboardReport.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/ExpectedMouseReport.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/HIDState.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/KeyboardReport.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/MouseReport.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/SimHarness.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/State.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/SystemControlReport.o
compile /home/tnks/src/fork/Kaleidoscope/_build/obj/VirtualDeviceTest.o
make -C /home/tnks/src/fork/Kaleidoscope/testing/googletest/build
[ 25%] Built target gtest
[ 50%] Built target gmock
[ 75%] Built target gmock_main
[100%] Built target gtest_main
make -C /home/tnks/src/fork/Kaleidoscope/testing/googletest/build
[ 25%] Built target gtest
[ 50%] Built target gmock
[ 75%] Built target gmock_main
[100%] Built target gtest_main
Used library                             Version Path
Kaleidoscope                             0.0.0   /home/tnks/src/fork/Kaleidoscope
Kaleidoscope-Hardware-Model01            0.0.0   /home/tnks/src/fork/Kaleidoscope/plugins/Kaleidoscope-Hardware-Model01
Kaleidoscope-Hardware-Keyboardio-Model01 0.0.0   /home/tnks/src/fork/Kaleidoscope/plugins/Kaleidoscope-Hardware-Keyboardio-Model01
KeyboardioHID                            0.0.1   /home/tnks/src/fork/Kaleidoscope/plugins/KeyboardioHID
Kaleidoscope-OneShot                     0.0.0   /home/tnks/src/fork/Kaleidoscope/plugins/Kaleidoscope-OneShot
Kaleidoscope-Ranges                      0.0.0   /home/tnks/src/fork/Kaleidoscope/plugins/Kaleidoscope-Ranges
Kaleidoscope-FocusSerial                 0.0.0   /home/tnks/src/fork/Kaleidoscope/plugins/Kaleidoscope-FocusSerial
Kaleidoscope-EEPROM-Settings             0.0.0   /home/tnks/src/fork/Kaleidoscope/plugins/Kaleidoscope-EEPROM-Settings

Used platform      Version Path
keyboardio:virtual 1.6.11  /home/tnks/src/fork/Kaleidoscope/.arduino/user/hardware/keyboardio/virtual

Running test plugins/OneShot/layered
[==========] Running 3 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 3 tests from GeneratedKTest
[ RUN      ] GeneratedKTest.0_KtestSourceFilename
[ INFO     ] test: /home/tnks/src/fork/Kaleidoscope/tests/plugins/OneShot/layered/test.ktest
[       OK ] GeneratedKTest.0_KtestSourceFilename (0 ms)
[ RUN      ] GeneratedKTest.1_OneShotDifferentLevelDifferentKey
[       OK ] GeneratedKTest.1_OneShotDifferentLevelDifferentKey (0 ms)
[ RUN      ] GeneratedKTest.2_OneShotDifferentLevelSameKey
/home/tnks/src/fork/Kaleidoscope/testing/VirtualDeviceTest.cpp:164: Failure
Expected equality of these values:
  observed_keyboard_report_count
    Which is: 2
  expected_keyboard_report_count
    Which is: 4
/home/tnks/src/fork/Kaleidoscope/testing/VirtualDeviceTest.cpp:177: Failure
Value of: observed_keycodes
Expected: has 2 elements where
element #0 is equal to '\x4' (4),
element #1 is equal to '\xE1' (225)
  Actual: {}
No explanatory comment specified (i=1)
/home/tnks/src/fork/Kaleidoscope/testing/VirtualDeviceTest.cpp:180: Failure
Expected equality of these values:
  observed_report.Timestamp()
    Which is: 22
  expected_report.Timestamp()
    Which is: 21
Report timestamps don't match (i=1)
[  FAILED  ] GeneratedKTest.2_OneShotDifferentLevelSameKey (0 ms)
[----------] 3 tests from GeneratedKTest (0 ms total)

[----------] Global test environment tear-down
[==========] 3 tests from 1 test suite ran. (0 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] GeneratedKTest.2_OneShotDifferentLevelSameKey

 1 FAILED TEST
make[3]: *** [/home/tnks/src/fork/Kaleidoscope/testing/makefiles/testcase.mk:75: run] Error 1
Test failures: 1
plugins/OneShot/layered failed
make[1]: *** [Makefile:79: aggregate-test-results] Error 1
make: *** [Makefile:82: simulator-tests] Error 2

Expected behavior
I would expect the One-shot modifier to work on any layer, whether it's on the same key or not (both tests should pass as written).

Environment (please complete the following information):

  • OS: Linux and Mac, both
  • Version: I'm using the latest Kaleidoscope code. My OS on the Linux side is NixOS 23.11. MacOS is Sonoma 14.2
  • Device: Model 100

Additional Notes
This problem seems like it's probably related to #1393. I wouldn't be surprised if one fix addresses both issues.

@shajra shajra added the bug Something isn't working label Feb 24, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant