feat: remember launcher position across restarts
This commit is contained in:
@@ -46,3 +46,19 @@ func launcherAlignmentKeepsFractionalDisplayCentersOnAStableWindowGrid() {
|
||||
let placed = CGRect(origin: alignment.snappedOrigin, size: window.size)
|
||||
#expect(LauncherAlignment(windowFrame: placed, visibleFrame: display).snappedOrigin == placed.origin)
|
||||
}
|
||||
|
||||
@Test
|
||||
func launcherPositionRestoresVisibleOriginsAndFallsBackForMissingOrOffscreenPositions() {
|
||||
let display = CGRect(x: -1920, y: 40, width: 1920, height: 1040)
|
||||
let size = CGSize(width: 750, height: 474)
|
||||
let origin = CGPoint(x: -1500, y: 450)
|
||||
#expect(LauncherAlignment.restoredFrame(savedOrigin: origin, windowSize: size, visibleFrame: display)
|
||||
== CGRect(origin: origin, size: size))
|
||||
for invalid: CGPoint? in [nil, CGPoint(x: 0, y: 450), CGPoint(x: -1500, y: 39), CGPoint(x: CGFloat.nan, y: 450)] {
|
||||
#expect(LauncherAlignment.restoredFrame(savedOrigin: invalid, windowSize: size, visibleFrame: display)
|
||||
== CGRect(x: -1335, y: 398, width: 750, height: 474))
|
||||
}
|
||||
let small = CGRect(x: 0, y: 40, width: 800, height: 500)
|
||||
#expect(LauncherAlignment.restoredFrame(savedOrigin: nil, windowSize: size, visibleFrame: small)
|
||||
== CGRect(x: 25, y: 40, width: 750, height: 474))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user