1
0
Fork 0
forked from wry/wry

tree: ensure that node is marked active after un-fullscreening

This commit is contained in:
Julian Orth 2022-05-04 16:33:28 +02:00
parent 23f1aa5a31
commit 8c3106f631
5 changed files with 58 additions and 14 deletions

View file

@ -181,6 +181,13 @@ impl TestConfig {
})
}
pub fn set_fullscreen(&self, seat: SeatId, fs: bool) -> TestResult {
self.send(ClientMessage::SetFullscreen {
seat: Seat(seat.raw() as _),
fullscreen: fs,
})
}
fn clear(&self) {
unsafe {
if let Some(srv) = self.srv.take() {

View file

@ -35,6 +35,7 @@ mod t0006_region;
mod t0007_subsurface;
mod t0008_map_focus;
mod t0009_tab_focus;
mod t0010_fullscreen_focus;
pub trait TestCase: Sync {
fn name(&self) -> &'static str;
@ -62,5 +63,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
t0007_subsurface,
t0008_map_focus,
t0009_tab_focus,
t0010_fullscreen_focus,
}
}

View file

@ -0,0 +1,42 @@
use {
crate::{
it::{test_error::TestError, testrun::TestRun},
tree::ToplevelNode,
},
std::rc::Rc,
};
testcase!();
/// Test that container focus is set after un-fullscreening
async fn test(run: Rc<TestRun>) -> Result<(), TestError> {
let ds = run.create_default_setup().await?;
ds.mouse.rel(1.0, 1.0);
let client = run.create_client().await?;
let window = client.create_window().await?;
window.map().await?;
tassert!(!window.tl.server.tl_data().is_fullscreen.get());
run.cfg.set_fullscreen(ds.seat.id(), true)?;
tassert!(window.tl.server.tl_data().is_fullscreen.get());
run.cfg.set_fullscreen(ds.seat.id(), false)?;
tassert!(!window.tl.server.tl_data().is_fullscreen.get());
let container = match window.tl.server.tl_data().parent.get() {
Some(p) => match p.node_into_container() {
Some(p) => p,
_ => bail!("Containing node is not a container"),
},
_ => bail!("Toplevel doesn't have a parent"),
};
tassert!(container.children.iter().next().unwrap().active.get());
Ok(())
}