Harald Albrecht
5 years ago
13 changed files with 162 additions and 150 deletions
@ -1,24 +0,0 @@ |
|||
require "keybow" |
|||
|
|||
function keybow.set_pixel(pix, r, g, b) |
|||
-- print("set_pixel " .. pix .. "(" .. r .. "," .. g .. "," .. b .. ")") |
|||
end |
|||
|
|||
function keybow.auto_lights(onoff) |
|||
-- print("auto_lights", onoff) |
|||
end |
|||
|
|||
function keybow.clear_lights() |
|||
-- print("clear_lights") |
|||
end |
|||
|
|||
function keybow.tap_key(key) |
|||
print("tap_key " .. tostring(key)) |
|||
end |
|||
|
|||
function keybow.set_modifier(mod, key) |
|||
print("set_modifier " .. mod .. "," .. tostring(key)) |
|||
end |
|||
|
|||
require "keys" |
|||
setup() |
@ -0,0 +1,66 @@ |
|||
-- Tests all available multibow layouts in a single setup, thus trying to |
|||
-- mimic the final Keybow firmware installation as close as possible (for some |
|||
-- suitable definition of "close"). |
|||
|
|||
--[[ |
|||
Copyright 2019 Harald Albrecht |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
of this software and associated documentation files (the "Software"), to deal |
|||
in the Software without restriction, including without limitation the rights |
|||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|||
copies of the Software, and to permit persons to whom the Software is |
|||
furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be included in all |
|||
copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|||
SOFTWARE. |
|||
]]-- |
|||
|
|||
require("mocked-keybow") |
|||
|
|||
require "layouts/shift" |
|||
require "layouts/kdenlive" |
|||
local vscgolang = require "layouts/vsc-golang" |
|||
require "layouts/empty" |
|||
|
|||
local mb = require("snippets/multibow") |
|||
local hwk = require("spec/hwkeys") |
|||
|
|||
describe("final Multibow integration", function() |
|||
|
|||
it("correctly integrates", function() |
|||
local kms = mb.registered_keymaps() |
|||
-- shift: 2 registered keymaps |
|||
-- vsc-golang: 1 reg keymap |
|||
-- kdenlive: 2 reg keymaps |
|||
-- empty: 1 reg keymap |
|||
assert.is.equal(6, #kms) |
|||
end) |
|||
|
|||
-- inslit() is an insulated(it()) ensuring that all stubs and spies get |
|||
-- removed after this test in any case. |
|||
inslit("starts gonelang debugging :)", function() |
|||
-- Switches to the VSC Golang Multibow keymap, regardless of the |
|||
-- order of keymap imports. |
|||
mb.activate_keymap(vscgolang.keymap.name) |
|||
assert.is.equal(vscgolang.keymap.name, mb.current_keymap.name) |
|||
assert.is.equal(vscgolang.debug_continue, vscgolang.keymap[vscgolang.KEY_CONT].press) |
|||
|
|||
-- Checks that a press of the "Continue Debugging" key does in fact |
|||
-- trigger the corresponding keymap handler. |
|||
local s = stub(vscgolang.keymap[vscgolang.KEY_CONT], "press") |
|||
hwk.tap(vscgolang.KEY_STEPOVER) |
|||
assert.stub(s).was_not.called() |
|||
hwk.tap(vscgolang.KEY_CONT) |
|||
assert.stub(s).was.called(1) |
|||
end) |
|||
|
|||
end) |
@ -1,48 +0,0 @@ |
|||
package.path = "./sdcard/?.lua;./mock/?.lua;" .. package.path |
|||
|
|||
require "mockkeybow" |
|||
|
|||
print() |
|||
print("**** key 00...") |
|||
handle_key_00(true) |
|||
handle_key_00(false) |
|||
print() |
|||
print("**** key 03...") |
|||
handle_key_03(true) |
|||
handle_key_03(false) |
|||
|
|||
print() |
|||
print("**** key 00...") |
|||
handle_key_00(true) |
|||
handle_key_00(false) |
|||
|
|||
print() |
|||
print("**** key 11+05...") |
|||
handle_key_11(true) |
|||
handle_key_05(true) |
|||
handle_key_05(false) |
|||
handle_key_11(false) |
|||
|
|||
print() |
|||
print("**** key 00...") |
|||
handle_key_00(true) |
|||
handle_key_00(false) |
|||
|
|||
print() |
|||
print("**** key 11+08...") |
|||
handle_key_11(true) |
|||
handle_key_08(true) |
|||
handle_key_08(false) |
|||
handle_key_11(false) |
|||
|
|||
print() |
|||
print("**** key 11...") |
|||
handle_key_11(true) |
|||
handle_key_11(false) |
|||
|
|||
print() |
|||
print("**** key 11+08...") |
|||
handle_key_11(true) |
|||
handle_key_08(true) |
|||
handle_key_08(false) |
|||
handle_key_11(false) |
Loading…
Reference in new issue