[verified] Publish ReelBox source under GPLv3
This commit is contained in:
commit
db2b505ca3
445 files changed
+105274
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import 'package:background_downloader/background_downloader.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:reelbox/data/models.dart';
|
||||
import 'package:reelbox/media/download_service.dart';
|
||||
import 'package:reelbox/state/app_state.dart';
|
||||
|
||||
void main() {
|
||||
test(
|
||||
'retry can replace an incompatible multipart task with a normal GET',
|
||||
() {
|
||||
final old = createDirectDownloadTask(
|
||||
id: 'old-multipart',
|
||||
title: const TitleRecord(
|
||||
id: 81,
|
||||
title: 'A local test film',
|
||||
type: 'serie',
|
||||
),
|
||||
source: const MediaSource(
|
||||
url: 'https://example.test/video.mp4',
|
||||
quality: '720p',
|
||||
),
|
||||
episode: const EpisodeRecord(id: 9, title: 'Episode 1'),
|
||||
preferences: AppSettings(
|
||||
wifiOnlyDownloads: true,
|
||||
downloadNotifications: false,
|
||||
),
|
||||
supportsParallel: true,
|
||||
);
|
||||
final entry = DownloadEntry.fromTask(old, taskStatus: TaskStatus.failed);
|
||||
final retry = createRetryDownloadTask(entry, id: 'retry-single');
|
||||
expect(retry, isNot(isA<ParallelDownloadTask>()));
|
||||
expect(retry.taskId, 'retry-single');
|
||||
expect(retry.url, old.url);
|
||||
expect(retry.metaData, old.metaData);
|
||||
expect(retry.requiresWiFi, isTrue);
|
||||
expect(retry.notificationConfig, isNull);
|
||||
expect(retry.retriesRemaining, old.retries);
|
||||
expect(retry.filename, isNot(old.filename));
|
||||
expect(DownloadEntry.fromTask(retry).episodeId, 9);
|
||||
expect(DownloadEntry.fromTask(retry).titleKind, 'serie');
|
||||
},
|
||||
);
|
||||
|
||||
test('default download works without server HEAD or byte-range support', () {
|
||||
final task = createDirectDownloadTask(
|
||||
id: 'ordinary-get',
|
||||
title: const TitleRecord(id: 81, title: 'A local test film'),
|
||||
source: const MediaSource(
|
||||
url: 'https://example.test/video.mp4',
|
||||
type: 'mp4',
|
||||
),
|
||||
preferences: AppSettings(),
|
||||
);
|
||||
// Multipart workers require both HEAD and range headers. A normal GET
|
||||
// download must be the safe default, not a server-dependent optimization.
|
||||
expect(task, isNot(isA<ParallelDownloadTask>()));
|
||||
expect(task.httpRequestMethod, 'GET');
|
||||
expect(task.requiresWiFi, isFalse);
|
||||
expect(task.updates, Updates.statusAndProgress);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user