mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-13 11:20:19 +08:00
26 lines
674 B
Dart
26 lines
674 B
Dart
import 'package:flame/components.dart';
|
|
import 'package:flame/game.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
class _GameWithTapables extends BaseGame with HasTapableComponents {}
|
|
|
|
class _GameWithoutTapables extends BaseGame {}
|
|
|
|
class TapableComponent extends PositionComponent with Tapable {}
|
|
|
|
void main() {
|
|
group('tapables test', () {
|
|
test('make sure they cannot be added to invalid games', () async {
|
|
final game1 = _GameWithTapables();
|
|
// should be ok
|
|
await game1.add(TapableComponent());
|
|
|
|
final game2 = _GameWithoutTapables();
|
|
expect(
|
|
() => game2.add(TapableComponent()),
|
|
isA<AssertionError>(),
|
|
);
|
|
});
|
|
});
|
|
}
|