feat(recommend): 新增分区流全部短剧与剧单

This commit is contained in:
Zhou Weidong committed 2026-10-22 17:23:22 +08:00
1 parent 0ef2438100
commit f1b5418954
22 files changed
+1426 -722

No files matched your search

+19 -62
View File
@@ -19,6 +19,7 @@ import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart
import 'package:fruitshorts/core/data/services/playback_session.dart';
import 'package:fruitshorts/core/theme/app_colors.dart';
import 'package:fruitshorts/pages/auth/auth_view.dart';
import 'package:fruitshorts/pages/player/player_view.dart';
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
import 'package:fruitshorts/pages/player/widgets/seek_progress_bar.dart';
@@ -41,17 +42,16 @@ void main() {
await _pumpApp(tester);
await tester.tap(find.byKey(const Key('tab-recommend')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('home-feed-full-series')));
await tester.tap(
find.byKey(const Key('recommend-card-hits-the-signal-demo')),
);
await tester.pumpAndSettle();
_expectFullscreenOverlay(tester);
expect(
tester.widget<PlayerPage>(find.byType(PlayerPage).last).homeMode,
isTrue,
);
expect(find.byType(PageView), findsOneWidget);
await tester.tap(find.byKey(const Key('player-more')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-more-quality-AUTO')), findsOneWidget);
expect(find.byKey(const Key('player-more-offline')), findsOneWidget);
await tester.tapAt(const Offset(10, 10));
await tester.pumpAndSettle();
expect(tester.takeException(), isNull);
});
@@ -61,7 +61,6 @@ void main() {
await _pumpApp(tester);
await tester.tap(find.byKey(const Key('tab-recommend')));
await tester.pumpAndSettle();
_expectPlayerNavigationBar(tester);
await _openSeriesPlayer(tester);
_expectPlayerNavigationBar(tester);
@@ -81,7 +80,12 @@ void main() {
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
await tester.tap(find.byKey(const Key('tab-recommend')));
await tester.pumpAndSettle();
await tester.tap(
find.byKey(const Key('recommend-card-hits-the-signal-demo')),
);
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
final ticketLoading = find.byKey(const Key('player-ticket-loading'));
expect(ticketLoading, findsOneWidget);
@@ -166,6 +170,10 @@ void main() {
);
await tester.tap(find.byKey(const Key('tab-recommend')));
await tester.pumpAndSettle();
await tester.tap(
find.byKey(const Key('recommend-card-hits-the-signal-demo')),
);
await tester.pumpAndSettle();
final player = players.firstWhere((item) => item.playing);
expect(player.playing, isTrue);
@@ -220,10 +228,8 @@ void main() {
'auth.user': '{"uid":"9","nickname":"Viewer","avatarUrl":""}',
});
await _pumpApp(tester);
await tester.tap(find.byKey(const Key('tab-recommend')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('rail-comments')));
await _openSeriesPlayer(tester);
await tester.tap(find.byKey(const Key('player-rail-comments')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-comments-sheet')), findsOneWidget);
@@ -266,34 +272,6 @@ void main() {
);
});
testWidgets('should_update_home_feed_favorite_count_after_toggle', (
tester,
) async {
SharedPreferencesAsyncPlatform.instance =
InMemorySharedPreferencesAsync.withData({
'auth.accessToken': 'access',
'auth.refreshToken': 'refresh',
'auth.user': '{"uid":"9","nickname":"Viewer","avatarUrl":""}',
});
final catalog = FakeCatalogRepository(dramas: [_countingDrama]);
await _pumpApp(tester, catalog: catalog);
await tester.tap(find.byKey(const Key('tab-recommend')));
await tester.pumpAndSettle();
expect(
tester.widget<Text>(find.byKey(const Key('rail-save-count'))).data,
'2',
);
await tester.tap(find.byKey(const Key('rail-save')));
await tester.pumpAndSettle();
expect(
tester.widget<Text>(find.byKey(const Key('rail-save-count'))).data,
'3',
);
});
testWidgets('should_show_center_toggle_only_when_paused', (tester) async {
await _pumpApp(tester);
await _openSeriesPlayer(tester);
@@ -1392,27 +1370,6 @@ Future<void> _pumpApp(
if (settle) await tester.pumpAndSettle();
}
const _countingDrama = Drama(
id: 'counting-demo',
title: 'Counting Demo',
synopsis: 'Counting interaction totals',
posterUrl: '/files/counting-demo.png',
genre: 'Romance',
detailLoaded: true,
favoriteCount: 2,
commentCount: 3,
likeCount: 4,
episodes: [
Episode(
id: 'counting-demo-1',
number: 1,
title: 'Episode 1',
isFree: true,
videoUrl: 'https://example.test/counting-1.mp4',
),
],
);
class _RecordingPlayer implements PlayerPort {
bool playing = false;