aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tests.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-09-25 18:15:46 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-10-02 09:33:08 +0300
commit09cf8402c3e25fbe4ab790cb997ae4033f9d30f3 (patch)
treeff392b541f40d9cde3604b1aa27cf5a0c60a7cd2 /src/layout/tests.rs
parenta5e285865b97c008549b60aac29c6a14b7f4f8c0 (diff)
downloadniri-09cf8402c3e25fbe4ab790cb997ae4033f9d30f3.tar.gz
niri-09cf8402c3e25fbe4ab790cb997ae4033f9d30f3.tar.bz2
niri-09cf8402c3e25fbe4ab790cb997ae4033f9d30f3.zip
Add per-output layout config
Diffstat (limited to 'src/layout/tests.rs')
-rw-r--r--src/layout/tests.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/layout/tests.rs b/src/layout/tests.rs
index 7d51b751..389408c2 100644
--- a/src/layout/tests.rs
+++ b/src/layout/tests.rs
@@ -406,9 +406,17 @@ enum Op {
id: usize,
#[proptest(strategy = "arbitrary_scale()")]
scale: f64,
+ #[proptest(strategy = "prop::option::of(arbitrary_layout_part().prop_map(Box::new))")]
+ layout_config: Option<Box<niri_config::LayoutPart>>,
},
RemoveOutput(#[proptest(strategy = "1..=5usize")] usize),
FocusOutput(#[proptest(strategy = "1..=5usize")] usize),
+ UpdateOutputLayoutConfig {
+ #[proptest(strategy = "1..=5usize")]
+ id: usize,
+ #[proptest(strategy = "prop::option::of(arbitrary_layout_part().prop_map(Box::new))")]
+ layout_config: Option<Box<niri_config::LayoutPart>>,
+ },
AddNamedWorkspace {
#[proptest(strategy = "1..=5usize")]
ws_name: usize,
@@ -771,9 +779,13 @@ impl Op {
model: None,
serial: None,
});
- layout.add_output(output.clone());
+ layout.add_output(output.clone(), None);
}
- Op::AddScaledOutput { id, scale } => {
+ Op::AddScaledOutput {
+ id,
+ scale,
+ layout_config,
+ } => {
let name = format!("output{id}");
if layout.outputs().any(|o| o.name() == name) {
return;
@@ -804,7 +816,7 @@ impl Op {
model: None,
serial: None,
});
- layout.add_output(output.clone());
+ layout.add_output(output.clone(), layout_config.map(|x| *x));
}
Op::RemoveOutput(id) => {
let name = format!("output{id}");
@@ -822,6 +834,14 @@ impl Op {
layout.focus_output(&output);
}
+ Op::UpdateOutputLayoutConfig { id, layout_config } => {
+ let name = format!("output{id}");
+ let Some(mon) = layout.monitors_mut().find(|m| m.output_name() == &name) else {
+ return;
+ };
+
+ mon.update_layout_config(layout_config.map(|x| *x));
+ }
Op::AddNamedWorkspace {
ws_name,
output_name,