fix(favorite): 统一收藏状态与互动图标
This commit is contained in:
1 parent
4b97f89c0b
commit
d3dbc9f8dc
13 files changed
+347
-213
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/data/services/interaction_controller.dart';
|
||||
import 'package:fruitshorts/core/theme/app_colors.dart';
|
||||
import 'package:fruitshorts/core/theme/app_theme.dart';
|
||||
import 'package:fruitshorts/l10n/app_localizations.dart';
|
||||
import 'package:fruitshorts/pages/player/widgets/home_feed_overlay.dart';
|
||||
@@ -41,13 +42,13 @@ void main() {
|
||||
);
|
||||
expect(repository.likeTargets, hasLength(1));
|
||||
expect(haptics.lightImpacts, 1);
|
||||
expect(
|
||||
final likeImage = tester.widget<Image>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('rail-like')),
|
||||
matching: find.byIcon(Icons.favorite_rounded),
|
||||
matching: find.byType(Image),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(likeImage.color, AppColors.doubleTapHeartRed);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -630,6 +630,53 @@ void main() {
|
||||
expect(interactions.likeTargets, ['EPISODE:the-signal-demo-1']);
|
||||
});
|
||||
|
||||
testWidgets('should_keep_favorite_count_when_player_saves_and_returns', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
await tester.tap(find.byKey(const Key('tab-recommend')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final initialCount = _railLabel(tester, const Key('rail-save'));
|
||||
await tester.tap(find.byKey(const Key('home-feed-series-name')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(_railLabel(tester, const Key('player-rail-save')), initialCount);
|
||||
await tester.tap(find.byKey(const Key('player-rail-save')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final savedCount = _railLabel(tester, const Key('player-rail-save'));
|
||||
expect(savedCount, isNot(initialCount));
|
||||
await tester.tap(find.byKey(const Key('player-back')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(AuthPage), findsNothing);
|
||||
expect(_railLabel(tester, const Key('rail-save')), savedCount);
|
||||
});
|
||||
|
||||
testWidgets('should_keep_favorite_state_when_recommend_opens_player', (
|
||||
tester,
|
||||
) async {
|
||||
await _pumpApp(tester);
|
||||
await tester.tap(find.byKey(const Key('tab-recommend')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await tester.tap(find.byKey(const Key('rail-save')));
|
||||
await tester.pumpAndSettle();
|
||||
final savedCount = _railLabel(tester, const Key('rail-save'));
|
||||
|
||||
await tester.tap(find.byKey(const Key('home-feed-series-name')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(_railLabel(tester, const Key('player-rail-save')), savedCount);
|
||||
final saveImage = tester.widget<Image>(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('player-rail-save')),
|
||||
matching: find.byType(Image),
|
||||
),
|
||||
);
|
||||
expect(saveImage.color, AppColors.blue);
|
||||
});
|
||||
|
||||
testWidgets('should_keep_video_surface_background_black', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
await _openSeriesPlayer(tester);
|
||||
@@ -646,9 +693,7 @@ void main() {
|
||||
expect(find.byKey(const Key('player-fallback-scrim')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('should_open_comments_without_login', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('should_open_comments_without_login', (tester) async {
|
||||
await _pumpApp(tester);
|
||||
await _openSeriesPlayer(tester);
|
||||
|
||||
@@ -1914,7 +1959,6 @@ void main() {
|
||||
find.text('Available unlock methods vary by title.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
testWidgets('should_require_login_before_opening_unlock_flow', (
|
||||
|
||||
Reference in new issue
Block a user