test(ui): 更新主题导航与布局断言

This commit is contained in:
Zhou Weidong committed 2026-10-26 22:49:23 +08:00
1 parent 2d65cd3006
commit 6512808506
6 files changed
+52 -47

No files matched your search

+17 -23
View File
@@ -305,7 +305,7 @@ void main() {
find.byKey(const Key('home-feed-episode-progress')),
);
expect(episodeProgress.maxLines, 1);
expect(episodeProgress.softWrap, isFalse);
expect(episodeProgress.overflow, TextOverflow.ellipsis);
expect(episodeProgress.style?.fontSize, 13);
expect(episodeProgress.style?.color, AppColors.overlayLabel);
expect(
@@ -646,13 +646,14 @@ void main() {
.ignoring,
isTrue,
);
expect(find.byKey(const Key('scrub-preview-time-bubble')), findsOneWidget);
final bubbleRect = tester.getRect(
find.byKey(const Key('scrub-preview-time-bubble')),
expect(find.byKey(const Key('scrub-preview-card')), findsOneWidget);
expect(find.byKey(const Key('scrub-preview-time')), findsOneWidget);
final previewRect = tester.getRect(
find.byKey(const Key('scrub-preview-card')),
);
expect(bubbleRect.left, greaterThanOrEqualTo(12));
expect(previewRect.left, greaterThanOrEqualTo(12));
expect(
bubbleRect.right,
previewRect.right,
lessThanOrEqualTo(
tester.getRect(find.byKey(const Key('home-feed-gesture'))).right - 12,
),
@@ -662,33 +663,26 @@ void main() {
.getRect(find.byKey(const Key('home-feed-progress-track')))
.center
.dy -
bubbleRect.bottom,
previewRect.bottom,
closeTo(16, 0.1),
);
final bubbleContainer = tester.widget<Container>(
find.descendant(
of: find.byKey(const Key('scrub-preview-time-bubble')),
matching: find.byType(Container),
),
);
expect(
(bubbleContainer.decoration! as BoxDecoration).color,
AppColors.timeBubbleScrim,
);
expect(
bubbleContainer.padding,
const EdgeInsets.symmetric(horizontal: 6, vertical: 3),
final previewContainer = tester.widget<Container>(
find.byKey(const Key('scrub-preview-card')),
);
final previewDecoration = previewContainer.decoration! as BoxDecoration;
expect(previewDecoration.color, AppColors.card);
expect(previewDecoration.borderRadius, BorderRadius.circular(8));
expect((previewDecoration.border! as Border).top.color, AppColors.onPrimary);
await gesture.moveBy(const Offset(-600, 0));
await tester.pump();
expect(
tester.getRect(find.byKey(const Key('scrub-preview-time-bubble'))).left,
tester.getRect(find.byKey(const Key('scrub-preview-card'))).left,
closeTo(12, 0.1),
);
await gesture.moveBy(const Offset(1200, 0));
await tester.pump();
expect(
tester.getRect(find.byKey(const Key('scrub-preview-time-bubble'))).right,
tester.getRect(find.byKey(const Key('scrub-preview-card'))).right,
closeTo(
tester.getRect(find.byKey(const Key('home-feed-gesture'))).right - 12,
0.1,
@@ -980,7 +974,7 @@ void main() {
await tester.pump();
expect(find.byKey(const Key('scrub-preview-card')), findsOneWidget);
expect(find.byKey(const Key('scrub-preview-poster')), findsOneWidget);
expect(find.byKey(const Key('scrub-preview-background')), findsOneWidget);
expect(find.textContaining('/ 01:40'), findsOneWidget);
await gesture.up();