test(client): 用例名统一为 should_<期望>_when_<条件>(155/155)
为什么:红线第 8 条门禁立即生效,要求 Flutter 测试命名合规;此前 155 条用例名是英文自然语言 或中文描述,合规数 0/155,属存量欠账,按"先补齐再上新功能"在本批处理。 - 25 个测试文件、155 条用例改名,按「文件 + 旧名」精确定位,每条断言命中恰好 1 次才替换 - 只改名字字面量:改动行 155 删 + 155 增,无一行不含字符串字面量(断言与用例体零改动) - 门禁:dart analyze lib test = No issues found;flutter test = 155 全过
This commit is contained in:
1 parent
1853e1845c
commit
0e5d550b50
25 files changed
+155
-155
No files matched your search
@@ -17,7 +17,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
test('warm playback starts before old native disposal finishes', () async {
|
||||
test('should_start_warm_playback_when_old_native_disposal_is_still_running', () async {
|
||||
final release = Completer<void>();
|
||||
final factory = _Factory(disposeGates: {'ep-0': release});
|
||||
final session = PlaybackSession(
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('failed native release blocks another route from allocating', () async {
|
||||
test('should_block_another_route_from_allocating_when_native_release_fails', () async {
|
||||
final factory = _Factory(disposeFailures: {'ep-0'});
|
||||
final coordinator = PlaybackCoordinator();
|
||||
PlaybackSession createSession() => PlaybackSession(
|
||||
@@ -68,7 +68,7 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'next is prepared silently and promoted without another initialize',
|
||||
'should_prepare_next_silently_and_promote_it_when_swiped',
|
||||
() async {
|
||||
final factory = _Factory();
|
||||
final prepared = <String>[];
|
||||
@@ -103,7 +103,7 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
test('in-flight preload is reused when swiped before ready', () async {
|
||||
test('should_reuse_in_flight_preload_when_swiped_before_ready', () async {
|
||||
final gate = Completer<void>();
|
||||
final factory = _Factory(gates: {'ep-1': gate});
|
||||
final session = PlaybackSession(
|
||||
@@ -127,7 +127,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('rapid reverse and skipped selection discard stale warm work', () async {
|
||||
test('should_discard_stale_warm_work_when_reversing_rapidly_or_skipping_selection', () async {
|
||||
final gate = Completer<void>();
|
||||
final factory = _Factory(gates: {'ep-1': gate});
|
||||
final session = PlaybackSession(
|
||||
@@ -153,7 +153,7 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'category adjacency and locked next never preload the wrong episode',
|
||||
'should_never_preload_wrong_episode_when_next_is_locked_or_category_based',
|
||||
() async {
|
||||
final factory = _Factory();
|
||||
final session = PlaybackSession(
|
||||
@@ -172,7 +172,7 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
test('preload failure is isolated and selecting it retries once', () async {
|
||||
test('should_isolate_preload_failure_and_retry_once_when_selected', () async {
|
||||
final factory = _Factory(failOnce: {'ep-1'});
|
||||
final session = PlaybackSession(
|
||||
episodes: episodes,
|
||||
@@ -190,7 +190,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('completion in background never starts either player', () async {
|
||||
test('should_start_no_player_when_completion_happens_in_background', () async {
|
||||
final gate = Completer<void>();
|
||||
final factory = _Factory(gates: {'ep-1': gate});
|
||||
final session = PlaybackSession(
|
||||
@@ -215,7 +215,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('closing during preloading disposes pending resources', () async {
|
||||
test('should_dispose_pending_resources_when_closing_during_preload', () async {
|
||||
final gate = Completer<void>();
|
||||
final factory = _Factory(gates: {'ep-1': gate});
|
||||
final session = PlaybackSession(
|
||||
@@ -233,7 +233,7 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'home and series share a two-player budget across route handoff',
|
||||
'should_share_two_player_budget_when_handing_off_between_home_and_series',
|
||||
() async {
|
||||
final factory = _Factory();
|
||||
final coordinator = PlaybackCoordinator();
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:nontonki/core/data/models/drama.dart';
|
||||
import 'package:nontonki/core/data/services/playback_queue.dart';
|
||||
|
||||
void main() {
|
||||
test('home feed advances between dramas, series player between episodes', () {
|
||||
test('should_advance_between_dramas_on_home_and_between_episodes_in_series_when_queue_is_built', () {
|
||||
final dramas = [_drama('a', 3), _drama('b', 2), _drama('c', 4)];
|
||||
|
||||
final home = PlaybackQueue.home(dramas);
|
||||
@@ -22,7 +22,7 @@ void main() {
|
||||
expect(series.nextIndex(2), isNull);
|
||||
});
|
||||
|
||||
test('dramas without episodes are left out of the home queue', () {
|
||||
test('should_leave_dramas_out_when_they_have_no_episodes', () {
|
||||
final home = PlaybackQueue.home([
|
||||
_drama('a', 2),
|
||||
Drama(
|
||||
@@ -36,7 +36,7 @@ void main() {
|
||||
expect(home.entryAt(0).drama.id, 'a');
|
||||
});
|
||||
|
||||
test('a list card with a preview episode plays on the home feed', () {
|
||||
test('should_play_preview_episode_when_list_card_has_one', () {
|
||||
final home = PlaybackQueue.home([
|
||||
Drama.fromCardJson(const {
|
||||
'id': 5,
|
||||
|
||||
@@ -17,7 +17,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
test('locked episode never creates or initializes a player', () async {
|
||||
test('should_create_no_player_when_episode_is_locked', () async {
|
||||
final factory = FakeFactory();
|
||||
final session = PlaybackSession(
|
||||
episodes: episodes,
|
||||
@@ -30,7 +30,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('rapid selection drops stale initialize and keeps one player', () async {
|
||||
test('should_drop_stale_initialize_and_keep_one_player_when_selection_is_rapid', () async {
|
||||
final factory = FakeFactory(holdFirstInitialize: true);
|
||||
final session = PlaybackSession(
|
||||
episodes: episodes,
|
||||
@@ -52,7 +52,7 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'background and overlay pause without forgetting playback intent',
|
||||
'should_pause_without_forgetting_intent_when_backgrounding_or_overlay_shows',
|
||||
() async {
|
||||
final factory = FakeFactory();
|
||||
final session = PlaybackSession(
|
||||
@@ -80,7 +80,7 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
test('resume preparation finishes before video starts', () async {
|
||||
test('should_finish_resume_preparation_before_video_starts_when_resuming', () async {
|
||||
final factory = FakeFactory();
|
||||
final prepared = Completer<void>();
|
||||
final session = PlaybackSession(
|
||||
@@ -99,7 +99,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('pausing then swiping to the next episode resumes playback', () async {
|
||||
test('should_resume_playback_when_swiping_after_pause', () async {
|
||||
final factory = FakeFactory();
|
||||
final session = PlaybackSession(
|
||||
episodes: episodes,
|
||||
@@ -121,7 +121,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('re-selecting the same episode keeps the user pause', () async {
|
||||
test('should_keep_user_pause_when_reselecting_the_same_episode', () async {
|
||||
final factory = FakeFactory();
|
||||
final session = PlaybackSession(
|
||||
episodes: episodes,
|
||||
@@ -140,7 +140,7 @@ void main() {
|
||||
await session.close();
|
||||
});
|
||||
|
||||
test('automatic advance respects visibility and playback intent', () async {
|
||||
test('should_respect_visibility_and_intent_when_advancing_automatically', () async {
|
||||
final factory = FakeFactory();
|
||||
final session = PlaybackSession(
|
||||
episodes: episodes,
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:nontonki/pages/player/widgets/seek_progress_bar.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
void main() {
|
||||
test('seek target stays inside playable duration', () {
|
||||
test('should_keep_seek_target_inside_playable_duration_when_dragging', () {
|
||||
const duration = Duration(seconds: 12);
|
||||
expect(seekPositionForFraction(0, duration), Duration.zero);
|
||||
expect(
|
||||
@@ -14,7 +14,7 @@ void main() {
|
||||
expect(seekPositionForFraction(1, duration), lessThan(duration));
|
||||
});
|
||||
|
||||
testWidgets('horizontal slider drag previews and seeks on release', (
|
||||
testWidgets('should_preview_while_dragging_and_seek_on_release_when_slider_is_horizontal', (
|
||||
tester,
|
||||
) async {
|
||||
final video = ValueNotifier<VideoPlayerValue>(
|
||||
@@ -61,7 +61,7 @@ void main() {
|
||||
expect(target!, lessThan(const Duration(seconds: 12)));
|
||||
});
|
||||
|
||||
testWidgets('compact seek bar shows time only while dragging', (
|
||||
testWidgets('should_show_time_only_while_dragging_when_seek_bar_is_compact', (
|
||||
tester,
|
||||
) async {
|
||||
final video = ValueNotifier<VideoPlayerValue>(
|
||||
|
||||
@@ -12,7 +12,7 @@ Episode _episode(String videoUrl) => Episode(
|
||||
);
|
||||
|
||||
void main() {
|
||||
test('相对播放地址补上服务地址', () {
|
||||
test('should_prefix_service_base_when_play_url_is_relative', () {
|
||||
final uri = VideoPlayerPort.resolveUri(
|
||||
_episode('/files/episode/202610/clip.mp4'),
|
||||
);
|
||||
@@ -27,7 +27,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('已经是绝对地址的不再拼接', () {
|
||||
test('should_keep_url_untouched_when_play_url_is_absolute', () {
|
||||
final uri = VideoPlayerPort.resolveUri(
|
||||
_episode('https://cdn.example.test/clip.mp4'),
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:shared_preferences_platform_interface/in_memory_shared_preferenc
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
|
||||
void main() {
|
||||
test('resume position clamps invalid and completed values', () {
|
||||
test('should_clamp_invalid_and_completed_values_when_resolving_resume_position', () {
|
||||
const duration = Duration(seconds: 8);
|
||||
expect(
|
||||
clampResumePosition(const Duration(seconds: -1), duration),
|
||||
@@ -25,7 +25,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('watch history is scoped by profile, drama and episode', () async {
|
||||
test('should_scope_history_by_profile_drama_and_episode_when_saving', () async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.empty();
|
||||
final history = SharedPreferencesWatchHistoryRepository();
|
||||
@@ -53,7 +53,7 @@ void main() {
|
||||
expect(await history.lastEpisodeId('profile-a', 'drama-b'), isNull);
|
||||
});
|
||||
|
||||
test('resume prefers the first loaded episode', () async {
|
||||
test('should_prefer_first_loaded_episode_when_resuming', () async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.empty();
|
||||
final history = SharedPreferencesWatchHistoryRepository();
|
||||
@@ -87,7 +87,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('resume falls back to the last watched episode for a list card', () async {
|
||||
test('should_fall_back_to_last_watched_episode_when_resuming_a_list_card', () async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.empty();
|
||||
final history = SharedPreferencesWatchHistoryRepository();
|
||||
@@ -112,7 +112,7 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('a list card with no history has no resume position', () async {
|
||||
test('should_have_no_resume_position_when_list_card_has_no_history', () async {
|
||||
SharedPreferencesAsyncPlatform.instance =
|
||||
InMemorySharedPreferencesAsync.empty();
|
||||
final history = SharedPreferencesWatchHistoryRepository();
|
||||
|
||||
Reference in new issue
Block a user