CI / test (push) Failing after 16s
moon-plasma / moonplasma / MoonPlasma / Moon Plasma become chandra / Chandra everywhere: the WIT package (chandra:desktop, chandra:host, chandra:wm), the MoonBit module (chandra/desktop) and generated bindings, the Rust host, identifiers (ChandraCompositor), the session script (chandra-session) and desktop entry (chandra.desktop), config and data paths ($XDG_CONFIG_HOME/chandra, share/chandra/modules), env vars (CHANDRA_*), UI strings, docs and tests. The test fixture components are rebuilt against the renamed WIT. Saved panel.edn and state.edn are still read from the old $XDG_CONFIG_HOME/moon-plasma until the first save writes the new copy. The remote repository keeps its experiments/moon-plasma name for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hi3L9oVBoRd373Qr4n
59 lines
2.5 KiB
MoonBit
59 lines
2.5 KiB
MoonBit
///| Interface Explorer: toggle from the panel, hover components, see their WIT.
|
|
|
|
///|
|
|
test "inspector shows the WIT interface of the hovered component" {
|
|
let socket_path = "/tmp/wayland-moon-inspect-" +
|
|
@sys.getpid().to_string() +
|
|
".sock"
|
|
let theme = @scene.ThemeTokens::moon_night()
|
|
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
|
|
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(
|
|
comp, socket_path, "T", "t",
|
|
)
|
|
commit_shm_frame(comp, c, shm, surf, xdg, 1UL)
|
|
ignore(comp.compose_frame()) // lays out the panel
|
|
assert_false(comp.shell.inspecting())
|
|
|
|
// Open the apps popup first; turning the explorer on must not close it.
|
|
let (lx, ly) = center_of(comp, "launcher")
|
|
click_at(comp, lx.to_int(), ly.to_int(), 0U)
|
|
assert_true(comp.shell.popup_open())
|
|
|
|
// Click the Interface Explorer button to turn inspect mode on.
|
|
let (bx, by) = center_of(comp, "inspector")
|
|
click_at(comp, bx.to_int(), by.to_int(), 1U)
|
|
assert_true(comp.shell.inspecting())
|
|
assert_true(comp.shell.popup_open())
|
|
assert_eq(comp.desired_cursor(), 4U)
|
|
|
|
// Hover the launcher.
|
|
let (lx, ly) = center_of(comp, "launcher")
|
|
comp.handle_input(@nested.InputEvent::PointerMove(lx, ly), 4U)
|
|
let lslot = comp.shell.slot_of("launcher")
|
|
assert_eq(comp.shell.hover_id, lslot)
|
|
assert_eq(comp.desired_cursor(), 3U)
|
|
// The explorer describes the module's real binary: what it exports and which capabilities it imports.
|
|
let lines = comp.shell.inspector_lines_for(lslot)
|
|
assert_true(lines.iter().any(l => l.has_prefix("# plasmoid")))
|
|
assert_true(lines.iter().any(l => l.has_prefix("# app launch")))
|
|
assert_true(lines.iter().any(l => l.has_prefix("# app catalog")))
|
|
let frame = comp.compose_frame()
|
|
let png = @renderer.encode_png(frame)
|
|
ignore(@sys.write_file_bytes("_build/inspector_launcher.png", png))
|
|
|
|
// Clock, panel, window title bar and desktop resolve to their own components.
|
|
let (cx, cy) = center_of(comp, "clock-digital12")
|
|
comp.handle_input(@nested.InputEvent::PointerMove(cx, cy), 5U)
|
|
assert_eq(comp.shell.hover_id, comp.shell.slot_of("clock-digital12"))
|
|
comp.handle_input(@nested.InputEvent::PointerMove(1270.0, 5.0), 6U)
|
|
assert_eq(comp.shell.hover_id, "desktop")
|
|
|
|
// Clicks are swallowed while inspecting; Escape leaves the mode.
|
|
comp.handle_input(@nested.InputEvent::PointerButton(0x110U, true), 7U)
|
|
assert_true(comp.shell.popup_open()) // unchanged: the click was swallowed
|
|
comp.handle_input(@nested.InputEvent::Key(1U, true), 8U)
|
|
assert_false(comp.shell.inspecting())
|
|
comp.close()
|
|
}
|
|
|