Skip to content

Commit facd43a

Browse files
committed
FIX: 修复 CI 测试失败
1 parent 3dd9e9d commit facd43a

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

lib/widgets/common/masked_sentence_tile.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@ class _SentenceBookmarkHitArea extends StatelessWidget {
307307

308308
@override
309309
Widget build(BuildContext context) {
310-
final l10n = AppLocalizations.of(context)!;
310+
final l10n = AppLocalizations.of(context);
311311
final semanticLabel = isBookmarked
312-
? l10n.intensiveListenMarkedDifficult
313-
: l10n.intensiveListenNotDifficult;
312+
? (l10n?.intensiveListenMarkedDifficult ?? 'Marked difficult')
313+
: (l10n?.intensiveListenNotDifficult ?? 'Not marked difficult');
314314
final iconColor = isBookmarked
315315
? Colors.amber
316316
: theme.colorScheme.onSurfaceVariant.withValues(alpha: 0.28);

test/services/storage_service_test.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void main() {
1515
await StorageService.saveSettings(
1616
const ListeningPracticeSettingsStore(
1717
full: PlaybackSettings(
18-
playbackSpeed: 1.25,
18+
playbackSpeed: 1.3,
1919
showTranscript: true,
2020
singleSentenceMode: false,
2121
wholeLoopCount: 4,
@@ -30,7 +30,7 @@ void main() {
3030
);
3131

3232
final loaded = await StorageService.loadSettings();
33-
expect(loaded.full.playbackSpeed, 1.25);
33+
expect(loaded.full.playbackSpeed, 1.3);
3434
expect(loaded.full.showTranscript, isTrue);
3535
expect(loaded.full.singleSentenceMode, isFalse);
3636
expect(loaded.full.wholeLoopCount, 4);
@@ -69,5 +69,22 @@ void main() {
6969
expect(loaded.bookmark.sentenceLoopCount, 1);
7070
expect(loaded.bookmark.sentenceInterval, const Duration(seconds: 1));
7171
});
72+
73+
test('旧持久化中的非支持倍速读取时回退到 1.0x', () async {
74+
final prefs = await SharedPreferences.getInstance();
75+
await prefs.setString(
76+
'playback_settings',
77+
json.encode({
78+
'fullSettings': const PlaybackSettings(playbackSpeed: 1.0).toJson()
79+
..['playbackSpeed'] = 1.25,
80+
'bookmarkSettings':
81+
const PlaybackSettings(playbackSpeed: 0.8).toJson(),
82+
}),
83+
);
84+
85+
final loaded = await StorageService.loadSettings();
86+
expect(loaded.full.playbackSpeed, 1.0);
87+
expect(loaded.bookmark.playbackSpeed, 0.8);
88+
});
7289
});
7390
}

0 commit comments

Comments
 (0)