mirror of https://github.com/flutter/pinball.git
parent
14b9663f76
commit
f0c9697a74
@ -1,5 +1,35 @@
|
|||||||
|
import 'dart:math' as math;
|
||||||
|
import 'package:flame/extensions.dart';
|
||||||
|
import 'package:flame/game.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:pinball_components/src/components/components.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('ArcShape', () {});
|
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 bezierCurveShape = BezierCurveShape(
|
||||||
|
controlPoints: controlPoints,
|
||||||
|
);
|
||||||
|
final bezierCurveShapeRotated = BezierCurveShape(
|
||||||
|
controlPoints: controlPoints,
|
||||||
|
)..rotate(rotationAngle);
|
||||||
|
|
||||||
|
for (var index = 0; index < bezierCurveShape.vertices.length; index++) {
|
||||||
|
expect(
|
||||||
|
bezierCurveShape.vertices[index]..rotate(rotationAngle),
|
||||||
|
equals(bezierCurveShapeRotated.vertices[index]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue