chore(client): 归档原型阶段新增文件(配置、主题、模型与测试)
为什么:上一批归档只覆盖了「已跟踪文件的修改」,原型阶段新增的文件(app_config、theme、 home_feed/play_ticket 模型、catalog_api、测试目录等)还是未入库状态 —— 而已入库的代码会 import 它们, 留在工作区会导致 HEAD 处的代码编译不过。一并归档,让 HEAD 自洽。 纯归档,无行为改动。
This commit is contained in:
1 parent
e1b98df509
commit
feecc349a0
19 files changed
+2210
No files matched your search
@@ -0,0 +1,96 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:nontonki/core/data/models/drama.dart';
|
||||
import 'package:nontonki/core/formatting/localized_content.dart';
|
||||
import 'package:nontonki/l10n/app_localizations_en.dart';
|
||||
import 'package:nontonki/l10n/app_localizations_zh.dart';
|
||||
|
||||
Drama _drama({required String id, String title = 'raw', String synopsis = 'raw'}) =>
|
||||
Drama(
|
||||
id: id,
|
||||
title: title,
|
||||
synopsis: synopsis,
|
||||
posterUrl: '/files/poster.png',
|
||||
episodes: const [],
|
||||
);
|
||||
|
||||
void main() {
|
||||
final en = AppLocalizationsEn();
|
||||
final zh = AppLocalizationsZh();
|
||||
|
||||
test('each seeded drama maps onto its own localized copy', () {
|
||||
final signal = _drama(id: 'the-signal-demo');
|
||||
final city = _drama(id: 'city-lights-demo');
|
||||
final vengeance = _drama(id: 'vengeance-demo');
|
||||
|
||||
expect(localizedDramaTitle(en, signal), en.dramaSignalTitle);
|
||||
expect(localizedDramaTitle(en, city), en.dramaCityTitle);
|
||||
expect(localizedDramaTitle(en, vengeance), en.dramaVengeanceTitle);
|
||||
|
||||
expect(localizedDramaSynopsis(en, signal), en.dramaSignalSynopsis);
|
||||
expect(localizedDramaSynopsis(en, city), en.dramaCitySynopsis);
|
||||
expect(localizedDramaSynopsis(en, vengeance), en.dramaVengeanceSynopsis);
|
||||
});
|
||||
|
||||
test('the mapping does not collapse two dramas onto one entry', () {
|
||||
final titles = {
|
||||
localizedDramaTitle(en, _drama(id: 'the-signal-demo')),
|
||||
localizedDramaTitle(en, _drama(id: 'city-lights-demo')),
|
||||
localizedDramaTitle(en, _drama(id: 'vengeance-demo')),
|
||||
};
|
||||
final synopses = {
|
||||
localizedDramaSynopsis(en, _drama(id: 'the-signal-demo')),
|
||||
localizedDramaSynopsis(en, _drama(id: 'city-lights-demo')),
|
||||
localizedDramaSynopsis(en, _drama(id: 'vengeance-demo')),
|
||||
};
|
||||
|
||||
expect(titles, hasLength(3));
|
||||
expect(synopses, hasLength(3));
|
||||
});
|
||||
|
||||
test('localized copy is translated rather than reused verbatim', () {
|
||||
final signal = _drama(id: 'the-signal-demo');
|
||||
|
||||
expect(localizedDramaTitle(zh, signal), zh.dramaSignalTitle);
|
||||
expect(localizedDramaSynopsis(zh, signal), zh.dramaSignalSynopsis);
|
||||
expect(localizedDramaTitle(zh, signal), isNot(en.dramaSignalTitle));
|
||||
});
|
||||
|
||||
test('an unknown drama keeps the catalog text in every locale', () {
|
||||
final custom = _drama(
|
||||
id: 'custom-demo',
|
||||
title: 'Custom Title',
|
||||
synopsis: 'Custom synopsis',
|
||||
);
|
||||
|
||||
expect(localizedDramaTitle(en, custom), 'Custom Title');
|
||||
expect(localizedDramaTitle(zh, custom), 'Custom Title');
|
||||
expect(localizedDramaSynopsis(en, custom), 'Custom synopsis');
|
||||
expect(localizedDramaSynopsis(zh, custom), 'Custom synopsis');
|
||||
});
|
||||
|
||||
test('the raw catalog text is ignored for a seeded drama', () {
|
||||
final signal = _drama(
|
||||
id: 'the-signal-demo',
|
||||
title: 'stale title',
|
||||
synopsis: 'stale synopsis',
|
||||
);
|
||||
|
||||
expect(localizedDramaTitle(en, signal), isNot('stale title'));
|
||||
expect(localizedDramaSynopsis(en, signal), isNot('stale synopsis'));
|
||||
});
|
||||
|
||||
test('episodes one to four use named titles', () {
|
||||
expect(localizedEpisodeTitle(en, 1), en.episodeOneTitle);
|
||||
expect(localizedEpisodeTitle(en, 2), en.episodeTwoTitle);
|
||||
expect(localizedEpisodeTitle(en, 3), en.episodeThreeTitle);
|
||||
expect(localizedEpisodeTitle(en, 4), en.episodeFourTitle);
|
||||
});
|
||||
|
||||
test('later episodes fall back to a numbered label', () {
|
||||
for (final number in <int>[5, 12, 100]) {
|
||||
expect(localizedEpisodeTitle(en, number), en.episodeLabel(number));
|
||||
expect(localizedEpisodeTitle(en, number), contains('$number'));
|
||||
}
|
||||
expect(localizedEpisodeTitle(zh, 12), zh.episodeLabel(12));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user