diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-09-25 16:27:43 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-10-02 09:33:08 +0300 |
| commit | e3068cd483f4250789d22c8c85948894ef982ff9 (patch) | |
| tree | f8890ed7000ca072aa38f293008367ffac362dd2 | |
| parent | 6aa8146c3249e38dc33b5bb6e84c04775a6bc64f (diff) | |
| download | niri-e3068cd483f4250789d22c8c85948894ef982ff9.tar.gz niri-e3068cd483f4250789d22c8c85948894ef982ff9.tar.bz2 niri-e3068cd483f4250789d22c8c85948894ef982ff9.zip | |
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.
| -rw-r--r-- | src/layout/tests.rs | 24 |
1 files 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<niri_config::LayoutPart>, + }, } 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<Op>, 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); } } |
