fix: preserve video aspect ratio while resizing queue window
This commit is contained in:
@@ -326,6 +326,23 @@ struct SystemPlaybackChecks {
|
||||
model.setPointerInsideWindow(true)
|
||||
}
|
||||
until("open starts authoritative playback") { model.canTogglePlayback && model.state.status == PLAYER_PLAYING }
|
||||
model.showsQueue = true
|
||||
for delta in [NSSize(width: 160, height: 0), NSSize(width: 0, height: 90),
|
||||
NSSize(width: -100, height: 0), NSSize(width: 0, height: -60)] {
|
||||
let proposal = NSSize(width: window.frame.width + delta.width, height: window.frame.height + delta.height)
|
||||
guard let constrained = window.delegate?.windowWillResize?(window, to: proposal) else {
|
||||
fatalError("FAIL: native resize delegate must constrain queue video geometry")
|
||||
}
|
||||
var frame = window.frame
|
||||
frame.size = constrained
|
||||
window.setFrame(frame, display: true)
|
||||
let content = window.contentRect(forFrameRect: window.frame)
|
||||
require(abs((content.width - 260) / content.height - model.state.video_aspect_ratio) < 0.001,
|
||||
"horizontal and vertical queue resizing preserves video aspect with fixed sidebar width")
|
||||
require(delta.width == 0 ? abs(frame.height - proposal.height) < 1 : abs(frame.width - proposal.width) < 1,
|
||||
"aspect-locked queue window follows the dragged axis")
|
||||
}
|
||||
model.showsQueue = false
|
||||
require(center.playbackState == .playing, "playing publishes macOS playback ownership")
|
||||
requirePlaybackPower(system: true, display: true, "local video keeps the Mac and display awake")
|
||||
var bufferingState = model.state
|
||||
|
||||
Reference in New Issue
Block a user