From 9e4946f4306683645a8fea0f28a3c056fd618310 Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Fri, 1 Apr 2022 18:16:33 +0200 Subject: [PATCH] refactor: renamed Layer.jetpack to Layer.spaceshipEntranceRamp --- .../lib/src/components/layer.dart | 6 +++--- .../sandbox/lib/stories/layer/basic.dart | 2 +- .../sandbox/lib/stories/spaceship/basic.dart | 2 +- .../test/src/components/layer_test.dart | 18 ++++++++++-------- .../test/src/components/ramp_opening_test.dart | 16 ++++++++-------- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/packages/pinball_components/lib/src/components/layer.dart b/packages/pinball_components/lib/src/components/layer.dart index e0e64ddc..10477eff 100644 --- a/packages/pinball_components/lib/src/components/layer.dart +++ b/packages/pinball_components/lib/src/components/layer.dart @@ -53,8 +53,8 @@ enum Layer { /// Collide only with ramps opening elements. opening, - /// Collide only with Jetpack group elements. - jetpack, + /// Collide only with Spaceship entrance ramp group elements. + spaceshipEntranceRamp, /// Collide only with Launcher group elements. launcher, @@ -86,7 +86,7 @@ extension LayerMaskBits on Layer { return 0x0001; case Layer.opening: return 0x0007; - case Layer.jetpack: + case Layer.spaceshipEntranceRamp: return 0x0002; case Layer.launcher: return 0x0005; diff --git a/packages/pinball_components/sandbox/lib/stories/layer/basic.dart b/packages/pinball_components/sandbox/lib/stories/layer/basic.dart index ccbd67d9..f6993471 100644 --- a/packages/pinball_components/sandbox/lib/stories/layer/basic.dart +++ b/packages/pinball_components/sandbox/lib/stories/layer/basic.dart @@ -35,7 +35,7 @@ class BigSquare extends BodyComponent with InitialPosition, Layered { paint = Paint() ..color = const Color.fromARGB(255, 8, 218, 241) ..style = PaintingStyle.stroke; - layer = Layer.jetpack; + layer = Layer.spaceshipEntranceRamp; } @override diff --git a/packages/pinball_components/sandbox/lib/stories/spaceship/basic.dart b/packages/pinball_components/sandbox/lib/stories/spaceship/basic.dart index 6f33f444..0cfb4b5f 100644 --- a/packages/pinball_components/sandbox/lib/stories/spaceship/basic.dart +++ b/packages/pinball_components/sandbox/lib/stories/spaceship/basic.dart @@ -25,7 +25,7 @@ class BasicSpaceship extends BasicGame with TapDetector { add( Ball(baseColor: Colors.blue) ..initialPosition = info.eventPosition.game - ..layer = Layer.jetpack, + ..layer = Layer.spaceshipEntranceRamp, ); } } diff --git a/packages/pinball_components/test/src/components/layer_test.dart b/packages/pinball_components/test/src/components/layer_test.dart index 537e01b6..f2372c45 100644 --- a/packages/pinball_components/test/src/components/layer_test.dart +++ b/packages/pinball_components/test/src/components/layer_test.dart @@ -46,14 +46,15 @@ void main() { }); test('correctly sets and gets', () { - final component = TestLayeredBodyComponent()..layer = Layer.jetpack; - expect(component.layer, Layer.jetpack); + final component = TestLayeredBodyComponent() + ..layer = Layer.spaceshipEntranceRamp; + expect(component.layer, Layer.spaceshipEntranceRamp); }); flameTester.test( 'layers correctly before being loaded', (game) async { - const expectedLayer = Layer.jetpack; + const expectedLayer = Layer.spaceshipEntranceRamp; final component = TestLayeredBodyComponent()..layer = expectedLayer; await game.ensureAdd(component); // TODO(alestiago): modify once component.loaded is available. @@ -71,7 +72,8 @@ void main() { 'when multiple different sets', (game) async { const expectedLayer = Layer.launcher; - final component = TestLayeredBodyComponent()..layer = Layer.jetpack; + final component = TestLayeredBodyComponent() + ..layer = Layer.spaceshipEntranceRamp; expect(component.layer, isNot(equals(expectedLayer))); component.layer = expectedLayer; @@ -90,7 +92,7 @@ void main() { flameTester.test( 'layers correctly after being loaded', (game) async { - const expectedLayer = Layer.jetpack; + const expectedLayer = Layer.spaceshipEntranceRamp; final component = TestLayeredBodyComponent(); await game.ensureAdd(component); component.layer = expectedLayer; @@ -109,7 +111,7 @@ void main() { final component = TestLayeredBodyComponent(); await game.ensureAdd(component); - component.layer = Layer.jetpack; + component.layer = Layer.spaceshipEntranceRamp; expect(component.layer, isNot(equals(expectedLayer))); component.layer = expectedLayer; @@ -133,7 +135,7 @@ void main() { flameTester.test( 'nested Layered children will keep their layer', (game) async { - const parentLayer = Layer.jetpack; + const parentLayer = Layer.spaceshipEntranceRamp; const childLayer = Layer.board; final component = TestLayeredBodyComponent()..layer = parentLayer; @@ -152,7 +154,7 @@ void main() { flameTester.test( 'nested children will keep their layer', (game) async { - const parentLayer = Layer.jetpack; + const parentLayer = Layer.spaceshipEntranceRamp; final component = TestLayeredBodyComponent()..layer = parentLayer; final childComponent = TestBodyComponent(); diff --git a/packages/pinball_components/test/src/components/ramp_opening_test.dart b/packages/pinball_components/test/src/components/ramp_opening_test.dart index cb42203a..46e56e3d 100644 --- a/packages/pinball_components/test/src/components/ramp_opening_test.dart +++ b/packages/pinball_components/test/src/components/ramp_opening_test.dart @@ -44,7 +44,7 @@ void main() { (game) async { final ramp = TestRampOpening( orientation: RampOrientation.down, - pathwayLayer: Layer.jetpack, + pathwayLayer: Layer.spaceshipEntranceRamp, ); await game.ready(); await game.ensureAdd(ramp); @@ -59,7 +59,7 @@ void main() { (game) async { final ramp = TestRampOpening( orientation: RampOrientation.down, - pathwayLayer: Layer.jetpack, + pathwayLayer: Layer.spaceshipEntranceRamp, ); await game.ensureAdd(ramp); @@ -68,7 +68,7 @@ void main() { ); group('first fixture', () { - const pathwayLayer = Layer.jetpack; + const pathwayLayer = Layer.spaceshipEntranceRamp; const openingLayer = Layer.opening; flameTester.test( @@ -124,7 +124,7 @@ void main() { final body = MockBody(); final area = TestRampOpening( orientation: RampOrientation.down, - pathwayLayer: Layer.jetpack, + pathwayLayer: Layer.spaceshipEntranceRamp, ); final callback = TestRampOpeningBallContactCallback(); @@ -145,7 +145,7 @@ void main() { final body = MockBody(); final area = TestRampOpening( orientation: RampOrientation.up, - pathwayLayer: Layer.jetpack, + pathwayLayer: Layer.spaceshipEntranceRamp, ); final callback = TestRampOpeningBallContactCallback(); @@ -165,7 +165,7 @@ void main() { final body = MockBody(); final area = TestRampOpening( orientation: RampOrientation.down, - pathwayLayer: Layer.jetpack, + pathwayLayer: Layer.spaceshipEntranceRamp, )..initialPosition = Vector2(0, 10); final callback = TestRampOpeningBallContactCallback(); @@ -189,7 +189,7 @@ void main() { final body = MockBody(); final area = TestRampOpening( orientation: RampOrientation.up, - pathwayLayer: Layer.jetpack, + pathwayLayer: Layer.spaceshipEntranceRamp, )..initialPosition = Vector2(0, 10); final callback = TestRampOpeningBallContactCallback(); @@ -213,7 +213,7 @@ void main() { final body = MockBody(); final area = TestRampOpening( orientation: RampOrientation.down, - pathwayLayer: Layer.jetpack, + pathwayLayer: Layer.spaceshipEntranceRamp, )..initialPosition = Vector2(0, 10); final callback = TestRampOpeningBallContactCallback();