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.
44 lines
1.0 KiB
44 lines
1.0 KiB
3 years ago
|
// 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';
|
||
3 years ago
|
|
||
3 years ago
|
import 'package:pinball/game/game.dart';
|
||
3 years ago
|
|
||
3 years ago
|
import '../../../helpers/helpers.dart';
|
||
3 years ago
|
|
||
3 years ago
|
void main() {
|
||
|
TestWidgetsFlutterBinding.ensureInitialized();
|
||
|
final flameTester = FlameTester(TestGame.new);
|
||
|
|
||
|
group('Drain', () {
|
||
|
flameTester.test(
|
||
|
'loads correctly',
|
||
|
(game) async {
|
||
|
final drain = Drain();
|
||
|
await game.ensureAdd(drain);
|
||
|
expect(game.contains(drain), isTrue);
|
||
|
},
|
||
|
);
|
||
|
|
||
|
flameTester.test(
|
||
|
'body is static',
|
||
|
(game) async {
|
||
|
final drain = Drain();
|
||
|
await game.ensureAdd(drain);
|
||
|
expect(drain.body.bodyType, equals(BodyType.static));
|
||
|
},
|
||
|
);
|
||
|
|
||
|
flameTester.test(
|
||
|
'is sensor',
|
||
|
(game) async {
|
||
|
final drain = Drain();
|
||
|
await game.ensureAdd(drain);
|
||
|
expect(drain.body.fixtures.first.isSensor, isTrue);
|
||
|
},
|
||
|
);
|
||
|
});
|
||
|
}
|