|
|
@ -7,7 +7,7 @@ import 'package:pinball/theme/app_colors.dart';
|
|
|
|
import '../../../helpers/helpers.dart';
|
|
|
|
import '../../../helpers/helpers.dart';
|
|
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
void main() {
|
|
|
|
group('ScoreBalls renders', () {
|
|
|
|
group('RoundCountDisplay renders', () {
|
|
|
|
late GameBloc gameBloc;
|
|
|
|
late GameBloc gameBloc;
|
|
|
|
const initialState = GameState(
|
|
|
|
const initialState = GameState(
|
|
|
|
score: 0,
|
|
|
|
score: 0,
|
|
|
@ -27,12 +27,12 @@ void main() {
|
|
|
|
|
|
|
|
|
|
|
|
testWidgets('three active balls', (tester) async {
|
|
|
|
testWidgets('three active balls', (tester) async {
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpApp(
|
|
|
|
const BallCountDisplay(),
|
|
|
|
const RoundCountDisplay(),
|
|
|
|
gameBloc: gameBloc,
|
|
|
|
gameBloc: gameBloc,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await tester.pump();
|
|
|
|
await tester.pump();
|
|
|
|
|
|
|
|
|
|
|
|
expect(find.byType(BallIndicator), findsNWidgets(3));
|
|
|
|
expect(find.byType(RoundIndicator), findsNWidgets(3));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
testWidgets('two active balls', (tester) async {
|
|
|
|
testWidgets('two active balls', (tester) async {
|
|
|
@ -46,27 +46,27 @@ void main() {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpApp(
|
|
|
|
const BallCountDisplay(),
|
|
|
|
const RoundCountDisplay(),
|
|
|
|
gameBloc: gameBloc,
|
|
|
|
gameBloc: gameBloc,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await tester.pump();
|
|
|
|
await tester.pump();
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
(widget) => widget is BallIndicator && widget.isActive,
|
|
|
|
(widget) => widget is RoundIndicator && widget.isActive,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
findsNWidgets(2),
|
|
|
|
findsNWidgets(2),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
(widget) => widget is BallIndicator && !widget.isActive,
|
|
|
|
(widget) => widget is RoundIndicator && !widget.isActive,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
findsOneWidget,
|
|
|
|
findsOneWidget,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
testWidgets('one active balls', (tester) async {
|
|
|
|
testWidgets('one active ball', (tester) async {
|
|
|
|
final state = initialState.copyWith(
|
|
|
|
final state = initialState.copyWith(
|
|
|
|
balls: 1,
|
|
|
|
balls: 1,
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -77,21 +77,21 @@ void main() {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpApp(
|
|
|
|
const BallCountDisplay(),
|
|
|
|
const RoundCountDisplay(),
|
|
|
|
gameBloc: gameBloc,
|
|
|
|
gameBloc: gameBloc,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await tester.pump();
|
|
|
|
await tester.pump();
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
(widget) => widget is BallIndicator && widget.isActive,
|
|
|
|
(widget) => widget is RoundIndicator && widget.isActive,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
findsOneWidget,
|
|
|
|
findsOneWidget,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
expect(
|
|
|
|
expect(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
find.byWidgetPredicate(
|
|
|
|
(widget) => widget is BallIndicator && !widget.isActive,
|
|
|
|
(widget) => widget is RoundIndicator && !widget.isActive,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
findsNWidgets(2),
|
|
|
|
findsNWidgets(2),
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -101,7 +101,7 @@ void main() {
|
|
|
|
testWidgets('active score ball is displaying with proper color',
|
|
|
|
testWidgets('active score ball is displaying with proper color',
|
|
|
|
(tester) async {
|
|
|
|
(tester) async {
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpApp(
|
|
|
|
const BallIndicator(isActive: true),
|
|
|
|
const RoundIndicator(isActive: true),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await tester.pump();
|
|
|
|
await tester.pump();
|
|
|
|
|
|
|
|
|
|
|
@ -116,7 +116,7 @@ void main() {
|
|
|
|
testWidgets('inactive score ball is displaying with proper color',
|
|
|
|
testWidgets('inactive score ball is displaying with proper color',
|
|
|
|
(tester) async {
|
|
|
|
(tester) async {
|
|
|
|
await tester.pumpApp(
|
|
|
|
await tester.pumpApp(
|
|
|
|
const BallIndicator(isActive: false),
|
|
|
|
const RoundIndicator(isActive: false),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await tester.pump();
|
|
|
|
await tester.pump();
|
|
|
|
|
|
|
|
|