Initial commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:smplayer/features/player/widgets/android/android_gesture_feedback.dart';
|
||||
|
||||
void main() {
|
||||
Widget buildSubject({required bool seekIsForward}) {
|
||||
return MaterialApp(
|
||||
home: SizedBox(
|
||||
width: 360,
|
||||
height: 240,
|
||||
child: AndroidGestureFeedback(
|
||||
data: GestureFeedbackData(
|
||||
kind: GestureFeedbackKind.seek,
|
||||
seekTarget: const Duration(minutes: 1),
|
||||
totalDuration: const Duration(minutes: 10),
|
||||
seekIsForward: seekIsForward,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('seek preview shows rewind icon for backward seek', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(buildSubject(seekIsForward: false));
|
||||
|
||||
expect(find.byIcon(Icons.fast_rewind), findsOneWidget);
|
||||
expect(find.byIcon(Icons.fast_forward), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('seek preview shows forward icon for forward seek', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(buildSubject(seekIsForward: true));
|
||||
|
||||
expect(find.byIcon(Icons.fast_forward), findsOneWidget);
|
||||
expect(find.byIcon(Icons.fast_rewind), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('long press speed uses light background', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: SizedBox(
|
||||
width: 360,
|
||||
height: 240,
|
||||
child: AndroidGestureFeedback(
|
||||
data: GestureFeedbackData(
|
||||
kind: GestureFeedbackKind.longPressSpeed,
|
||||
speedRate: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final container = tester.widget<Container>(
|
||||
find.descendant(
|
||||
of: find.byType(AndroidGestureFeedback),
|
||||
matching: find.byType(Container),
|
||||
),
|
||||
);
|
||||
final decoration = container.decoration as BoxDecoration;
|
||||
|
||||
expect(decoration.color, const Color(0x45181818));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user