mirror of https://github.com/flutter/pinball.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
// ignore_for_file: cascade_invocations
|
|
|
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
import 'package:flame_test/flame_test.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pinball/game/game.dart';
|
|
|
|
void main() {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
final flameTester = FlameTester(Forge2DGame.new);
|
|
|
|
group('JointAnchor', () {
|
|
flameTester.test(
|
|
'loads correctly',
|
|
(game) async {
|
|
final anchor = JointAnchor();
|
|
await game.ready();
|
|
await game.ensureAdd(anchor);
|
|
|
|
expect(game.contains(anchor), isTrue);
|
|
},
|
|
);
|
|
|
|
group('body', () {
|
|
flameTester.test(
|
|
'is static',
|
|
(game) async {
|
|
await game.ready();
|
|
final anchor = JointAnchor();
|
|
await game.ensureAdd(anchor);
|
|
|
|
expect(anchor.body.bodyType, equals(BodyType.static));
|
|
},
|
|
);
|
|
});
|
|
|
|
group('fixtures', () {
|
|
flameTester.test(
|
|
'has none',
|
|
(game) async {
|
|
final anchor = JointAnchor();
|
|
await game.ensureAdd(anchor);
|
|
|
|
expect(anchor.body.fixtures, isEmpty);
|
|
},
|
|
);
|
|
});
|
|
});
|
|
}
|