feat(recommend): 剧单更多进入两列详情页

This commit is contained in:
Zhou Weidong committed 2026-10-23 03:18:24 +08:00
1 parent f4cf7bc2dd
commit 9b1afbdb36
4 files changed
+408 -43

No files matched your search

+68 -1
View File
@@ -250,6 +250,45 @@ void main() {
expect(tester.getTopLeft(tagsFinder).dx, tester.getTopLeft(coverFinder).dx);
});
testWidgets('should_open_playlist_detail_with_collage_and_two_columns', (
tester,
) async {
await _pumpRecommend(tester);
await tester.tap(find.byKey(const Key('recommend-tab-playlist')));
await tester.pumpAndSettle();
await tester.ensureVisible(find.byKey(const Key('recommend-more-hits')));
await tester.tap(find.byKey(const Key('recommend-more-hits')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('playlist-detail-page')), findsOneWidget);
expect(find.byKey(const Key('playlist-detail-collage')), findsOneWidget);
expect(
tester.widget<Text>(find.byKey(const Key('playlist-detail-title'))).data,
"This Week's Hits",
);
expect(
tester
.widget<Text>(find.byKey(const Key('playlist-detail-subtitle')))
.data,
'Binge the hottest stories of the week!',
);
final grid = tester.widget<SliverGrid>(
find.byKey(const Key('playlist-detail-grid')),
);
final delegate =
grid.gridDelegate as SliverGridDelegateWithFixedCrossAxisCount;
expect(delegate.crossAxisCount, 2);
final first = tester.getRect(
find.byKey(const Key('home-feed-card-the-signal-demo')),
);
final second = tester.getRect(
find.byKey(const Key('home-feed-card-city-lights-demo')),
);
expect(second.top, closeTo(first.top, 1));
expect(second.left, greaterThan(first.right));
while (tester.takeException() != null) {}
});
testWidgets('should_switch_inner_tabs_without_losing_grid_filter_state', (
tester,
) async {
@@ -521,7 +560,7 @@ void main() {
) async {
await _pumpRecommend(tester);
await tester.tap(find.byKey(const Key('home-feed-title-open')));
await tester.tap(find.byKey(const Key('home-feed-series-name')));
await tester.pumpAndSettle();
expect(
tester.widget<PlayerPage>(find.byType(PlayerPage).last).homeMode,
@@ -540,6 +579,34 @@ void main() {
);
});
testWidgets('should_pull_refresh_recommend_feed_from_the_first_video', (
tester,
) async {
await _pumpRecommend(tester);
final gesture = await tester.startGesture(
tester.getCenter(find.byKey(const Key('recommend-feed-player'))),
);
await gesture.moveBy(const Offset(0, 80));
await tester.pump();
expect(find.byKey(const Key('pull-refresh-indicator')), findsOneWidget);
final feedScroll = tester.state<ScrollableState>(
find
.descendant(
of: find.byKey(const Key('recommend-feed-player')),
matching: find.byType(Scrollable),
)
.first,
);
expect(feedScroll.position.pixels, 0);
await gesture.up();
await tester.pump();
expect(feedScroll.position.pixels, 0);
await tester.pump(const Duration(milliseconds: 400));
while (tester.takeException() != null) {}
});
testWidgets('should_open_player_and_search_from_recommend_page', (
tester,
) async {