1
0
Fork 0
forked from wry/wry

tree: activate workspace on click

This commit is contained in:
Julian Orth 2022-05-17 18:58:30 +02:00
parent 70cc24107b
commit 858e777f5a
7 changed files with 127 additions and 13 deletions

View file

@ -43,6 +43,7 @@ mod t0014_container_scroll_focus;
mod t0015_scroll_partial;
mod t0016_scroll_ws;
mod t0017_remove_unused_ws;
mod t0018_click_to_active_ws;
pub trait TestCase: Sync {
fn name(&self) -> &'static str;
@ -78,5 +79,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
t0015_scroll_partial,
t0016_scroll_ws,
t0017_remove_unused_ws,
t0018_click_to_active_ws,
}
}

View file

@ -0,0 +1,46 @@
use {
crate::{
ifs::wl_seat::BTN_LEFT,
it::{test_error::TestResult, testrun::TestRun},
},
std::rc::Rc,
};
testcase!();
async fn test(run: Rc<TestRun>) -> TestResult {
let ds = run.create_default_setup().await?;
run.cfg.show_workspace(ds.seat.id(), "1")?;
let client = run.create_client().await?;
let win1 = client.create_window().await?;
win1.map().await?;
run.cfg.show_workspace(ds.seat.id(), "2")?;
let win2 = client.create_window().await?;
win2.map().await?;
ds.mouse.abs(&ds.connector, 0.0, 0.0);
ds.mouse.click(BTN_LEFT);
client.sync().await;
let name = ds.output.workspace.get().map(|ws| ws.name.clone());
tassert_eq!(name.as_deref(), Some("1"));
let pos = {
let rd = ds.output.render_data.borrow_mut();
rd.titles.last().map(|t| t.x1).unwrap_or(0)
};
ds.mouse.abs(&ds.connector, pos as _, 0.0);
ds.mouse.click(BTN_LEFT);
client.sync().await;
let name = ds.output.workspace.get().map(|ws| ws.name.clone());
tassert_eq!(name.as_deref(), Some("2"));
Ok(())
}