From e3068cd483f4250789d22c8c85948894ef982ff9 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 25 Sep 2025 16:27:43 +0300 Subject: [PATCH] layout/tests: Make UpdateConfig an actual Op We can do it now that it's non-Copy. This also fixes a new stack overflow when running the random test in debug mode (which somehow occurs even though it's skipped in debug mode) that appeared after adding LayoutPart for some unbeknownst to me reason. --- src/layout/tests.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/layout/tests.rs b/src/layout/tests.rs index 52ece35e..8afb92b0 100644 --- a/src/layout/tests.rs +++ b/src/layout/tests.rs @@ -723,6 +723,10 @@ enum Op { window: usize, }, ToggleOverview, + UpdateConfig { + #[proptest(strategy = "arbitrary_layout_part().prop_map(Box::new)")] + layout_config: Box, + }, } impl Op { @@ -1546,6 +1550,14 @@ impl Op { Op::ToggleOverview => { layout.toggle_overview(); } + Op::UpdateConfig { layout_config } => { + let options = Options { + layout: niri_config::Layout::from_part(&layout_config), + ..Default::default() + }; + + layout.update_options(options); + } } } } @@ -3558,7 +3570,6 @@ proptest! { fn random_operations_dont_panic( ops: Vec, layout_config in arbitrary_layout_part(), - post_layout_config in prop::option::of(arbitrary_layout_part()), ) { // eprintln!("{ops:?}"); let options = Options { @@ -3566,15 +3577,6 @@ proptest! { ..Default::default() }; - let mut layout = check_ops_with_options(options, ops); - - if let Some(layout_config) = post_layout_config { - let post_options = Options { - layout: niri_config::Layout::from_part(&layout_config), - ..Default::default() - }; - layout.update_options(post_options); - layout.verify_invariants(); - } + check_ops_with_options(options, ops); } }