- Introduced a new Flutter project for the cxyz Android manga/comic reader, including essential files such as pubspec.yaml, AndroidManifest.xml, and Gradle configuration. - Added .gitignore files to exclude unnecessary files and directories for both the main project and Android-specific files. - Implemented initial README.md with project description, features, setup instructions, and API details for ComicLand, MangaRead, and MangaTown. - Configured analysis options and dependencies in pubspec.yaml to support Flutter development. - Established a pnpm workspace and lockfile for dependency management. - Included various Android resources such as icons, styles, and launch backgrounds for a complete application setup.
105 lines
2.7 KiB
Dart
105 lines
2.7 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:cxyz_android/services/reader_direction.dart';
|
|
import 'package:cxyz_android/services/source_reader_defaults.dart';
|
|
|
|
void main() {
|
|
group('SourceReaderDefaults.modeFor', () {
|
|
test('comicland is webtoon', () {
|
|
expect(SourceReaderDefaults.modeFor('comicland'), ReaderMode.webtoon);
|
|
});
|
|
|
|
test('mangaread and mangatown are paged', () {
|
|
expect(SourceReaderDefaults.modeFor('mangaread'), ReaderMode.paged);
|
|
expect(SourceReaderDefaults.modeFor('mangatown'), ReaderMode.paged);
|
|
});
|
|
});
|
|
|
|
group('SourceReaderDefaults.directionFor', () {
|
|
test('mangaread and mangatown are rtl', () {
|
|
expect(
|
|
SourceReaderDefaults.directionFor('mangaread'),
|
|
ReadingDirection.rtl,
|
|
);
|
|
expect(
|
|
SourceReaderDefaults.directionFor('mangatown'),
|
|
ReadingDirection.rtl,
|
|
);
|
|
});
|
|
|
|
test('comicland has no built-in direction', () {
|
|
expect(SourceReaderDefaults.directionFor('comicland'), isNull);
|
|
});
|
|
});
|
|
|
|
group('SourceReaderDefaults.resolveMode', () {
|
|
test('stored override wins', () {
|
|
expect(
|
|
SourceReaderDefaults.resolveMode('mangatown', 'webtoon'),
|
|
ReaderMode.webtoon,
|
|
);
|
|
expect(
|
|
SourceReaderDefaults.resolveMode('comicland', 'paged'),
|
|
ReaderMode.paged,
|
|
);
|
|
});
|
|
|
|
test('empty / unknown falls back to source default', () {
|
|
expect(
|
|
SourceReaderDefaults.resolveMode('mangatown', ''),
|
|
ReaderMode.paged,
|
|
);
|
|
expect(
|
|
SourceReaderDefaults.resolveMode('mangatown', null),
|
|
ReaderMode.paged,
|
|
);
|
|
expect(
|
|
SourceReaderDefaults.resolveMode('comicland', ''),
|
|
ReaderMode.webtoon,
|
|
);
|
|
});
|
|
});
|
|
|
|
group('SourceReaderDefaults.resolveDirection', () {
|
|
test('stored override wins', () {
|
|
expect(
|
|
SourceReaderDefaults.resolveDirection(
|
|
'mangatown',
|
|
'ltr',
|
|
globalFallback: ReadingDirection.rtl,
|
|
),
|
|
ReadingDirection.ltr,
|
|
);
|
|
});
|
|
|
|
test('source default when unset', () {
|
|
expect(
|
|
SourceReaderDefaults.resolveDirection(
|
|
'mangaread',
|
|
null,
|
|
globalFallback: ReadingDirection.ltr,
|
|
),
|
|
ReadingDirection.rtl,
|
|
);
|
|
});
|
|
|
|
test('global fallback for comicland when unset', () {
|
|
expect(
|
|
SourceReaderDefaults.resolveDirection(
|
|
'comicland',
|
|
null,
|
|
globalFallback: ReadingDirection.rtl,
|
|
),
|
|
ReadingDirection.rtl,
|
|
);
|
|
expect(
|
|
SourceReaderDefaults.resolveDirection(
|
|
'comicland',
|
|
'',
|
|
globalFallback: ReadingDirection.ltr,
|
|
),
|
|
ReadingDirection.ltr,
|
|
);
|
|
});
|
|
});
|
|
}
|