fix(flutter): 收紧播放页底部与互动栏
This commit is contained in:
1 parent
7b4a792c12
commit
cf93d8d794
10 files changed
+167
-240
No files matched your search
@@ -106,7 +106,7 @@ void main() {
|
||||
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
|
||||
expect(find.byType(PlayerCenterToggle), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-fullscreen-toggle')));
|
||||
await _clearFromMore(tester);
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byKey(const Key('player-controls-top')), findsNothing);
|
||||
@@ -173,13 +173,53 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('should_keep_compact_bottom_panel_and_lower_rail', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
await _openSeriesPlayer(tester);
|
||||
|
||||
final screenHeight = tester.view.physicalSize.height;
|
||||
final bottom = tester.getRect(
|
||||
find.byKey(const Key('player-controls-bottom')),
|
||||
);
|
||||
final rail = tester.getRect(
|
||||
find.byKey(const Key('player-interaction-rail')),
|
||||
);
|
||||
|
||||
expect(bottom.height, lessThanOrEqualTo(200));
|
||||
expect(bottom.top, greaterThanOrEqualTo(screenHeight * 0.78));
|
||||
expect(rail.top, greaterThanOrEqualTo(screenHeight * 0.55 - 2));
|
||||
expect(rail.bottom, lessThanOrEqualTo(bottom.top));
|
||||
expect(find.byKey(const Key('player-author-note')), findsNothing);
|
||||
expect(
|
||||
tester
|
||||
.getSize(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('player-rail-comments')),
|
||||
matching: find.byIcon(Icons.chat_bubble_outline_rounded),
|
||||
),
|
||||
)
|
||||
.width,
|
||||
24,
|
||||
);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-synopsis-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
final expandedBottom = tester.getRect(
|
||||
find.byKey(const Key('player-controls-bottom')),
|
||||
);
|
||||
expect(expandedBottom.height, lessThanOrEqualTo(200));
|
||||
expect(expandedBottom.top, greaterThanOrEqualTo(screenHeight * 0.78));
|
||||
});
|
||||
|
||||
testWidgets('should_keep_series_clear_state_when_swiping_next_episode', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
await _openSeriesPlayer(tester);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-fullscreen-toggle')));
|
||||
await _clearFromMore(tester);
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('player-controls-top')), findsNothing);
|
||||
|
||||
@@ -237,7 +277,7 @@ void main() {
|
||||
await tester.tap(find.byKey(const Key('player-speed-1.5')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-fullscreen-toggle')));
|
||||
await _clearFromMore(tester);
|
||||
await tester.pump();
|
||||
expect(find.byKey(const Key('player-more')), findsNothing);
|
||||
|
||||
@@ -383,19 +423,6 @@ void main() {
|
||||
expect(find.byKey(const Key('player-exit-clear-screen')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_toggle_fullscreen_from_the_same_pill', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
await _openSeriesPlayer(tester);
|
||||
await tester.tap(find.byKey(const Key('player-fullscreen-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('player-controls-top')), findsNothing);
|
||||
|
||||
await tester.tap(find.byKey(const Key('player-fullscreen-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('player-controls-top')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-controls-bottom')), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('should_open_unlock_panel_with_honest_method_states', (
|
||||
tester,
|
||||
) async {
|
||||
@@ -434,7 +461,6 @@ void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
expect(find.byKey(const Key('player-drama-title')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-episode-label')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-synopsis')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-time-label')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-more')), findsOneWidget);
|
||||
for (final key in const [Key('player-back'), Key('player-more')]) {
|
||||
expect(tester.getSize(find.byKey(key)), const Size(36, 36));
|
||||
@@ -442,7 +468,7 @@ void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
expect(find.byKey(const Key('player-play-toggle')), findsNothing);
|
||||
expect(find.byKey(const Key('player-episodes')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-rail-comments')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-fullscreen-toggle')), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-fullscreen-toggle')), findsNothing);
|
||||
expect(find.byType(Slider), findsOneWidget);
|
||||
expect(find.byKey(const Key('player-title')), findsNothing);
|
||||
expect(find.byKey(const Key('player-subtitle')), findsNothing);
|
||||
@@ -457,6 +483,13 @@ void _expectFullscreenOverlay(WidgetTester tester) {
|
||||
expect(find.byKey(const Key('player-rail-share')), findsOneWidget);
|
||||
}
|
||||
|
||||
Future<void> _clearFromMore(WidgetTester tester) async {
|
||||
await tester.tap(find.byKey(const Key('player-more')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('player-more-clear')));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> _openSeriesPlayer(
|
||||
WidgetTester tester, {
|
||||
Key cardKey = const Key('home-drama-card-city-lights-demo'),
|
||||
|
||||
Reference in new issue
Block a user