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,116 @@
|
||||
import 'support/creation_names.dart';
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/workspace/media_file_extensions.dart';
|
||||
import 'package:cutdex/workspace/media_import.dart';
|
||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
const channel = MethodChannel('windows-import-test');
|
||||
late Directory root;
|
||||
late ProjectWorkspace workspace;
|
||||
late String projectId;
|
||||
final requests = <Map<String, dynamic>>[];
|
||||
var videoTracks = 1;
|
||||
var protected = false;
|
||||
var probeFails = false;
|
||||
|
||||
setUp(() async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.windows;
|
||||
requests.clear();
|
||||
videoTracks = 1;
|
||||
protected = false;
|
||||
probeFails = false;
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(channel, (call) async {
|
||||
expect(call.method, 'request');
|
||||
final request = jsonDecode(
|
||||
(call.arguments as Map)['request'] as String,
|
||||
) as Map<String, dynamic>;
|
||||
requests.add(request);
|
||||
expect(request['method'], 'probe');
|
||||
if (probeFails) throw PlatformException(code: 'unsupported');
|
||||
return jsonEncode({
|
||||
'value': {
|
||||
'duration': {'numerator': '2', 'denominator': 1},
|
||||
'videoTrackCount': videoTracks,
|
||||
'audioTrackCount': 0,
|
||||
'videoTrackIds': List.generate(videoTracks, (index) => index),
|
||||
'audioTrackIds': <int>[],
|
||||
'isProtected': protected,
|
||||
'audioTracks': <Object?>[],
|
||||
},
|
||||
});
|
||||
});
|
||||
root = await Directory.systemTemp.createTemp('cutdex-windows-import-');
|
||||
workspace = ProjectWorkspace(
|
||||
creationNames: testCreationNames,
|
||||
runtime: CutdexRuntime(channel: channel),
|
||||
);
|
||||
await workspace.open(p.join(root.path, 'Test.cutdex'), name: 'Import');
|
||||
projectId = workspace.project!.info.id;
|
||||
});
|
||||
tearDown(() async {
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
await workspace.close();
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(channel, null);
|
||||
await root.delete(recursive: true);
|
||||
});
|
||||
|
||||
test(
|
||||
'Windows ISO picker and import use backend capability, not file magic',
|
||||
() async {
|
||||
expect(selectableVideoFileExtensions, contains('iso'));
|
||||
final file = await File(p.join(root.path, '中文 空格.ISO'))
|
||||
.writeAsBytes(List.filled(64, 0));
|
||||
expect(mediaKindForPath(file.path), 'video');
|
||||
final result = await workspace.importExternalMedia(projectId, [
|
||||
ExternalMediaFile(path: file.path),
|
||||
]);
|
||||
expect(result.failures, isEmpty);
|
||||
expect(result.added, 1);
|
||||
expect(requests, hasLength(1));
|
||||
expect((requests.single['media'] as Map)['uri'], file.uri.toString());
|
||||
expect(await file.readAsBytes(), List.filled(64, 0));
|
||||
expect(
|
||||
await Directory(p.join(workspace.project!.directory.path, 'media'))
|
||||
.exists(),
|
||||
false,
|
||||
);
|
||||
},
|
||||
skip: !Platform.isWindows,
|
||||
);
|
||||
|
||||
for (final reason in ['no video', 'protected', 'probe failure']) {
|
||||
test('unreadable ISO is rejected: $reason', () async {
|
||||
videoTracks = reason == 'no video' ? 0 : 1;
|
||||
protected = reason == 'protected';
|
||||
probeFails = reason == 'probe failure';
|
||||
final file = await File(p.join(root.path, 'disk.iso')).writeAsBytes([0]);
|
||||
final result = await workspace.importExternalMedia(projectId, [
|
||||
ExternalMediaFile(path: file.path),
|
||||
]);
|
||||
expect(result.added, 0);
|
||||
expect(result.failures, hasLength(1));
|
||||
expect(await workspace.project!.listAssets(), isEmpty);
|
||||
}, skip: !Platform.isWindows);
|
||||
}
|
||||
|
||||
test('ordinary imports retain lazy probing', () async {
|
||||
final file = await File(p.join(root.path, 'video.mp4')).writeAsBytes([0]);
|
||||
final result = await workspace.importExternalMedia(projectId, [
|
||||
ExternalMediaFile(path: file.path),
|
||||
]);
|
||||
expect(result.added, 1);
|
||||
expect(requests, isEmpty);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user