From 3360e3e109c539db7ed311ad322ecad38c6a72c9 Mon Sep 17 00:00:00 2001 From: RuiAlonso Date: Tue, 19 Apr 2022 13:07:03 +0200 Subject: [PATCH] test: fixed golden tests and removed unused ones --- .../test/src/components/plunger_test.dart | 68 ++----------------- 1 file changed, 7 insertions(+), 61 deletions(-) diff --git a/packages/pinball_components/test/src/components/plunger_test.dart b/packages/pinball_components/test/src/components/plunger_test.dart index 8f67aa3b..eafc15d5 100644 --- a/packages/pinball_components/test/src/components/plunger_test.dart +++ b/packages/pinball_components/test/src/components/plunger_test.dart @@ -1,6 +1,5 @@ // ignore_for_file: cascade_invocations -import 'package:flame/components.dart'; import 'package:flame_forge2d/flame_forge2d.dart'; import 'package:flame_test/flame_test.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -24,18 +23,21 @@ void main() { game.camera.zoom = 4.1; }, verify: (game, tester) async { + final plunger = game.descendants().whereType().first; + plunger.pull(); + game.update(1); + await tester.pump(); await expectLater( find.byGame(), - matchesGoldenFile('golden/plunger/start.png'), + matchesGoldenFile('golden/plunger/pull.png'), ); - final plunger = game.descendants().whereType().first; - plunger.pull(); + plunger.release(); game.update(1); await tester.pump(); await expectLater( find.byGame(), - matchesGoldenFile('golden/plunger/end.png'), + matchesGoldenFile('golden/plunger/release.png'), ); }, ); @@ -150,33 +152,6 @@ void main() { expect(plunger.body.linearVelocity.y, isPositive); expect(plunger.body.linearVelocity.x, isZero); }); - - flameTester.test( - 'animates when called', - (game) async { - await game.ensureAdd(plunger); - - plunger.pull(); - - final animation = - plunger.descendants().whereType().first; - expect(animation.playing, isTrue); - }, - ); - - flameTester.test( - 'stops animating after animation completes', - (game) async { - await game.ensureAdd(plunger); - - plunger.pull(); - game.update(1); - - final animation = - plunger.descendants().whereType().first; - expect(animation.playing, isFalse); - }, - ); }); group('release', () { @@ -210,35 +185,6 @@ void main() { expect(plunger.body.linearVelocity.x, isZero); }, ); - - flameTester.test( - 'animates when called', - (game) async { - await game.ensureAdd(plunger); - - plunger.pull(); - plunger.release(); - - final animation = - plunger.descendants().whereType().first; - expect(animation.playing, isTrue); - }, - ); - - flameTester.test( - 'stops animating after animation completes', - (game) async { - await game.ensureAdd(plunger); - - plunger.pull(); - plunger.release(); - game.update(1); - - final animation = - plunger.descendants().whereType().first; - expect(animation.playing, isFalse); - }, - ); }); });