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.
58 lines
1.9 KiB
Dart
58 lines
1.9 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cutdex/workspace/persistence/project_location_directory.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
const service = ProjectLocationDirectory();
|
|
late Directory root;
|
|
setUp(() async {
|
|
root = await Directory.systemTemp.createTemp('cutdex-location-');
|
|
});
|
|
tearDown(() => root.delete(recursive: true));
|
|
|
|
test(
|
|
'inspection preserves a missing folder, preparation creates it',
|
|
() async {
|
|
final folder = Directory('${root.path}/deleted/projects');
|
|
expect(await service.inspect(folder.path), ProjectLocationStatus.missing);
|
|
expect(await folder.exists(), isFalse);
|
|
expect(await root.list().toList(), isEmpty);
|
|
await service.prepare(folder.path);
|
|
expect(await service.inspect(folder.path), ProjectLocationStatus.ready);
|
|
expect(await folder.list().toList(), isEmpty);
|
|
},
|
|
);
|
|
|
|
test('a file or broken symlink in the path is never replaced', () async {
|
|
final file = File('${root.path}/file');
|
|
await file.writeAsString('keep');
|
|
expect(
|
|
await service.inspect('${file.path}/projects'),
|
|
ProjectLocationStatus.unavailable,
|
|
);
|
|
await expectLater(
|
|
service.prepare('${file.path}/projects'),
|
|
throwsStateError,
|
|
);
|
|
expect(await file.readAsString(), 'keep');
|
|
if (!Platform.isWindows) {
|
|
final link = Link('${root.path}/link');
|
|
await link.create('${root.path}/missing');
|
|
expect(
|
|
await service.inspect('${link.path}/projects'),
|
|
ProjectLocationStatus.unavailable,
|
|
);
|
|
}
|
|
});
|
|
|
|
test('missing external mount paths are not recreated', () async {
|
|
if (Platform.isWindows) return;
|
|
final path =
|
|
'/Volumes/cutdex-offline-${DateTime.now().microsecondsSinceEpoch}/Projects';
|
|
expect(await service.inspect(path), ProjectLocationStatus.unavailable);
|
|
await expectLater(service.prepare(path), throwsStateError);
|
|
expect(await Directory(path).exists(), isFalse);
|
|
});
|
|
}
|