1
0
Fork 0
forked from wry/wry

it: test float size memoization

This commit is contained in:
Julian Orth 2024-04-03 13:58:18 +02:00
parent 5c80d940af
commit 9efe9415c2
2 changed files with 49 additions and 0 deletions

View file

@ -64,6 +64,7 @@ mod t0030_cursor_shape;
mod t0031_syncobj;
mod t0032_content_type;
mod t0032_data_control;
mod t0033_float_size_memoization;
pub trait TestCase: Sync {
fn name(&self) -> &'static str;
@ -115,5 +116,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
t0030_cursor_shape,
t0031_syncobj,
t0032_data_control,
t0033_float_size_memoization,
}
}

View file

@ -0,0 +1,47 @@
use {
crate::{
it::{test_error::TestResult, testrun::TestRun},
rect::Rect,
},
std::rc::Rc,
};
testcase!();
async fn test(run: Rc<TestRun>) -> TestResult {
let ds = run.create_default_setup().await?;
let client1 = run.create_client().await?;
let win1 = client1.create_window().await?;
win1.map2().await?;
run.cfg.set_floating(ds.seat.id(), true)?;
client1.sync().await;
let (w1, h1) = (win1.tl.core.width.get(), win1.tl.core.height.get());
let float = win1.tl.float_parent()?;
let pos = float.position.get();
float
.position
.set(Rect::new_sized(pos.x1(), pos.x2(), pos.width() / 2, pos.height() / 2).unwrap());
float.schedule_layout();
client1.sync().await;
let (w2, h2) = (win1.tl.core.width.get(), win1.tl.core.height.get());
tassert!((w1, h1) != (w2, h2));
run.cfg.set_floating(ds.seat.id(), false)?;
client1.sync().await;
let (w3, h3) = (win1.tl.core.width.get(), win1.tl.core.height.get());
tassert!((w3, h3) != (w2, h2));
run.cfg.set_floating(ds.seat.id(), true)?;
client1.sync().await;
let (w4, h4) = (win1.tl.core.width.get(), win1.tl.core.height.get());
tassert!((w4, h4) == (w2, h2));
Ok(())
}