feat: implement scratchpad window toggling
This commit is contained in:
parent
5c2f631fdb
commit
d756c8a6a2
17 changed files with 515 additions and 3 deletions
|
|
@ -284,6 +284,20 @@ impl TestConfig {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn send_to_scratchpad(&self, seat: SeatId, name: &str) -> TestResult {
|
||||
self.send(ClientMessage::SeatSendToScratchpad {
|
||||
seat: Seat(seat.raw() as _),
|
||||
name,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn toggle_scratchpad(&self, seat: SeatId, name: &str) -> TestResult {
|
||||
self.send(ClientMessage::SeatToggleScratchpad {
|
||||
seat: Seat(seat.raw() as _),
|
||||
name,
|
||||
})
|
||||
}
|
||||
|
||||
fn clear(&self) {
|
||||
unsafe {
|
||||
if let Some(srv) = self.srv.take() {
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ mod t0052_bar;
|
|||
mod t0053_theme;
|
||||
mod t0054_subsurface_already_attached;
|
||||
mod t0055_autotiling;
|
||||
mod t0055_scratchpad;
|
||||
|
||||
pub trait TestCase: Sync {
|
||||
fn name(&self) -> &'static str;
|
||||
|
|
@ -160,5 +161,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
|
|||
t0053_theme,
|
||||
t0054_subsurface_already_attached,
|
||||
t0055_autotiling,
|
||||
t0055_scratchpad,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
50
src/it/tests/t0055_scratchpad.rs
Normal file
50
src/it/tests/t0055_scratchpad.rs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{test_error::TestResult, testrun::TestRun},
|
||||
tree::Node,
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
testcase!();
|
||||
|
||||
async fn test(run: Rc<TestRun>) -> TestResult {
|
||||
let ds = run.create_default_setup().await?;
|
||||
|
||||
let client = run.create_client().await?;
|
||||
let win1 = client.create_window().await?;
|
||||
win1.map2().await?;
|
||||
let win2 = client.create_window().await?;
|
||||
win2.map2().await?;
|
||||
|
||||
run.cfg.send_to_scratchpad(ds.seat.id(), "term")?;
|
||||
client.sync().await;
|
||||
tassert!(win1.tl.server.node_visible());
|
||||
tassert!(!win2.tl.server.node_visible());
|
||||
|
||||
run.cfg.show_workspace(ds.seat.id(), "2")?;
|
||||
run.cfg.toggle_scratchpad(ds.seat.id(), "term")?;
|
||||
client.sync().await;
|
||||
tassert!(win2.tl.server.node_visible());
|
||||
tassert_eq!(ds.output.workspace.get().unwrap().name.as_str(), "2");
|
||||
|
||||
run.cfg.toggle_scratchpad(ds.seat.id(), "term")?;
|
||||
client.sync().await;
|
||||
tassert!(!win2.tl.server.node_visible());
|
||||
|
||||
run.cfg.toggle_scratchpad(ds.seat.id(), "term")?;
|
||||
client.sync().await;
|
||||
tassert!(win2.tl.server.node_visible());
|
||||
tassert_eq!(ds.output.workspace.get().unwrap().name.as_str(), "2");
|
||||
|
||||
run.cfg.show_workspace(ds.seat.id(), "3")?;
|
||||
client.sync().await;
|
||||
tassert!(!win2.tl.server.node_visible());
|
||||
|
||||
run.cfg.toggle_scratchpad(ds.seat.id(), "term")?;
|
||||
client.sync().await;
|
||||
tassert!(win2.tl.server.node_visible());
|
||||
tassert_eq!(ds.output.workspace.get().unwrap().name.as_str(), "3");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue