fix: play playlist entries on single click
This commit is contained in:
@@ -48,7 +48,7 @@ def check_queue_drag(root, app, fixtures):
|
||||
if result.returncode != 0 or not report.get("passed"):
|
||||
log = diagnostics.read_text(errors="replace") if diagnostics.exists() else ""
|
||||
raise RuntimeError(f"native queue drag failed: {report}; {result.stdout}{result.stderr}{log}")
|
||||
print("PASS native queue drag: slide down/up, hold without pointer events, release to nearest slot, current item preserved")
|
||||
print("PASS native queue: drag down/up without changing playback, release to nearest slot, single click plays without reordering")
|
||||
|
||||
|
||||
def check_window_layout(root, app, fixtures):
|
||||
|
||||
@@ -35,6 +35,7 @@ private enum QueueDragCheck {
|
||||
|
||||
static func run(result: URL) {
|
||||
resultURL = result
|
||||
_ = NSApplication.shared
|
||||
_ = NSEvent.addLocalMonitorForEvents(matching: [.leftMouseDown, .leftMouseDragged, .leftMouseUp]) {
|
||||
NSLog("[DEBUG-queue-drag] received %@", String(describing: $0))
|
||||
return $0
|
||||
@@ -42,6 +43,8 @@ private enum QueueDragCheck {
|
||||
timer = Timer.scheduledTimer(withTimeInterval: 0.05, repeats: true) { _ in
|
||||
MainActor.assumeIsolated { advance() }
|
||||
}
|
||||
// Keep injecting mouse events while SwiftUI tracks a pressed row.
|
||||
RunLoop.main.add(timer!, forMode: .common)
|
||||
terebiAppMain()
|
||||
}
|
||||
|
||||
@@ -68,13 +71,17 @@ private enum QueueDragCheck {
|
||||
|
||||
static func advance() {
|
||||
let model = PlayerModel.shared
|
||||
guard ContinuousClock.now < deadline else { finish("Queue drag did not complete at step \(step)"); return }
|
||||
guard ContinuousClock.now < deadline else {
|
||||
finish("Queue interaction did not complete at step \(step): status \(model.state.status), media \(model.fileName ?? "none"), windows \(NSApp.windows.count)")
|
||||
return
|
||||
}
|
||||
guard model.canTogglePlayback,
|
||||
let window = NSApp.windows.first(where: { $0.canBecomeMain && !($0 is NSPanel) }),
|
||||
let content = window.contentView else { return }
|
||||
if step == 0 {
|
||||
model.setVolume(0)
|
||||
model.addToQueue(["B", "C"].map { URL(fileURLWithPath: "/queue-drag-check/\($0).mp4") })
|
||||
let fixtures = model.queue.currentURL!.deletingLastPathComponent()
|
||||
model.addToQueue(["av.mp4", "cache.mp4"].map { fixtures.appendingPathComponent($0) })
|
||||
current = model.queue.currentID
|
||||
original = model.queue.items.map(\.id)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
@@ -124,6 +131,16 @@ private enum QueueDragCheck {
|
||||
guard model.queue.items.map(\.id) == original, model.queue.currentID == current else {
|
||||
finish("Stationary upward release did not restore the original order"); return
|
||||
}
|
||||
let secondRow = NSPoint(x: start.x, y: start.y - 60)
|
||||
mouse(.leftMouseDown, at: secondRow, in: window)
|
||||
} else if step == 28 {
|
||||
mouse(.leftMouseUp, at: NSPoint(x: start.x, y: start.y - 60), in: window)
|
||||
} else if step == 35 {
|
||||
guard model.queue.currentID == original[1],
|
||||
model.queue.items.map(\.id) == original,
|
||||
model.state.status == PLAYER_PLAYING else {
|
||||
finish("Single click did not play the second row without reordering"); return
|
||||
}
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user