it: test float size memoization
This commit is contained in:
parent
5c80d940af
commit
9efe9415c2
2 changed files with 49 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ mod t0030_cursor_shape;
|
||||||
mod t0031_syncobj;
|
mod t0031_syncobj;
|
||||||
mod t0032_content_type;
|
mod t0032_content_type;
|
||||||
mod t0032_data_control;
|
mod t0032_data_control;
|
||||||
|
mod t0033_float_size_memoization;
|
||||||
|
|
||||||
pub trait TestCase: Sync {
|
pub trait TestCase: Sync {
|
||||||
fn name(&self) -> &'static str;
|
fn name(&self) -> &'static str;
|
||||||
|
|
@ -115,5 +116,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
|
||||||
t0030_cursor_shape,
|
t0030_cursor_shape,
|
||||||
t0031_syncobj,
|
t0031_syncobj,
|
||||||
t0032_data_control,
|
t0032_data_control,
|
||||||
|
t0033_float_size_memoization,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
47
src/it/tests/t0033_float_size_memoization.rs
Normal file
47
src/it/tests/t0033_float_size_memoization.rs
Normal 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(())
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue