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,103 @@
|
||||
import 'package:cutdex/integrations/platform/file_picker.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:cutdex/workspace/media_import.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
const picker = AppFilePicker();
|
||||
const channel = MethodChannel('filegate');
|
||||
Object? response;
|
||||
MethodCall? lastCall;
|
||||
|
||||
setUp(() {
|
||||
response = null;
|
||||
lastCall = null;
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(channel, (call) async {
|
||||
lastCall = call;
|
||||
return response;
|
||||
});
|
||||
});
|
||||
tearDown(() {
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(channel, null);
|
||||
});
|
||||
|
||||
test(
|
||||
'selects an empty directory and preserves the initial location and label',
|
||||
() async {
|
||||
response = [
|
||||
{'path': '/tmp/empty', 'name': 'empty', 'kind': 'directory'},
|
||||
];
|
||||
expect(
|
||||
await picker.pickDirectory(
|
||||
initialDirectory: '/tmp',
|
||||
confirmButtonText: '选择',
|
||||
),
|
||||
'/tmp/empty',
|
||||
);
|
||||
expect(lastCall!.arguments, containsPair('enumerateDirectories', false));
|
||||
expect(lastCall!.arguments, containsPair('initialDirectory', '/tmp'));
|
||||
expect(lastCall!.arguments, containsPair('confirmButtonText', '选择'));
|
||||
},
|
||||
);
|
||||
|
||||
test('cancelled directory and file dialogs produce no selection', () async {
|
||||
expect(await picker.pickDirectory(), isNull);
|
||||
expect(await picker.pickFiles(allowedExtensions: ['mp4']), isEmpty);
|
||||
});
|
||||
|
||||
test(
|
||||
'converts file URLs to local paths while retaining extension filtering',
|
||||
() async {
|
||||
response = [
|
||||
{'path': 'file:///tmp/a%20b.mp4', 'name': 'a b.mp4', 'kind': 'file'},
|
||||
{'path': '/tmp/c.wav', 'name': 'c.wav', 'kind': 'file'},
|
||||
];
|
||||
expect(await picker.pickFiles(allowedExtensions: ['.MP4', 'wav']), [
|
||||
const ExternalMediaFile(path: '/tmp/a b.mp4'),
|
||||
const ExternalMediaFile(path: '/tmp/c.wav'),
|
||||
]);
|
||||
expect(lastCall!.arguments, containsPair('allowMultiple', true));
|
||||
expect(
|
||||
lastCall!.arguments,
|
||||
containsPair('allowedExtensions', ['mp4', 'wav']),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'preserves provider URI, display name and size for project import',
|
||||
() async {
|
||||
response = [
|
||||
{
|
||||
'path': 'content://provider/file/1',
|
||||
'name': 'a.mp4',
|
||||
'kind': 'file',
|
||||
'metadata': {'size': 42},
|
||||
},
|
||||
];
|
||||
expect(await picker.pickFiles(allowedExtensions: ['mp4']), [
|
||||
ExternalMediaFile.content(
|
||||
uri: Uri.parse('content://provider/file/1'),
|
||||
name: 'a.mp4',
|
||||
byteLength: 42,
|
||||
),
|
||||
]);
|
||||
expect(lastCall!.arguments, containsPair('persistAccess', false));
|
||||
},
|
||||
);
|
||||
|
||||
test('propagates native picker failures', () async {
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
channel,
|
||||
(_) async => throw PlatformException(code: 'picker_active'),
|
||||
);
|
||||
await expectLater(
|
||||
picker.pickDirectory(),
|
||||
throwsA(isA<PlatformException>()),
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user