Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cutdex/workspace/media_availability.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test(
|
|
'detects missing originals and restoration independently of preview caches',
|
|
() async {
|
|
final directory = await Directory.systemTemp.createTemp(
|
|
'cutdex-availability-',
|
|
);
|
|
addTearDown(() => directory.delete(recursive: true));
|
|
final file = File('${directory.path}/source.mp4');
|
|
expect(await checkMediaAvailability(file.uri), MediaAvailability.missing);
|
|
await file.writeAsBytes([1, 2, 3]);
|
|
// A readable file is available even when it is not a decodable video.
|
|
expect(
|
|
await checkMediaAvailability(file.uri),
|
|
MediaAvailability.available,
|
|
);
|
|
await file.delete();
|
|
expect(await checkMediaAvailability(file.uri), MediaAvailability.missing);
|
|
await file.writeAsBytes([4]);
|
|
expect(
|
|
await checkMediaAvailability(file.uri),
|
|
MediaAvailability.available,
|
|
);
|
|
},
|
|
);
|
|
|
|
test(
|
|
'unsupported locations are unavailable rather than reported missing',
|
|
() async {
|
|
expect(
|
|
await checkMediaAvailability(
|
|
Uri.parse('https://example.com/video.mp4'),
|
|
),
|
|
MediaAvailability.inaccessible,
|
|
);
|
|
},
|
|
);
|
|
}
|