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.
51 lines
1.8 KiB
Dart
51 lines
1.8 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cutdex/persistence/app_database.dart';
|
|
import 'package:cutdex/workspace/persistence/project_locator.dart';
|
|
import 'package:cutdex/workspace/persistence/recent_projects.dart';
|
|
import 'package:cutdex/workspace/project_state.dart';
|
|
import 'package:drift/native.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('locator reports a real directory as available', () async {
|
|
final root = await Directory.systemTemp.createTemp('cutdex-locator-');
|
|
addTearDown(() => root.delete(recursive: true));
|
|
final location = await ProjectLocator().locate(
|
|
RecentProject(id: 'id', name: 'Demo', path: root.path),
|
|
);
|
|
expect(location.availability, ProjectAvailability.available);
|
|
expect(location.project.path, root.path);
|
|
});
|
|
|
|
test('locator keeps a missing project record disabled', () async {
|
|
final location = await ProjectLocator().locate(
|
|
const RecentProject(
|
|
id: 'id',
|
|
name: 'Demo',
|
|
path: '/definitely-missing/Demo.cutdex',
|
|
),
|
|
);
|
|
expect(location.availability, ProjectAvailability.missing);
|
|
expect(location.project.availability, ProjectAvailability.missing);
|
|
});
|
|
|
|
test(
|
|
'recent project storage preserves paths, order and last timelines',
|
|
() async {
|
|
final database = AppDatabase(NativeDatabase.memory());
|
|
addTearDown(database.close);
|
|
final repository = DriftRecentProjectsRepository(database);
|
|
const record = RecentProject(
|
|
id: 'id',
|
|
name: 'Demo',
|
|
path: '/Demo.cutdex',
|
|
);
|
|
await repository.save([record]);
|
|
await repository.rememberTimeline(record.id, 'timeline');
|
|
expect(await repository.load(), [record]);
|
|
expect(await repository.lastTimeline(record.id), 'timeline');
|
|
},
|
|
);
|
|
}
|