diff --git a/packages/pinball_components/test/src/components/layer_test.dart b/packages/pinball_components/test/src/components/layer_test.dart index ec9af928..537e01b6 100644 --- a/packages/pinball_components/test/src/components/layer_test.dart +++ b/packages/pinball_components/test/src/components/layer_test.dart @@ -1,7 +1,6 @@ // ignore_for_file: cascade_invocations import 'dart:math' as math; -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'; diff --git a/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart b/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart index f7563ee6..e5394d8a 100644 --- a/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart +++ b/packages/pinball_components/test/src/components/shapes/arc_shape_test.dart @@ -12,60 +12,57 @@ void main() { center: Vector2.zero(), arcRadius: 10, angle: 2 * math.pi, - rotation: 0, ), isNotNull, ); }); - }); - - group('copyWith', () { - test( - 'copies correctly ' - 'when no argument specified', () { - final arcShape = ArcShape( - center: Vector2.zero(), - arcRadius: 10, - angle: 2 * math.pi, - rotation: 0, - ); - final arcShapeCopied = arcShape.copyWith(); - for (var index = 0; index < arcShape.vertices.length; index++) { - expect( - arcShape.vertices[index], - equals(arcShapeCopied.vertices[index]), + group('copyWith', () { + test( + 'copies correctly ' + 'when no argument specified', () { + final arcShape = ArcShape( + center: Vector2.zero(), + arcRadius: 10, + angle: 2 * math.pi, ); - } - }); + final arcShapeCopied = arcShape.copyWith(); - test( - 'copies correctly ' - 'when all arguments specified', () { - final arcShapeExpected = ArcShape( - center: Vector2.all(10), - arcRadius: 15, - angle: 2 * math.pi, - rotation: math.pi, - ); - final arcShapeCopied = ArcShape( - center: Vector2.zero(), - arcRadius: 10, - angle: math.pi, - rotation: 0, - ).copyWith( - center: Vector2.all(10), - arcRadius: 15, - angle: 2 * math.pi, - rotation: math.pi, - ); + for (var index = 0; index < arcShape.vertices.length; index++) { + expect( + arcShape.vertices[index], + equals(arcShapeCopied.vertices[index]), + ); + } + }); - for (var index = 0; index < arcShapeCopied.vertices.length; index++) { - expect( - arcShapeCopied.vertices[index], - equals(arcShapeExpected.vertices[index]), + test( + 'copies correctly ' + 'when all arguments specified', () { + final arcShapeExpected = ArcShape( + center: Vector2.all(10), + arcRadius: 15, + angle: 2 * math.pi, + rotation: math.pi, ); - } + final arcShapeCopied = ArcShape( + center: Vector2.zero(), + arcRadius: 10, + angle: math.pi, + ).copyWith( + center: Vector2.all(10), + arcRadius: 15, + angle: 2 * math.pi, + rotation: math.pi, + ); + + for (var index = 0; index < arcShapeCopied.vertices.length; index++) { + expect( + arcShapeCopied.vertices[index], + equals(arcShapeExpected.vertices[index]), + ); + } + }); }); }); } diff --git a/packages/pinball_components/test/src/components/shapes/bezier_curve_shape_test.dart b/packages/pinball_components/test/src/components/shapes/bezier_curve_shape_test.dart index e8192363..72be997d 100644 --- a/packages/pinball_components/test/src/components/shapes/bezier_curve_shape_test.dart +++ b/packages/pinball_components/test/src/components/shapes/bezier_curve_shape_test.dart @@ -6,30 +6,39 @@ import 'package:pinball_components/src/components/components.dart'; void main() { group('BezierCurveShape', () { - group('rotate', () { - test('returns vertices rotated', () { - const rotationAngle = 2 * math.pi; - final controlPoints = [ - Vector2(0, 0), - Vector2(10, 0), - Vector2(0, 10), - Vector2(10, 10), - ]; + final controlPoints = [ + Vector2(0, 0), + Vector2(10, 0), + Vector2(0, 10), + Vector2(10, 10), + ]; - final bezierCurveShape = BezierCurveShape( + test('can be instantiated', () { + expect( + BezierCurveShape( controlPoints: controlPoints, - ); - final bezierCurveShapeRotated = BezierCurveShape( - controlPoints: controlPoints, - )..rotate(rotationAngle); + ), + isNotNull, + ); + }); - for (var index = 0; index < bezierCurveShape.vertices.length; index++) { - expect( - bezierCurveShape.vertices[index]..rotate(rotationAngle), - equals(bezierCurveShapeRotated.vertices[index]), - ); - } - }); + test('returns vertices rotated', () { + const rotationAngle = 2 * math.pi; + + final bezierCurveShape = BezierCurveShape( + controlPoints: controlPoints, + ); + final bezierCurveShapeRotated = BezierCurveShape( + controlPoints: controlPoints, + rotation: rotationAngle, + ); + + for (var index = 0; index < bezierCurveShape.vertices.length; index++) { + expect( + bezierCurveShape.vertices[index]..rotate(rotationAngle), + equals(bezierCurveShapeRotated.vertices[index]), + ); + } }); }); } diff --git a/packages/pinball_components/test/src/components/shapes/ellipse_shape_test.dart b/packages/pinball_components/test/src/components/shapes/ellipse_shape_test.dart index bc8c750f..45c1acb2 100644 --- a/packages/pinball_components/test/src/components/shapes/ellipse_shape_test.dart +++ b/packages/pinball_components/test/src/components/shapes/ellipse_shape_test.dart @@ -6,27 +6,37 @@ import 'package:pinball_components/src/components/components.dart'; void main() { group('EllipseShape', () { - group('rotate', () { - test('returns vertices rotated', () { - const rotationAngle = 2 * math.pi; - final ellipseShape = EllipseShape( + test('can be instantiated', () { + expect( + EllipseShape( center: Vector2.zero(), majorRadius: 10, minorRadius: 8, - ); - final ellipseShapeRotated = EllipseShape( - center: Vector2.zero(), - majorRadius: 10, - minorRadius: 8, - )..rotate(rotationAngle); + ), + isNotNull, + ); + }); - for (var index = 0; index < ellipseShape.vertices.length; index++) { - expect( - ellipseShape.vertices[index]..rotate(rotationAngle), - equals(ellipseShapeRotated.vertices[index]), - ); - } - }); + test('returns vertices rotated', () { + const rotationAngle = 2 * math.pi; + final ellipseShape = EllipseShape( + center: Vector2.zero(), + majorRadius: 10, + minorRadius: 8, + ); + final ellipseShapeRotated = EllipseShape( + center: Vector2.zero(), + majorRadius: 10, + minorRadius: 8, + rotation: rotationAngle, + ); + + for (var index = 0; index < ellipseShape.vertices.length; index++) { + expect( + ellipseShape.vertices[index]..rotate(rotationAngle), + equals(ellipseShapeRotated.vertices[index]), + ); + } }); group('copyWith', () {