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,43 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
@main
|
||||
struct FileDropPolicyTests {
|
||||
static func main() throws {
|
||||
let files = FileManager.default
|
||||
let root = files.temporaryDirectory.appendingPathComponent(UUID().uuidString)
|
||||
try files.createDirectory(at: root, withIntermediateDirectories: true)
|
||||
defer { try? files.removeItem(at: root) }
|
||||
let file = root.appendingPathComponent("input.WAV")
|
||||
try Data([0]).write(to: file)
|
||||
let directory = root.appendingPathComponent("directory.wav")
|
||||
try files.createDirectory(at: directory, withIntermediateDirectories: true)
|
||||
let missing = root.appendingPathComponent("missing.wav")
|
||||
let unrestricted = NativeFileDropPolicy(arguments: [
|
||||
"allowedExtensions": NSNull(), "maximumFileCount": NSNull()
|
||||
])!
|
||||
let audio = NativeFileDropPolicy(arguments: [
|
||||
"allowedExtensions": ["wav"], "maximumFileCount": 1
|
||||
])!
|
||||
var failures = 0
|
||||
func check(_ condition: Bool, _ label: String) {
|
||||
if !condition {
|
||||
failures += 1
|
||||
fputs("FAIL: \(label)\n", stderr)
|
||||
}
|
||||
}
|
||||
check(audio.accepts([file]), "existing file with uppercase extension")
|
||||
check(unrestricted.accepts([file]), "existing file without extension restrictions")
|
||||
check(!audio.accepts([directory]), "directory with a permitted extension")
|
||||
check(!unrestricted.accepts([directory]), "directory without extension restrictions")
|
||||
check(!audio.accepts([missing]), "missing file with a permitted extension")
|
||||
check(!unrestricted.accepts([missing]), "missing file without extension restrictions")
|
||||
check(!audio.accepts([file, file]), "file count limit")
|
||||
check(!audio.accepts([]), "empty input")
|
||||
check(!unrestricted.accepts([URL(string: "https://example.com/input.wav")!]), "non-file URL")
|
||||
try files.removeItem(at: file)
|
||||
check(!audio.accepts([file]), "file deleted after entering the drop destination")
|
||||
if failures > 0 { exit(1) }
|
||||
print("Native file drop policy passed")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
|
||||
// The harness exercises a window without initializing plugins or showing it.
|
||||
final class HiddenTestWindow: CutdexNativeWindow {
|
||||
var emptyDrags = 0
|
||||
override var isKeyWindow: Bool { true }
|
||||
override func performDrag(with event: NSEvent) {
|
||||
if isMovable {
|
||||
emptyDrags += 1
|
||||
return // Observe the explicit native drag entry without a blocking tracking loop.
|
||||
}
|
||||
super.performDrag(with: event)
|
||||
}
|
||||
override func makeKeyAndOrderFront(_ sender: Any?) {}
|
||||
}
|
||||
|
||||
final class BubblingControlView: NSView {
|
||||
var downs = 0
|
||||
var drags = 0
|
||||
var ups = 0
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
downs += 1
|
||||
precondition(window?.isMovable == false)
|
||||
// Exercise responder fallback and direct native actions during the gesture.
|
||||
window?.mouseDown(with: event)
|
||||
window?.performZoom(nil)
|
||||
window?.zoom(nil)
|
||||
window?.performDrag(with: event)
|
||||
}
|
||||
override func mouseDragged(with event: NSEvent) {
|
||||
drags += 1
|
||||
precondition(window?.isMovable == false)
|
||||
window?.mouseDragged(with: event)
|
||||
window?.performDrag(with: event)
|
||||
}
|
||||
override func mouseUp(with event: NSEvent) {
|
||||
ups += 1
|
||||
precondition(window?.isMovable == false)
|
||||
window?.mouseUp(with: event)
|
||||
}
|
||||
}
|
||||
|
||||
@main
|
||||
struct HeaderGestureTest {
|
||||
static func main() {
|
||||
_ = NSApplication.shared
|
||||
let window = HiddenTestWindow(contentRect: NSRect(x: 100, y: 100, width: 640, height: 480),
|
||||
styleMask: [.titled, .closable, .miniaturizable, .resizable], backing: .buffered, defer: false)
|
||||
let control = BubblingControlView(frame: NSRect(x: 0, y: 0, width: 640, height: 480))
|
||||
let controller = NSViewController()
|
||||
controller.view = control
|
||||
window.contentViewController = controller
|
||||
window.isMovable = true
|
||||
window.isMovableByWindowBackground = true
|
||||
window.configureChrome(true)
|
||||
window.headerControlRegions["control"] = NSRect(x: 88, y: 0, width: 140, height: 40)
|
||||
precondition(!window.isMovable && !window.isMovableByWindowBackground)
|
||||
let original = window.frame
|
||||
func event(_ type: NSEvent.EventType, x: CGFloat, top: CGFloat, clicks: Int = 1) -> NSEvent {
|
||||
let view = window.contentView!
|
||||
let p = NSPoint(x: x, y: view.isFlipped ? top : view.bounds.height - top)
|
||||
return NSEvent.mouseEvent(with: type, location: view.convert(p, to: nil),
|
||||
modifierFlags: [], timestamp: ProcessInfo.processInfo.systemUptime,
|
||||
windowNumber: window.windowNumber, context: nil, eventNumber: 0,
|
||||
clickCount: clicks, pressure: 1)!
|
||||
}
|
||||
window.sendEvent(event(.leftMouseDown, x: 110, top: 20))
|
||||
// A route change caused by the press must not release native protection.
|
||||
window.configureChrome(true)
|
||||
window.sendEvent(event(.leftMouseDragged, x: 400, top: 150))
|
||||
window.sendEvent(event(.leftMouseUp, x: 400, top: 150))
|
||||
precondition(!window.isMovable)
|
||||
precondition(window.frame == original)
|
||||
window.sendEvent(event(.leftMouseDown, x: 110, top: 20, clicks: 2))
|
||||
window.sendEvent(event(.leftMouseUp, x: 110, top: 20, clicks: 2))
|
||||
precondition(!window.isMovable)
|
||||
precondition(window.frame == original)
|
||||
precondition(control.downs == 2 && control.drags == 1 && control.ups == 2)
|
||||
precondition(window.emptyDrags == 0)
|
||||
window.sendEvent(event(.leftMouseDown, x: 400, top: 20))
|
||||
precondition(window.emptyDrags == 1)
|
||||
precondition(!window.isMovable)
|
||||
window.configureChrome(false)
|
||||
precondition(window.isMovable && window.isMovableByWindowBackground)
|
||||
print("Native header control gestures passed")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -eq 1 ] && { [ "$1" = "--help" ] || [ "$1" = "-h" ]; }; then
|
||||
echo "Usage: $0 [flutter-framework-directory]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 1 ]; then
|
||||
echo "Usage: $0 [flutter-framework-directory]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
task_root=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
task_workspace_root=$(cd "$task_root/../.." && pwd)
|
||||
task_framework_dir=${1:-"$task_workspace_root/build/macos/Build/Products/Debug-development"}
|
||||
task_test_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$task_test_dir"' EXIT HUP INT TERM
|
||||
|
||||
xcrun swiftc -F "$task_framework_dir" -framework FlutterMacOS -framework Cocoa \
|
||||
-Xlinker -rpath -Xlinker "$task_framework_dir" \
|
||||
"$task_root/macos/cutdex_native/Sources/cutdex_native/NativeBridges.swift" \
|
||||
"$task_root/tool/macos/file_drop_policy_test.swift" \
|
||||
-o "$task_test_dir/file-drop-policy"
|
||||
"$task_test_dir/file-drop-policy"
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -eq 1 ] && { [ "$1" = "--help" ] || [ "$1" = "-h" ]; }; then
|
||||
echo "Usage: $0 [flutter-framework-directory]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 1 ]; then
|
||||
echo "Usage: $0 [flutter-framework-directory]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
task_root=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
task_workspace_root=$(cd "$task_root/../.." && pwd)
|
||||
task_framework_dir=${1:-"$task_workspace_root/build/macos/Build/Products/Debug-development"}
|
||||
task_test_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$task_test_dir"' EXIT HUP INT TERM
|
||||
|
||||
xcrun swiftc -F "$task_framework_dir" -framework FlutterMacOS -framework Cocoa \
|
||||
-Xlinker -rpath -Xlinker "$task_framework_dir" \
|
||||
"$task_root/macos/cutdex_native/Sources/cutdex_native/CutdexNativeWindow.swift" \
|
||||
"$task_root/tool/macos/header_control_gestures_test.swift" \
|
||||
-o "$task_test_dir/header-gestures"
|
||||
"$task_test_dir/header-gestures"
|
||||
Reference in new issue
Block a user