mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 08:27:36 +08:00
Adds checking for trailling commas on the project (#670)
* Testing a new linter option for trailling commas * Checking trailling commas on linter
This commit is contained in:
@ -6,6 +6,9 @@ analyzer:
|
|||||||
implicit-casts: false
|
implicit-casts: false
|
||||||
implicit-dynamic: false
|
implicit-dynamic: false
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- dart_code_metrics
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
- always_declare_return_types
|
- always_declare_return_types
|
||||||
@ -72,3 +75,12 @@ linter:
|
|||||||
- use_rethrow_when_possible
|
- use_rethrow_when_possible
|
||||||
- unnecessary_new
|
- unnecessary_new
|
||||||
|
|
||||||
|
dart_code_metrics:
|
||||||
|
rules:
|
||||||
|
- prefer-trailing-comma
|
||||||
|
metrics:
|
||||||
|
number-of-arguments: 8
|
||||||
|
number-of-methods: 28
|
||||||
|
lines-of-executable-code: 200
|
||||||
|
cyclomatic-complexity: 36
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,11 @@ class TapableSquare extends PositionComponent with Tapable {
|
|||||||
Paint _randomPaint() {
|
Paint _randomPaint() {
|
||||||
final rng = math.Random();
|
final rng = math.Random();
|
||||||
final color = Color.fromRGBO(
|
final color = Color.fromRGBO(
|
||||||
rng.nextInt(256), rng.nextInt(256), rng.nextInt(256), 0.9);
|
rng.nextInt(256),
|
||||||
|
rng.nextInt(256),
|
||||||
|
rng.nextInt(256),
|
||||||
|
0.9,
|
||||||
|
);
|
||||||
return PaletteEntry(color).paint;
|
return PaletteEntry(color).paint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -304,11 +304,12 @@ class MyGame extends BaseGame {
|
|||||||
return Particle.generate(
|
return Particle.generate(
|
||||||
count: count,
|
count: count,
|
||||||
generator: (i) => TranslatedParticle(
|
generator: (i) => TranslatedParticle(
|
||||||
offset: Offset(
|
offset: Offset(
|
||||||
(i % perLine) * colWidth - halfCellSize.x + imageSize,
|
(i % perLine) * colWidth - halfCellSize.x + imageSize,
|
||||||
(i ~/ perLine) * rowHeight - halfCellSize.y + imageSize,
|
(i ~/ perLine) * rowHeight - halfCellSize.y + imageSize,
|
||||||
),
|
),
|
||||||
child: reusableImageParticle),
|
child: reusableImageParticle,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,7 +476,7 @@ class MyGame extends BaseGame {
|
|||||||
.moving(to: cellSizeOffset.scale(1, -1))
|
.moving(to: cellSizeOffset.scale(1, -1))
|
||||||
.scaled(2)
|
.scaled(2)
|
||||||
.translated(halfCellSizeOffset.scale(-1, 1))
|
.translated(halfCellSizeOffset.scale(-1, 1))
|
||||||
.accelerated(acceleration: halfCellSizeOffset.scale(-5, 5))
|
.accelerated(acceleration: halfCellSizeOffset.scale(-5, 5)),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,7 +489,10 @@ class MyGame extends BaseGame {
|
|||||||
|
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
fpsTextConfig.render(
|
fpsTextConfig.render(
|
||||||
canvas, '${fps(120).toStringAsFixed(2)}fps', Vector2(0, size.y - 24));
|
canvas,
|
||||||
|
'${fps(120).toStringAsFixed(2)}fps',
|
||||||
|
Vector2(0, size.y - 24),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,9 @@ class MyGame extends BaseGame {
|
|||||||
final spriteSize = Vector2(80.0, 90.0);
|
final spriteSize = Vector2(80.0, 90.0);
|
||||||
|
|
||||||
final vampireComponent = SpriteAnimationComponent.fromSpriteAnimation(
|
final vampireComponent = SpriteAnimationComponent.fromSpriteAnimation(
|
||||||
spriteSize, vampireAnimation)
|
spriteSize,
|
||||||
|
vampireAnimation,
|
||||||
|
)
|
||||||
..x = 150
|
..x = 150
|
||||||
..y = 100;
|
..y = 100;
|
||||||
|
|
||||||
|
|||||||
@ -40,10 +40,11 @@ class MyTextBox extends TextBoxComponent {
|
|||||||
height - margin.vertical,
|
height - margin.vertical,
|
||||||
);
|
);
|
||||||
c.drawRect(
|
c.drawRect(
|
||||||
innerRect,
|
innerRect,
|
||||||
Paint()
|
Paint()
|
||||||
..color = BasicPalette.white.color
|
..color = BasicPalette.white.color
|
||||||
..style = PaintingStyle.stroke);
|
..style = PaintingStyle.stroke,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,18 +13,20 @@ class MyGameApp extends StatelessWidget {
|
|||||||
return MaterialApp(routes: {
|
return MaterialApp(routes: {
|
||||||
'/': (BuildContext context) => Column(children: [
|
'/': (BuildContext context) => Column(children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: const Text('Game'),
|
child: const Text('Game'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pushNamed('/game');
|
Navigator.of(context).pushNamed('/game');
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: const Text('BaseGame'),
|
child: const Text('BaseGame'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pushNamed('/base_game');
|
Navigator.of(context).pushNamed('/base_game');
|
||||||
})
|
},
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
'/game': (BuildContext context) => GameWidget(game: MyGame()),
|
'/game': (BuildContext context) => GameWidget(game: MyGame()),
|
||||||
'/base_game': (BuildContext context) => GameWidget(game: MyBaseGame())
|
'/base_game': (BuildContext context) => GameWidget(game: MyBaseGame()),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,24 +37,25 @@ void main() async {
|
|||||||
|
|
||||||
final nineTileBoxImage = await Flame.images.load('nine_tile_box.png');
|
final nineTileBoxImage = await Flame.images.load('nine_tile_box.png');
|
||||||
dashbook.storiesOf('NineTileBox').decorator(CenterDecorator()).add(
|
dashbook.storiesOf('NineTileBox').decorator(CenterDecorator()).add(
|
||||||
'default',
|
'default',
|
||||||
(ctx) => Container(
|
(ctx) => Container(
|
||||||
width: ctx.numberProperty('width', 200),
|
width: ctx.numberProperty('width', 200),
|
||||||
height: ctx.numberProperty('height', 200),
|
height: ctx.numberProperty('height', 200),
|
||||||
child: NineTileBox(
|
child: NineTileBox(
|
||||||
image: nineTileBoxImage,
|
image: nineTileBoxImage,
|
||||||
tileSize: 16,
|
tileSize: 16,
|
||||||
destTileSize: 50,
|
destTileSize: 50,
|
||||||
child: const Center(
|
child: const Center(
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'Cool label',
|
'Cool label',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: const Color(0xFFFFFFFF),
|
color: const Color(0xFFFFFFFF),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
final buttonsImage = await Flame.images.load('buttons.png');
|
final buttonsImage = await Flame.images.load('buttons.png');
|
||||||
final _buttons = SpriteSheet(
|
final _buttons = SpriteSheet(
|
||||||
|
|||||||
@ -101,7 +101,14 @@ class ImageComposition {
|
|||||||
);
|
);
|
||||||
|
|
||||||
_composes.add(_Composed(
|
_composes.add(_Composed(
|
||||||
image, position, source, angle, anchor, isAntiAlias, blendMode));
|
image,
|
||||||
|
position,
|
||||||
|
source,
|
||||||
|
angle,
|
||||||
|
anchor,
|
||||||
|
isAntiAlias,
|
||||||
|
blendMode,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() => _composes.clear();
|
void clear() => _composes.clear();
|
||||||
|
|||||||
@ -7,7 +7,7 @@ enum JoystickMoveDirectional {
|
|||||||
MOVE_DOWN_RIGHT,
|
MOVE_DOWN_RIGHT,
|
||||||
MOVE_DOWN_LEFT,
|
MOVE_DOWN_LEFT,
|
||||||
MOVE_LEFT,
|
MOVE_LEFT,
|
||||||
IDLE
|
IDLE,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ActionEvent { DOWN, UP, MOVE, CANCEL }
|
enum ActionEvent { DOWN, UP, MOVE, CANCEL }
|
||||||
|
|||||||
@ -113,7 +113,8 @@ abstract class PositionComponent extends BaseComponent {
|
|||||||
final corners = [
|
final corners = [
|
||||||
rotatePoint(absoluteTopLeftPosition), // Top-left
|
rotatePoint(absoluteTopLeftPosition), // Top-left
|
||||||
rotatePoint(
|
rotatePoint(
|
||||||
absoluteTopLeftPosition + Vector2(0.0, size.y)), // Bottom-left
|
absoluteTopLeftPosition + Vector2(0.0, size.y),
|
||||||
|
), // Bottom-left
|
||||||
rotatePoint(absoluteTopLeftPosition + size), // Bottom-right
|
rotatePoint(absoluteTopLeftPosition + size), // Bottom-right
|
||||||
rotatePoint(absoluteTopLeftPosition + Vector2(size.x, 0.0)), // Top-right
|
rotatePoint(absoluteTopLeftPosition + Vector2(size.x, 0.0)), // Top-right
|
||||||
];
|
];
|
||||||
|
|||||||
@ -148,7 +148,11 @@ abstract class Particle {
|
|||||||
/// in radians with [RotatingParticle]
|
/// in radians with [RotatingParticle]
|
||||||
Particle rotated([double angle = 0]) {
|
Particle rotated([double angle = 0]) {
|
||||||
return RotatingParticle(
|
return RotatingParticle(
|
||||||
child: this, lifespan: _lifespan, from: angle, to: angle);
|
child: this,
|
||||||
|
lifespan: _lifespan,
|
||||||
|
from: angle,
|
||||||
|
to: angle,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Rotates this particle from given angle
|
/// Rotates this particle from given angle
|
||||||
|
|||||||
@ -14,6 +14,7 @@ dev_dependencies:
|
|||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
test: ^1.9.4
|
test: ^1.9.4
|
||||||
|
dart_code_metrics: ^2.4.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|||||||
@ -18,6 +18,12 @@ done
|
|||||||
|
|
||||||
cd .
|
cd .
|
||||||
flutter pub get
|
flutter pub get
|
||||||
|
result=$(flutter pub run dart_code_metrics:metrics .)
|
||||||
|
if [ "$result" != "" ]; then
|
||||||
|
echo "flutter dart code metrics issues: $1"
|
||||||
|
echo "$result"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
result=$(flutter analyze .)
|
result=$(flutter analyze .)
|
||||||
if ! echo "$result" | grep -q "No issues found!"; then
|
if ! echo "$result" | grep -q "No issues found!"; then
|
||||||
echo "$result"
|
echo "$result"
|
||||||
|
|||||||
@ -75,21 +75,23 @@ void main() {
|
|||||||
expect(true, game.components.contains(component));
|
expect(true, game.components.contains(component));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('when the component has onLoad function, adds after load completion',
|
test(
|
||||||
() async {
|
'when the component has onLoad function, adds after load completion',
|
||||||
final MyGame game = MyGame();
|
() async {
|
||||||
final MyAsyncComponent component = MyAsyncComponent();
|
final MyGame game = MyGame();
|
||||||
|
final MyAsyncComponent component = MyAsyncComponent();
|
||||||
|
|
||||||
game.onResize(size);
|
game.onResize(size);
|
||||||
await game.add(component);
|
await game.add(component);
|
||||||
// runs a cycle to add the component
|
// runs a cycle to add the component
|
||||||
game.update(0.1);
|
game.update(0.1);
|
||||||
|
|
||||||
expect(true, game.components.contains(component));
|
expect(true, game.components.contains(component));
|
||||||
|
|
||||||
expect(component.gameSize, size);
|
expect(component.gameSize, size);
|
||||||
expect(component.gameRef, game);
|
expect(component.gameRef, game);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
test('prepare adds gameRef and calls onGameResize', () {
|
test('prepare adds gameRef and calls onGameResize', () {
|
||||||
final MyGame game = MyGame();
|
final MyGame game = MyGame();
|
||||||
@ -127,32 +129,34 @@ void main() {
|
|||||||
expect(game.components.contains(component), true);
|
expect(game.components.contains(component), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
flutter.testWidgets('component render and update is called',
|
flutter.testWidgets(
|
||||||
(flutter.WidgetTester tester) async {
|
'component render and update is called',
|
||||||
final MyGame game = MyGame();
|
(flutter.WidgetTester tester) async {
|
||||||
final MyComponent component = MyComponent();
|
final MyGame game = MyGame();
|
||||||
|
final MyComponent component = MyComponent();
|
||||||
|
|
||||||
game.onResize(size);
|
game.onResize(size);
|
||||||
game.add(component);
|
game.add(component);
|
||||||
GameRenderBox renderBox;
|
GameRenderBox renderBox;
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
Builder(
|
Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
renderBox = GameRenderBox(context, game);
|
renderBox = GameRenderBox(context, game);
|
||||||
return GameWidget(game: game);
|
return GameWidget(game: game);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
renderBox.attach(PipelineOwner());
|
renderBox.attach(PipelineOwner());
|
||||||
renderBox.gameLoopCallback(1.0);
|
renderBox.gameLoopCallback(1.0);
|
||||||
expect(component.isUpdateCalled, true);
|
expect(component.isUpdateCalled, true);
|
||||||
renderBox.paint(
|
renderBox.paint(
|
||||||
PaintingContext(ContainerLayer(), Rect.zero),
|
PaintingContext(ContainerLayer(), Rect.zero),
|
||||||
Offset.zero,
|
Offset.zero,
|
||||||
);
|
);
|
||||||
expect(component.isRenderCalled, true);
|
expect(component.isRenderCalled, true);
|
||||||
renderBox.detach();
|
renderBox.detach();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
test('onRemove is only called once on component', () {
|
test('onRemove is only called once on component', () {
|
||||||
final MyGame game = MyGame();
|
final MyGame game = MyGame();
|
||||||
|
|||||||
@ -107,20 +107,22 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets('CombinedEffect alternation can peak',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'CombinedEffect alternation can peak',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(isAlternating: true),
|
positionComponent,
|
||||||
expectedPosition: path.last,
|
effect(isAlternating: true),
|
||||||
expectedAngle: argumentAngle,
|
expectedPosition: path.last,
|
||||||
expectedSize: argumentSize,
|
expectedAngle: argumentAngle,
|
||||||
shouldComplete: false,
|
expectedSize: argumentSize,
|
||||||
iterations: 0.5,
|
shouldComplete: false,
|
||||||
);
|
iterations: 0.5,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('CombinedEffect can be infinite', (WidgetTester tester) async {
|
testWidgets('CombinedEffect can be infinite', (WidgetTester tester) async {
|
||||||
final PositionComponent positionComponent = component();
|
final PositionComponent positionComponent = component();
|
||||||
@ -136,45 +138,51 @@ void main() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('CombinedEffect can contain alternating MoveEffect',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'CombinedEffect can contain alternating MoveEffect',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(hasAlternatingMoveEffect: true),
|
positionComponent,
|
||||||
expectedPosition: positionComponent.position.clone(),
|
effect(hasAlternatingMoveEffect: true),
|
||||||
expectedAngle: argumentAngle,
|
expectedPosition: positionComponent.position.clone(),
|
||||||
expectedSize: argumentSize,
|
expectedAngle: argumentAngle,
|
||||||
shouldComplete: true,
|
expectedSize: argumentSize,
|
||||||
);
|
shouldComplete: true,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('CombinedEffect can contain alternating RotateEffect',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'CombinedEffect can contain alternating RotateEffect',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(hasAlternatingRotateEffect: true),
|
positionComponent,
|
||||||
expectedPosition: path.last,
|
effect(hasAlternatingRotateEffect: true),
|
||||||
expectedAngle: positionComponent.angle,
|
expectedPosition: path.last,
|
||||||
expectedSize: argumentSize,
|
expectedAngle: positionComponent.angle,
|
||||||
shouldComplete: true,
|
expectedSize: argumentSize,
|
||||||
);
|
shouldComplete: true,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('CombinedEffect can contain alternating ScaleEffect',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'CombinedEffect can contain alternating ScaleEffect',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(hasAlternatingScaleEffect: true),
|
positionComponent,
|
||||||
expectedPosition: path.last,
|
effect(hasAlternatingScaleEffect: true),
|
||||||
expectedAngle: argumentAngle,
|
expectedPosition: path.last,
|
||||||
expectedSize: positionComponent.size.clone(),
|
expectedAngle: argumentAngle,
|
||||||
shouldComplete: true,
|
expectedSize: positionComponent.size.clone(),
|
||||||
);
|
shouldComplete: true,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,8 +87,11 @@ void effectTest(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
expect(effect.hasCompleted(), shouldComplete, reason: "Effect shouldFinish");
|
expect(effect.hasCompleted(), shouldComplete, reason: "Effect shouldFinish");
|
||||||
expect(callback.isCalled, shouldComplete,
|
expect(
|
||||||
reason: "Callback was treated wrong");
|
callback.isCalled,
|
||||||
|
shouldComplete,
|
||||||
|
reason: "Callback was treated wrong",
|
||||||
|
);
|
||||||
game.update(0.0); // Since effects are removed before they are updated
|
game.update(0.0); // Since effects are removed before they are updated
|
||||||
expect(component.effects.isEmpty, shouldComplete);
|
expect(component.effects.isEmpty, shouldComplete);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,20 +106,22 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets('SequenceEffect alternation can peak',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'SequenceEffect alternation can peak',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(isAlternating: true),
|
positionComponent,
|
||||||
expectedPosition: path.last,
|
effect(isAlternating: true),
|
||||||
expectedAngle: argumentAngle,
|
expectedPosition: path.last,
|
||||||
expectedSize: argumentSize,
|
expectedAngle: argumentAngle,
|
||||||
shouldComplete: false,
|
expectedSize: argumentSize,
|
||||||
iterations: 0.5,
|
shouldComplete: false,
|
||||||
);
|
iterations: 0.5,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('SequenceEffect can be infinite', (WidgetTester tester) async {
|
testWidgets('SequenceEffect can be infinite', (WidgetTester tester) async {
|
||||||
final PositionComponent positionComponent = component();
|
final PositionComponent positionComponent = component();
|
||||||
@ -135,45 +137,51 @@ void main() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('SequenceEffect can contain alternating MoveEffect',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'SequenceEffect can contain alternating MoveEffect',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(hasAlternatingMoveEffect: true),
|
positionComponent,
|
||||||
expectedPosition: positionComponent.position.clone(),
|
effect(hasAlternatingMoveEffect: true),
|
||||||
expectedAngle: argumentAngle,
|
expectedPosition: positionComponent.position.clone(),
|
||||||
expectedSize: argumentSize,
|
expectedAngle: argumentAngle,
|
||||||
shouldComplete: true,
|
expectedSize: argumentSize,
|
||||||
);
|
shouldComplete: true,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('SequenceEffect can contain alternating RotateEffect',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'SequenceEffect can contain alternating RotateEffect',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(hasAlternatingRotateEffect: true),
|
positionComponent,
|
||||||
expectedPosition: path.last,
|
effect(hasAlternatingRotateEffect: true),
|
||||||
expectedAngle: positionComponent.angle,
|
expectedPosition: path.last,
|
||||||
expectedSize: argumentSize,
|
expectedAngle: positionComponent.angle,
|
||||||
shouldComplete: true,
|
expectedSize: argumentSize,
|
||||||
);
|
shouldComplete: true,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
testWidgets('SequenceEffect can contain alternating ScaleEffect',
|
testWidgets(
|
||||||
(WidgetTester tester) async {
|
'SequenceEffect can contain alternating ScaleEffect',
|
||||||
final PositionComponent positionComponent = component();
|
(WidgetTester tester) async {
|
||||||
effectTest(
|
final PositionComponent positionComponent = component();
|
||||||
tester,
|
effectTest(
|
||||||
positionComponent,
|
tester,
|
||||||
effect(hasAlternatingScaleEffect: true),
|
positionComponent,
|
||||||
expectedPosition: path.last,
|
effect(hasAlternatingScaleEffect: true),
|
||||||
expectedAngle: argumentAngle,
|
expectedPosition: path.last,
|
||||||
expectedSize: positionComponent.size.clone(),
|
expectedAngle: argumentAngle,
|
||||||
shouldComplete: true,
|
expectedSize: positionComponent.size.clone(),
|
||||||
);
|
shouldComplete: true,
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user