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,87 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
const channel = MethodChannel('cutdex_native/fullscreen');
|
||||
final messenger =
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger;
|
||||
final requests = <bool>[];
|
||||
setUp(() {
|
||||
requests.clear();
|
||||
messenger.setMockMethodCallHandler(channel, (call) async {
|
||||
requests.add(call.arguments as bool);
|
||||
return null;
|
||||
});
|
||||
});
|
||||
tearDown(() => messenger.setMockMethodCallHandler(channel, null));
|
||||
|
||||
testWidgets('a disposed session cannot reclaim the window', (tester) async {
|
||||
final first = NativeFullscreenSession(onExit: () {});
|
||||
var exits = 0;
|
||||
final second = NativeFullscreenSession(onExit: () => exits++);
|
||||
first.attach();
|
||||
first.dispose();
|
||||
second.attach();
|
||||
expect(first.attach, throwsStateError);
|
||||
await first.setFullscreen(false);
|
||||
await messenger.handlePlatformMessage(
|
||||
channel.name,
|
||||
const StandardMethodCodec().encodeMethodCall(const MethodCall('exited')),
|
||||
(_) {},
|
||||
);
|
||||
expect(exits, 1);
|
||||
expect(requests, isEmpty);
|
||||
second.dispose();
|
||||
});
|
||||
|
||||
testWidgets('a replacement takes ownership while an entry is pending', (
|
||||
tester,
|
||||
) async {
|
||||
final entered = Completer<void>();
|
||||
messenger.setMockMethodCallHandler(channel, (call) async {
|
||||
requests.add(call.arguments as bool);
|
||||
if (requests.length == 1) await entered.future;
|
||||
return null;
|
||||
});
|
||||
final first = NativeFullscreenSession(onExit: () {});
|
||||
final second = NativeFullscreenSession(onExit: () {});
|
||||
first.attach();
|
||||
final entering = first.setFullscreen(true);
|
||||
await tester.pump();
|
||||
second.attach();
|
||||
final replacement = second.setFullscreen(true);
|
||||
first.dispose(exitFullscreen: true);
|
||||
await tester.pump();
|
||||
expect(requests, [true]);
|
||||
entered.complete();
|
||||
await tester.pump();
|
||||
await Future.wait([entering, replacement]);
|
||||
expect(requests, [true, true]);
|
||||
second.dispose(exitFullscreen: true);
|
||||
await tester.pump();
|
||||
expect(requests, [true, true, false]);
|
||||
});
|
||||
|
||||
testWidgets('a failed transition does not block the next request', (
|
||||
tester,
|
||||
) async {
|
||||
messenger.setMockMethodCallHandler(channel, (call) async {
|
||||
requests.add(call.arguments as bool);
|
||||
if (call.arguments == true) throw PlatformException(code: 'failed');
|
||||
return null;
|
||||
});
|
||||
final session = NativeFullscreenSession(onExit: () {});
|
||||
session.attach();
|
||||
await expectLater(
|
||||
session.setFullscreen(true),
|
||||
throwsA(isA<PlatformException>()),
|
||||
);
|
||||
await session.setFullscreen(false);
|
||||
expect(requests, [true, false]);
|
||||
session.dispose();
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user