feat: initial Cutdex application
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.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,156 @@
|
||||
import '../test/support/creation_names.dart';
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
|
||||
import '../test/support/processing_fixture.dart';
|
||||
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/integrations/editor_tools.dart';
|
||||
import 'package:cutdex/persistence/app_database.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
for (final mask in [0, 1, 2, 4, 3, 5, 6, 7, -1]) {
|
||||
testWidgets('timeline native preview with optional capability mask $mask', (
|
||||
tester,
|
||||
) async {
|
||||
final root = await Directory.systemTemp.createTemp(
|
||||
'preview-capabilities-',
|
||||
);
|
||||
final config = await processingFixture(
|
||||
root,
|
||||
mask < 0 ? 7 : mask,
|
||||
stale: mask < 0,
|
||||
);
|
||||
final workspace = ProjectWorkspace(
|
||||
creationNames: testCreationNames,
|
||||
processing: config,
|
||||
);
|
||||
try {
|
||||
await workspace.open('${root.path}/Test.cutdex', name: 'Preview');
|
||||
final document = TimelineDocument(
|
||||
id: 'timeline',
|
||||
name: 'Preview',
|
||||
defaultSequenceId: SequenceId('main'),
|
||||
sequences: [
|
||||
TimelineDto(
|
||||
id: SequenceId('main'),
|
||||
format: TimelineFormat.fps30,
|
||||
primaryStorylineId: StorylineId('primary'),
|
||||
storylines: [
|
||||
StorylineDto(id: StorylineId('primary'), elementIds: []),
|
||||
],
|
||||
elements: [],
|
||||
),
|
||||
],
|
||||
);
|
||||
await workspace.project!.saveTimeline(document);
|
||||
final timeline = await workspace.openTimelineSession(
|
||||
workspace.project!.info.id,
|
||||
await workspace.project!.loadTimeline(document.id),
|
||||
);
|
||||
final ids = (workspace.project!.info.id, document.id);
|
||||
final scoped = ProviderContainer(
|
||||
overrides: [
|
||||
editorTimelineProvider(
|
||||
ids.$1,
|
||||
ids.$2,
|
||||
).overrideWith((ref) async => timeline),
|
||||
],
|
||||
);
|
||||
try {
|
||||
final subscription = scoped.listen(
|
||||
editorPreviewProvider(ids.$1, ids.$2),
|
||||
(_, _) {},
|
||||
);
|
||||
final preview = await scoped.read(
|
||||
editorPreviewProvider(ids.$1, ids.$2).future,
|
||||
);
|
||||
expect(preview, isNotNull);
|
||||
expect(preview!.ready, isTrue);
|
||||
expect(preview.error, isNull);
|
||||
final enabled = mask < 0 ? 0 : mask;
|
||||
expect(
|
||||
timeline.supportedCommandOperations.contains(
|
||||
EditorOperation.startTranscription,
|
||||
),
|
||||
enabled & 1 != 0,
|
||||
);
|
||||
expect(
|
||||
timeline.supportedCommandOperations.contains(
|
||||
EditorOperation.startSubtitleTranslation,
|
||||
),
|
||||
enabled & 2 != 0,
|
||||
);
|
||||
expect(
|
||||
timeline.supportedCommandOperations.contains(
|
||||
EditorOperation.startVocalSeparation,
|
||||
),
|
||||
enabled & 4 != 0,
|
||||
);
|
||||
await preview.close();
|
||||
subscription.close();
|
||||
} finally {
|
||||
scoped.dispose();
|
||||
}
|
||||
} finally {
|
||||
await workspace.close();
|
||||
await root.delete(recursive: true);
|
||||
}
|
||||
});
|
||||
}
|
||||
testWidgets(
|
||||
'opening a timeline initializes native preview through App providers',
|
||||
(tester) async {
|
||||
final directory = await Directory.systemTemp.createTemp(
|
||||
'cutdex preview startup ',
|
||||
);
|
||||
final database = AppDatabase(NativeDatabase.memory());
|
||||
final container = ProviderContainer(
|
||||
overrides: [appDatabaseProvider.overrideWithValue(database)],
|
||||
);
|
||||
try {
|
||||
container.read(applicationToolAccessProvider);
|
||||
final projects = container.read(projectsProvider.notifier);
|
||||
expect(
|
||||
await projects.open('${directory.path}/Test.cutdex', name: 'Preview'),
|
||||
isTrue,
|
||||
);
|
||||
expect(await projects.createTimeline(name: 'Timeline'), isTrue);
|
||||
final state = await container.read(projectsProvider.future);
|
||||
final ids = (state.activeProject!.id, state.timeline!.id);
|
||||
final subscription = container.listen(
|
||||
editorPreviewProvider(ids.$1, ids.$2),
|
||||
(_, _) {},
|
||||
);
|
||||
final preview = await container.read(
|
||||
editorPreviewProvider(ids.$1, ids.$2).future,
|
||||
);
|
||||
expect(preview, isNull);
|
||||
final timeline = await container.read(
|
||||
editorTimelineProvider(ids.$1, ids.$2).future,
|
||||
);
|
||||
expect(timeline.preview, isNull);
|
||||
subscription.close();
|
||||
await timeline.close();
|
||||
} finally {
|
||||
container.dispose();
|
||||
await Future<void>.delayed(const Duration(milliseconds: 200));
|
||||
await database.close();
|
||||
await directory.delete(recursive: true);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user