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