feat: implement declarative scratchpads
This commit is contained in:
parent
d756c8a6a2
commit
b6502e1d8a
17 changed files with 549 additions and 78 deletions
|
|
@ -298,6 +298,13 @@ impl TestConfig {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn cycle_scratchpad(&self, seat: SeatId, name: &str) -> TestResult {
|
||||
self.send(ClientMessage::SeatCycleScratchpad {
|
||||
seat: Seat(seat.raw() as _),
|
||||
name,
|
||||
})
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
unsafe {
|
||||
if let Some(srv) = self.srv.take() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{test_error::TestResult, testrun::TestRun},
|
||||
tree::Node,
|
||||
tree::{Node, ToplevelNodeBase},
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
|
@ -45,6 +45,63 @@ async fn test(run: Rc<TestRun>) -> TestResult {
|
|||
client.sync().await;
|
||||
tassert!(win2.tl.server.node_visible());
|
||||
tassert_eq!(ds.output.workspace.get().unwrap().name.as_str(), "3");
|
||||
// Scratchpad windows are always shown floating.
|
||||
tassert!(win2.tl.server.tl_data().parent_is_float.get());
|
||||
|
||||
// Park win2 again, then build a multi-window scratchpad and cycle it.
|
||||
run.cfg.toggle_scratchpad(ds.seat.id(), "term")?;
|
||||
client.sync().await;
|
||||
tassert!(!win2.tl.server.node_visible());
|
||||
|
||||
// Build a three-window scratchpad. Each window is focused right after it is
|
||||
// mapped, so sending the focused window parks them in a known order.
|
||||
let cyc1 = client.create_window().await?;
|
||||
cyc1.map2().await?;
|
||||
run.cfg.send_to_scratchpad(ds.seat.id(), "cyc")?;
|
||||
let cyc2 = client.create_window().await?;
|
||||
cyc2.map2().await?;
|
||||
run.cfg.send_to_scratchpad(ds.seat.id(), "cyc")?;
|
||||
let cyc3 = client.create_window().await?;
|
||||
cyc3.map2().await?;
|
||||
run.cfg.send_to_scratchpad(ds.seat.id(), "cyc")?;
|
||||
client.sync().await;
|
||||
tassert!(!cyc1.tl.server.node_visible());
|
||||
tassert!(!cyc2.tl.server.node_visible());
|
||||
tassert!(!cyc3.tl.server.node_visible());
|
||||
|
||||
// Nothing shown: cycle brings up the first window (insertion order: cyc1).
|
||||
run.cfg.cycle_scratchpad(ds.seat.id(), "cyc")?;
|
||||
client.sync().await;
|
||||
tassert!(cyc1.tl.server.node_visible());
|
||||
tassert!(!cyc2.tl.server.node_visible());
|
||||
tassert!(!cyc3.tl.server.node_visible());
|
||||
// Scratchpad windows are always shown floating.
|
||||
tassert!(cyc1.tl.server.tl_data().parent_is_float.get());
|
||||
|
||||
// Cycle advances one at a time.
|
||||
run.cfg.cycle_scratchpad(ds.seat.id(), "cyc")?;
|
||||
client.sync().await;
|
||||
tassert!(!cyc1.tl.server.node_visible());
|
||||
tassert!(cyc2.tl.server.node_visible());
|
||||
tassert!(!cyc3.tl.server.node_visible());
|
||||
|
||||
run.cfg.cycle_scratchpad(ds.seat.id(), "cyc")?;
|
||||
client.sync().await;
|
||||
tassert!(!cyc1.tl.server.node_visible());
|
||||
tassert!(!cyc2.tl.server.node_visible());
|
||||
tassert!(cyc3.tl.server.node_visible());
|
||||
|
||||
// On the final window, the next cycle hides everything.
|
||||
run.cfg.cycle_scratchpad(ds.seat.id(), "cyc")?;
|
||||
client.sync().await;
|
||||
tassert!(!cyc1.tl.server.node_visible());
|
||||
tassert!(!cyc2.tl.server.node_visible());
|
||||
tassert!(!cyc3.tl.server.node_visible());
|
||||
|
||||
// And it wraps back to the first window.
|
||||
run.cfg.cycle_scratchpad(ds.seat.id(), "cyc")?;
|
||||
client.sync().await;
|
||||
tassert!(cyc1.tl.server.node_visible());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue