it: test float restacking
This commit is contained in:
parent
9703ba8794
commit
94208691b2
6 changed files with 63 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ use {
|
||||||
test_transport::TestTransport,
|
test_transport::TestTransport,
|
||||||
testrun::ParseFull,
|
testrun::ParseFull,
|
||||||
},
|
},
|
||||||
tree::{ContainerNode, ToplevelNodeBase},
|
tree::{ContainerNode, ContainingNode, FloatNode, ToplevelNodeBase},
|
||||||
utils::buffd::MsgParser,
|
utils::buffd::MsgParser,
|
||||||
wire::{xdg_toplevel::*, XdgToplevelId},
|
wire::{xdg_toplevel::*, XdgToplevelId},
|
||||||
},
|
},
|
||||||
|
|
@ -36,16 +36,28 @@ pub struct TestXdgToplevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestXdgToplevel {
|
impl TestXdgToplevel {
|
||||||
pub fn container_parent(&self) -> TestResult<Rc<ContainerNode>> {
|
pub fn parent(&self) -> TestResult<Rc<dyn ContainingNode>> {
|
||||||
let parent = match self.server.tl_data().parent.get() {
|
match self.server.tl_data().parent.get() {
|
||||||
Some(p) => p,
|
Some(p) => Ok(p),
|
||||||
_ => bail!("toplevel has no parent"),
|
_ => bail!("toplevel has no parent"),
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn container_parent(&self) -> TestResult<Rc<ContainerNode>> {
|
||||||
|
let parent = self.parent()?;
|
||||||
match parent.node_into_container() {
|
match parent.node_into_container() {
|
||||||
Some(p) => Ok(p),
|
Some(p) => Ok(p),
|
||||||
_ => bail!("toplevel parent is not a container"),
|
_ => bail!("toplevel parent is not a container"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn float_parent(&self) -> TestResult<Rc<FloatNode>> {
|
||||||
|
let parent = self.parent()?;
|
||||||
|
match parent.node_into_float() {
|
||||||
|
Some(p) => Ok(p),
|
||||||
|
_ => bail!("toplevel parent is not a float"),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestXdgToplevelCore {
|
impl TestXdgToplevelCore {
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ mod t0024_foreign_toplevel_list;
|
||||||
mod t0025_dnd_focus_change;
|
mod t0025_dnd_focus_change;
|
||||||
mod t0026_output_transform;
|
mod t0026_output_transform;
|
||||||
mod t0027_input_region;
|
mod t0027_input_region;
|
||||||
|
mod t0028_top_level_restacking;
|
||||||
|
|
||||||
pub trait TestCase: Sync {
|
pub trait TestCase: Sync {
|
||||||
fn name(&self) -> &'static str;
|
fn name(&self) -> &'static str;
|
||||||
|
|
@ -104,5 +105,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
|
||||||
t0025_dnd_focus_change,
|
t0025_dnd_focus_change,
|
||||||
t0026_output_transform,
|
t0026_output_transform,
|
||||||
t0027_input_region,
|
t0027_input_region,
|
||||||
|
t0028_top_level_restacking,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
43
src/it/tests/t0028_top_level_restacking.rs
Normal file
43
src/it/tests/t0028_top_level_restacking.rs
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
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?;
|
||||||
|
|
||||||
|
let client = run.create_client().await?;
|
||||||
|
|
||||||
|
let win1 = client.create_window().await?;
|
||||||
|
win1.set_color(255, 0, 0, 255);
|
||||||
|
win1.map2().await?;
|
||||||
|
run.cfg.set_floating(ds.seat.id(), true)?;
|
||||||
|
|
||||||
|
let win2 = client.create_window().await?;
|
||||||
|
win2.set_color(0, 255, 0, 255);
|
||||||
|
win2.map2().await?;
|
||||||
|
run.cfg.set_floating(ds.seat.id(), true)?;
|
||||||
|
|
||||||
|
{
|
||||||
|
let parent = win1.tl.float_parent()?;
|
||||||
|
let rect = parent.position.get();
|
||||||
|
parent.position.set(rect.at_point(100, 100));
|
||||||
|
parent.schedule_layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
client.sync().await;
|
||||||
|
client.compare_screenshot("1", false).await?;
|
||||||
|
|
||||||
|
ds.move_to(110, 110);
|
||||||
|
ds.mouse.click(BTN_LEFT);
|
||||||
|
|
||||||
|
client.sync().await;
|
||||||
|
client.compare_screenshot("2", false).await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
BIN
src/it/tests/t0028_top_level_restacking/screenshot_1.qoi
Normal file
BIN
src/it/tests/t0028_top_level_restacking/screenshot_1.qoi
Normal file
Binary file not shown.
BIN
src/it/tests/t0028_top_level_restacking/screenshot_2.qoi
Normal file
BIN
src/it/tests/t0028_top_level_restacking/screenshot_2.qoi
Normal file
Binary file not shown.
|
|
@ -136,7 +136,7 @@ impl FloatNode {
|
||||||
self.schedule_render_titles();
|
self.schedule_render_titles();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn schedule_layout(self: &Rc<Self>) {
|
pub fn schedule_layout(self: &Rc<Self>) {
|
||||||
if !self.layout_scheduled.replace(true) {
|
if !self.layout_scheduled.replace(true) {
|
||||||
self.state.pending_float_layout.push(self.clone());
|
self.state.pending_float_layout.push(self.clone());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue