File system cleanup

This commit is contained in:
2026-03-13 21:26:06 +11:00
parent 8ecb7d4382
commit cf3dba8fe4
83 changed files with 231 additions and 3 deletions

View File

@@ -0,0 +1,32 @@
import XCTest
@testable import CommandNotch
final class WindowFrameCalculatorTests: XCTestCase {
func testClosedStateCentersWindowOnScreen() {
let frame = WindowFrameCalculator.targetFrame(
screenFrame: CGRect(x: 100, y: 50, width: 1600, height: 900),
currentWindowFrame: CGRect(x: 300, y: 0, width: 0, height: 0),
notchState: .closed,
contentSize: CGSize(width: 800, height: 300),
centerHorizontally: false
)
XCTAssertEqual(frame.origin.x, 480, accuracy: 0.001)
XCTAssertEqual(frame.origin.y, 630, accuracy: 0.001)
XCTAssertEqual(frame.size.width, 840, accuracy: 0.001)
XCTAssertEqual(frame.size.height, 320, accuracy: 0.001)
}
func testOpenStateClampsDraggedFrameWithinScreenBounds() {
let frame = WindowFrameCalculator.targetFrame(
screenFrame: CGRect(x: 0, y: 0, width: 1440, height: 900),
currentWindowFrame: CGRect(x: 1200, y: 0, width: 0, height: 0),
notchState: .open,
contentSize: CGSize(width: 900, height: 320),
centerHorizontally: false
)
XCTAssertEqual(frame.origin.x, 500, accuracy: 0.001)
XCTAssertEqual(frame.origin.y, 560, accuracy: 0.001)
}
}