fix(home): 修正封面角标与题材标签
This commit is contained in:
1 parent
3abf69e886
commit
e16faa258a
10 files changed
+199
-199
No files matched your search
@@ -96,17 +96,14 @@ void main() {
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
final ribbon = find.byKey(
|
||||
const Key('drama-genre-ribbon-the-signal-demo-0'),
|
||||
final tags = tester.widget<Text>(
|
||||
find.byKey(const Key('following-tags-the-signal-demo')),
|
||||
);
|
||||
expect(ribbon, findsOneWidget);
|
||||
final ribbonText = tester.widget<Text>(
|
||||
find.descendant(of: ribbon, matching: find.byType(Text)),
|
||||
);
|
||||
expect(ribbonText.data, 'Suspense');
|
||||
expect(ribbonText.style?.fontSize, AppDimens.cardBadgeFont);
|
||||
expect(ribbonText.style?.color, AppColors.textPrimary);
|
||||
expect(tags.data, 'Suspense | Mystery');
|
||||
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
||||
expect(tags.style?.color, AppColors.textTertiary);
|
||||
expect(tester.getTopLeft(title).dx, tester.getTopLeft(cover).dx);
|
||||
expect(tester.getTopLeft(tags).dx, tester.getTopLeft(cover).dx);
|
||||
|
||||
await tester.tap(find.byKey(const Key('following-edit')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -48,13 +48,10 @@ void main() {
|
||||
coverClip.borderRadius,
|
||||
BorderRadius.circular(AppDimens.cardCoverRadius),
|
||||
);
|
||||
final badge = find.byKey(const Key('home-feed-badge-anime-anime-card'));
|
||||
expect(badge, findsOneWidget);
|
||||
final badgeContainer = tester.widget<Container>(badge);
|
||||
expect(
|
||||
(badgeContainer.decoration! as BoxDecoration).borderRadius,
|
||||
BorderRadius.circular(AppDimens.cardBadgeRadius),
|
||||
final badge = find.byKey(
|
||||
const Key('drama-cover-badge-ribbon-anime-card-anime'),
|
||||
);
|
||||
expect(badge, findsOneWidget);
|
||||
expect(
|
||||
tester
|
||||
.widget<Text>(find.descendant(of: badge, matching: find.byType(Text)))
|
||||
@@ -62,6 +59,14 @@ void main() {
|
||||
?.fontSize,
|
||||
AppDimens.cardBadgeFont,
|
||||
);
|
||||
expect(
|
||||
tester.getTopRight(badge).dx,
|
||||
closeTo(tester.getTopRight(cover).dx, 1),
|
||||
);
|
||||
expect(
|
||||
tester.getTopRight(badge).dy,
|
||||
closeTo(tester.getTopRight(cover).dy, 1),
|
||||
);
|
||||
expect(find.text('Anime'), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-feed-views-anime-card')), findsOneWidget);
|
||||
final views = find.byKey(const Key('home-feed-views-anime-card'));
|
||||
@@ -85,15 +90,14 @@ void main() {
|
||||
expect(title.style?.fontSize, AppDimens.cardTitleFont);
|
||||
expect(title.style?.fontWeight, FontWeight.w500);
|
||||
expect(title.style?.height, AppDimens.cardTitleLineHeight);
|
||||
final ribbon = find.byKey(const Key('drama-genre-ribbon-anime-card-0'));
|
||||
expect(ribbon, findsOneWidget);
|
||||
final ribbonText = tester.widget<Text>(
|
||||
find.descendant(of: ribbon, matching: find.byType(Text)),
|
||||
final tags = tester.widget<Text>(
|
||||
find.byKey(const Key('home-feed-tags-anime-card')),
|
||||
);
|
||||
expect(ribbonText.data, 'Romance');
|
||||
expect(ribbonText.style?.fontSize, AppDimens.cardBadgeFont);
|
||||
expect(ribbonText.style?.color, AppColors.textPrimary);
|
||||
expect(tags.data, 'Romance | Urban');
|
||||
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
||||
expect(tags.style?.color, AppColors.textTertiary);
|
||||
expect(tester.getTopLeft(title).dx, tester.getTopLeft(cover).dx);
|
||||
expect(tester.getTopLeft(tags).dx, tester.getTopLeft(cover).dx);
|
||||
|
||||
await tester.tap(card);
|
||||
expect(taps, 1);
|
||||
@@ -134,14 +138,17 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.byKey(const Key('home-feed-badge-anime-anime')),
|
||||
find.byKey(const Key('drama-cover-badge-ribbon-anime-anime')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('home-feed-badge-newRelease-new')),
|
||||
find.byKey(const Key('drama-cover-badge-ribbon-new-newRelease')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('drama-cover-badge-ribbon-hot-hot')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byKey(const Key('home-feed-badge-hot-hot')), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -115,17 +115,24 @@ void main() {
|
||||
matching: find.byIcon(Icons.auto_awesome_rounded),
|
||||
);
|
||||
expect(viewIcon, findsOneWidget);
|
||||
final ribbon = find.byKey(
|
||||
const Key('drama-genre-ribbon-hits-the-signal-demo-0'),
|
||||
final badge = find.byKey(
|
||||
const Key('drama-cover-badge-ribbon-hits-the-signal-demo-hot'),
|
||||
);
|
||||
expect(ribbon, findsOneWidget);
|
||||
final ribbonText = tester.widget<Text>(
|
||||
find.descendant(of: ribbon, matching: find.byType(Text)),
|
||||
expect(badge, findsOneWidget);
|
||||
final badgeText = tester.widget<Text>(
|
||||
find.descendant(of: badge, matching: find.byType(Text)),
|
||||
);
|
||||
expect(ribbonText.data, 'Suspense');
|
||||
expect(ribbonText.style?.fontSize, AppDimens.cardBadgeFont);
|
||||
expect(ribbonText.style?.color, AppColors.textPrimary);
|
||||
expect(badgeText.data, 'Hit');
|
||||
expect(badgeText.style?.fontSize, AppDimens.cardBadgeFont);
|
||||
expect(badgeText.style?.color, AppColors.textPrimary);
|
||||
final tags = tester.widget<Text>(
|
||||
find.byKey(const Key('recommend-tags-hits-the-signal-demo')),
|
||||
);
|
||||
expect(tags.data, 'Suspense | Mystery');
|
||||
expect(tags.style?.fontSize, AppDimens.cardTagFont);
|
||||
expect(tags.style?.color, AppColors.textTertiary);
|
||||
expect(tester.getTopLeft(cardTitle).dx, tester.getTopLeft(cover).dx);
|
||||
expect(tester.getTopLeft(tags).dx, tester.getTopLeft(cover).dx);
|
||||
});
|
||||
|
||||
testWidgets('should_switch_inner_tabs_without_losing_grid_filter_state', (
|
||||
|
||||
Reference in new issue
Block a user