summaryrefslogtreecommitdiffhomepage
path: root/packages/ext-keybindings/tests/test_policy.cpp
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-14 00:26:07 +0900
committerAdam Malczewski <[email protected]>2026-06-14 00:26:07 +0900
commit151fbb589f99aa25f40c2ddb2562c992ef5d3adf (patch)
treeb6016ed63a86fa1f131ac393a9c1e504269ee483 /packages/ext-keybindings/tests/test_policy.cpp
parentf7df36c8f656652e8245d781b35cb3252f17bad2 (diff)
downloadunbox-151fbb589f99aa25f40c2ddb2562c992ef5d3adf.tar.gz
unbox-151fbb589f99aa25f40c2ddb2562c992ef5d3adf.zip
ext-keybindings + ext-stage-dock: config-driven dock-toggle-visible (Super+d)
- **ext-stage-dock**: exports a `Service` interface with `toggle_visible()`. The extension inherits from it and registers via `provide_service` in `activate()`. The method slides the dock in/out (using the existing RCSS transition) regardless of slot count; showing an empty dock is valid. - **ext-keybindings**: new `Action::dock_toggle_visible` action, mapped from `"dock-toggle-visible"` in `unbox.toml [[keybind]]`, dispatched to the stage-dock Service. Default binding: `Super+d`. - **Manifest**: ext-keybindings now `depends_on {"xdg-shell", "stage-dock"}`. - **Build**: subdir order swapped so ext-stage-dock builds before ext-keybindings; `ext_stage_dock_dep` is a link-time dep of the ext-keybindings library and transitively exposed via `ext_keybindings_dep`. - **Tests**: glue tests install ext-stage-dock alongside ext-xdg-shell; policy test expects 6 default bindings. All 10/10 green on build + build-asan. Configure in unbox.toml: [[keybind]] keys = "Super+d" action = "dock-toggle-visible"
Diffstat (limited to 'packages/ext-keybindings/tests/test_policy.cpp')
-rw-r--r--packages/ext-keybindings/tests/test_policy.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/ext-keybindings/tests/test_policy.cpp b/packages/ext-keybindings/tests/test_policy.cpp
index 8b6b91b..d7fd32e 100644
--- a/packages/ext-keybindings/tests/test_policy.cpp
+++ b/packages/ext-keybindings/tests/test_policy.cpp
@@ -165,7 +165,7 @@ TEST_CASE("empty / keybind-less document yields zero bindings, not an error") {
TEST_CASE("compiled defaults match the documented out-of-the-box set") {
auto d = pol::default_bindings();
- REQUIRE(d.size() == 5);
+ REQUIRE(d.size() == 6);
CHECK(d[0].combo.is_tap);
CHECK(d[0].combo.modifiers == pol::mod_logo);
CHECK(d[0].action == Action::spawn);
@@ -178,6 +178,8 @@ TEST_CASE("compiled defaults match the documented out-of-the-box set") {
CHECK(d[3].action == Action::focus_next);
CHECK(d[4].combo == parse_combo("Ctrl+Alt+BackSpace").value());
CHECK(d[4].action == Action::quit);
+ CHECK(d[5].combo == parse_combo("Super+d").value());
+ CHECK(d[5].action == Action::dock_toggle_visible);
}
// ============================================================================
@@ -236,11 +238,11 @@ TEST_CASE("reload: a valid-but-empty doc keeps the old table (never drops workin
// mid-edit with the [[keybind]] block deleted, or every entry malformed)
// must NOT swap — the user's live keys survive.
std::vector<Binding> live = pol::default_bindings();
- REQUIRE(live.size() == 5);
+ REQUIRE(live.size() == 6);
auto empty = cfg::reload_bindings(live, "title = \"unrelated\"\n");
CHECK_FALSE(empty.swapped);
- REQUIRE(empty.bindings.size() == 5);
+ REQUIRE(empty.bindings.size() == 6);
CHECK(empty.bindings == live); // kept
// Same for a doc where every entry is individually skipped (all malformed).