From c399812036a3161a7c2cf3b7dc63f4240949c607 Mon Sep 17 00:00:00 2001 From: Lukas <134181853+bo2themax@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:17:18 +0100 Subject: [PATCH] macOS: add test case for positioning the very first window --- macos/GhosttyUITests/GhosttyWindowPositionUITests.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macos/GhosttyUITests/GhosttyWindowPositionUITests.swift b/macos/GhosttyUITests/GhosttyWindowPositionUITests.swift index 53a0d800a..44918c8b1 100644 --- a/macos/GhosttyUITests/GhosttyWindowPositionUITests.swift +++ b/macos/GhosttyUITests/GhosttyWindowPositionUITests.swift @@ -128,12 +128,19 @@ final class GhosttyWindowPositionUITests: GhosttyCustomConfigCase { ) let app = try ghosttyApplication() + // Suppress Restoration + app.launchArguments += ["-NSQuitAlwaysKeepsWindows", "NO"] + // Clean run + app.launchEnvironment["GHOSTTY_CLEAR_USER_DEFAULTS"] = "YES" app.launch() let window = app.windows.firstMatch XCTAssertTrue(window.waitForExistence(timeout: 5), "Window should appear") let firstFrame = window.frame + let screenFrame = NSScreen.main?.frame ?? .zero + + XCTAssertEqual(firstFrame.midX, screenFrame.midX, accuracy: 5.0, "First window should be centered horizontally") // Close the window and open a new one — it should restore the same frame. app.typeKey("w", modifierFlags: [.command])