feat: add alternating autotiling
This commit is contained in:
parent
ce14169d6b
commit
5c2f631fdb
17 changed files with 244 additions and 59 deletions
|
|
@ -331,6 +331,10 @@ impl TestConfig {
|
|||
pub fn set_show_titles(&self, show: bool) -> TestResult {
|
||||
self.send(ClientMessage::SetShowTitles { show })
|
||||
}
|
||||
|
||||
pub fn set_autotile(&self, enabled: bool) -> TestResult {
|
||||
self.send(ClientMessage::SetAutotile { enabled })
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestConfig {
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ mod t0051_pointer_warp;
|
|||
mod t0052_bar;
|
||||
mod t0053_theme;
|
||||
mod t0054_subsurface_already_attached;
|
||||
mod t0055_autotiling;
|
||||
|
||||
pub trait TestCase: Sync {
|
||||
fn name(&self) -> &'static str;
|
||||
|
|
@ -158,5 +159,6 @@ pub fn tests() -> Vec<&'static dyn TestCase> {
|
|||
t0052_bar,
|
||||
t0053_theme,
|
||||
t0054_subsurface_already_attached,
|
||||
t0055_autotiling,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
58
src/it/tests/t0055_autotiling.rs
Normal file
58
src/it/tests/t0055_autotiling.rs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
use {
|
||||
crate::{
|
||||
it::{test_error::TestResult, testrun::TestRun},
|
||||
tree::{ContainerSplit, Node, ToplevelNodeBase},
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
testcase!();
|
||||
|
||||
async fn test(run: Rc<TestRun>) -> TestResult {
|
||||
run.backend.install_default()?;
|
||||
run.cfg.set_autotile(true)?;
|
||||
|
||||
let client = run.create_client().await?;
|
||||
|
||||
let win1 = client.create_window().await?;
|
||||
win1.map().await?;
|
||||
let root = win1.tl.container_parent()?;
|
||||
tassert_eq!(root.split.get(), ContainerSplit::Horizontal);
|
||||
|
||||
let win2 = client.create_window().await?;
|
||||
win2.map().await?;
|
||||
client.sync().await;
|
||||
|
||||
tassert_eq!(root.split.get(), ContainerSplit::Horizontal);
|
||||
tassert_eq!(win1.tl.container_parent()?.node_id(), root.node_id());
|
||||
tassert_eq!(win2.tl.container_parent()?.node_id(), root.node_id());
|
||||
|
||||
let win3 = client.create_window().await?;
|
||||
win3.map().await?;
|
||||
client.sync().await;
|
||||
|
||||
let v_group = win3.tl.container_parent()?;
|
||||
tassert_eq!(root.split.get(), ContainerSplit::Horizontal);
|
||||
tassert_eq!(v_group.split.get(), ContainerSplit::Vertical);
|
||||
tassert_eq!(win2.tl.container_parent()?.node_id(), v_group.node_id());
|
||||
|
||||
let win4 = client.create_window().await?;
|
||||
win4.map().await?;
|
||||
client.sync().await;
|
||||
|
||||
let h_group = win4.tl.container_parent()?;
|
||||
tassert_eq!(h_group.split.get(), ContainerSplit::Horizontal);
|
||||
tassert_eq!(win3.tl.container_parent()?.node_id(), h_group.node_id());
|
||||
let h_parent = match h_group
|
||||
.tl_data()
|
||||
.parent
|
||||
.get()
|
||||
.and_then(|p| p.node_into_container())
|
||||
{
|
||||
Some(parent) => parent,
|
||||
None => bail!("autotile group does not have a container parent"),
|
||||
};
|
||||
tassert_eq!(h_parent.node_id(), v_group.node_id());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue