forge
Explore
Log in

Don't you dare go Hollow

layout/tests: Make UpdateConfig an actual Op

Browse files at this commit

e3068cd483f4250789d22c8c85948894ef982ff9Ivan MolodetskikhParent: 6aa8146
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.rsmodified+13 -11
@@ -723,6 +723,10 @@ enum Op {
723723 window: usize,
724724 },
725725 ToggleOverview,
726+ UpdateConfig {
727+ #[proptest(strategy = "arbitrary_layout_part().prop_map(Box::new)")]
728+ layout_config: Box<niri_config::LayoutPart>,
729+ },
726730 }
727731
728732 impl Op {
@@ -1546,6 +1550,14 @@ impl Op {
15461550 Op::ToggleOverview => {
15471551 layout.toggle_overview();
15481552 }
1553+ Op::UpdateConfig { layout_config } => {
1554+ let options = Options {
1555+ layout: niri_config::Layout::from_part(&layout_config),
1556+ ..Default::default()
1557+ };
1558+
1559+ layout.update_options(options);
1560+ }
15491561 }
15501562 }
15511563 }
@@ -3558,7 +3570,6 @@ proptest! {
35583570 fn random_operations_dont_panic(
35593571 ops: Vec<Op>,
35603572 layout_config in arbitrary_layout_part(),
3561- post_layout_config in prop::option::of(arbitrary_layout_part()),
35623573 ) {
35633574 // eprintln!("{ops:?}");
35643575 let options = Options {
@@ -3566,15 +3577,6 @@ proptest! {
35663577 ..Default::default()
35673578 };
35683579
3569- let mut layout = check_ops_with_options(options, ops);
3570-
3571- if let Some(layout_config) = post_layout_config {
3572- let post_options = Options {
3573- layout: niri_config::Layout::from_part(&layout_config),
3574- ..Default::default()
3575- };
3576- layout.update_options(post_options);
3577- layout.verify_invariants();
3578- }
3580+ check_ops_with_options(options, ops);
35793581 }
35803582 }