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 {
723 window: usize,723 window: usize,
724 },724 },
725 ToggleOverview,725 ToggleOverview,
726+ UpdateConfig {
727+ #[proptest(strategy = "arbitrary_layout_part().prop_map(Box::new)")]
728+ layout_config: Box<niri_config::LayoutPart>,
729+ },
726 }730 }
727 731
728 impl Op {732 impl Op {
@@ -1546,6 +1550,14 @@ impl Op {
1546 Op::ToggleOverview => {1550 Op::ToggleOverview => {
1547 layout.toggle_overview();1551 layout.toggle_overview();
1548 }1552 }
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+ }
1549 }1561 }
1550 }1562 }
1551 }1563 }
@@ -3558,7 +3570,6 @@ proptest! {
3558 fn random_operations_dont_panic(3570 fn random_operations_dont_panic(
3559 ops: Vec<Op>,3571 ops: Vec<Op>,
3560 layout_config in arbitrary_layout_part(),3572 layout_config in arbitrary_layout_part(),
3561- post_layout_config in prop::option::of(arbitrary_layout_part()),
3562 ) {3573 ) {
3563 // eprintln!("{ops:?}");3574 // eprintln!("{ops:?}");
3564 let options = Options {3575 let options = Options {
@@ -3566,15 +3577,6 @@ proptest! {
3566 ..Default::default()3577 ..Default::default()
3567 };3578 };
3568 3579
3569- let mut layout = check_ops_with_options(options, ops);3580+ 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- }
3579 }3581 }
3580 }3582 }