From 319c632444b8454b19278c4deccb93dd398b1af1 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Wed, 16 Oct 2024 17:18:17 -0700 Subject: [PATCH] block: Add a failing test for `Move` and `Rotate` composition. --- all-is-cubes/src/block/modifier/move.rs | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/all-is-cubes/src/block/modifier/move.rs b/all-is-cubes/src/block/modifier/move.rs index d89db3b92..e58aa2f2d 100644 --- a/all-is-cubes/src/block/modifier/move.rs +++ b/all-is-cubes/src/block/modifier/move.rs @@ -411,6 +411,40 @@ mod tests { }); } + /// Check the behavior of a `Move` modifier under a `Rotate` modifier. + /// In particular, we want to make sure the outcome doesn’t end up doubly-rotated. + #[test] + #[ignore = "TODO: modifier evaluation needs fixing"] + fn move_inside_rotation() { + let [base] = make_some_blocks(); + const R: Modifier = Modifier::Rotate(GridRotation::CLOCKWISE); + + let block = base + .clone() + .with_modifier(Move { + direction: Face6::PX, + distance: 10, + velocity: 10, + schedule: time::Schedule::EVERY_TICK, + }) + .with_modifier(R); + + let expected_after_tick = base + .clone() + .with_modifier(Move { + direction: Face6::PX, + distance: 20, + velocity: 10, + schedule: time::Schedule::EVERY_TICK, + }) + .with_modifier(R); + + assert_eq!( + block.evaluate().unwrap().attributes.tick_action, + Some(TickAction::from(Operation::Become(expected_after_tick))) + ); + } + /// Test [`Move`] acting within another modifier ([`Composite`]). #[test] fn move_inside_composite_destination() {