mirror of https://github.com/flutter/pinball.git
parent
aa4e0dcf61
commit
a25c859d7d
@ -1,36 +1,25 @@
|
|||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:pinball/game/game.dart';
|
import 'package:pinball/game/game.dart';
|
||||||
import 'package:pinball_theme/pinball_theme.dart';
|
import 'package:pinball_theme/pinball_theme.dart';
|
||||||
|
|
||||||
/// [PinballGame] extension to reduce boilerplate in tests.
|
class PinballGameTest extends PinballGame {
|
||||||
extension PinballGameTest on PinballGame {
|
PinballGameTest()
|
||||||
/// Create [PinballGame] with default [PinballTheme].
|
: super(
|
||||||
static PinballGame create() => PinballGame(
|
|
||||||
theme: const PinballTheme(
|
theme: const PinballTheme(
|
||||||
characterTheme: DashTheme(),
|
characterTheme: DashTheme(),
|
||||||
),
|
),
|
||||||
)..images.prefix = '';
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [DebugPinballGame] extension to reduce boilerplate in tests.
|
class DebugPinballGameTest extends DebugPinballGame {
|
||||||
extension DebugPinballGameTest on DebugPinballGame {
|
DebugPinballGameTest()
|
||||||
/// Create [PinballGame] with default [PinballTheme].
|
: super(
|
||||||
static DebugPinballGame create() => DebugPinballGame(
|
|
||||||
theme: const PinballTheme(
|
theme: const PinballTheme(
|
||||||
characterTheme: DashTheme(),
|
characterTheme: DashTheme(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class EmptyPinballGame extends PinballGame {
|
class EmptyPinballGameTest extends PinballGameTest {
|
||||||
EmptyPinballGame({required PinballTheme theme}) : super(theme: theme);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onLoad() async {}
|
Future<void> onLoad() async {}
|
||||||
|
|
||||||
static PinballGame create() => EmptyPinballGame(
|
|
||||||
theme: const PinballTheme(
|
|
||||||
characterTheme: DashTheme(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue