From 4154a730ee8b4512c436929bd881ba9be3bb9b5a Mon Sep 17 00:00:00 2001 From: Lars <134181853+bo2themax@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:13:56 +0100 Subject: [PATCH] Fix some edge cases --- macos/GhosttyUITests/GhosttyThemeTests.swift | 7 ++++--- macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/macos/GhosttyUITests/GhosttyThemeTests.swift b/macos/GhosttyUITests/GhosttyThemeTests.swift index a667d751d..d6f73d7f4 100644 --- a/macos/GhosttyUITests/GhosttyThemeTests.swift +++ b/macos/GhosttyUITests/GhosttyThemeTests.swift @@ -14,6 +14,7 @@ final class GhosttyThemeTests: GhosttyCustomConfigCase { _ appearance: XCUIDevice.Appearance, for app: XCUIApplication, title: String? = nil, + colorLocation: CGPoint? = nil, file: StaticString = #filePath, line: UInt = #line ) throws { @@ -21,7 +22,7 @@ final class GhosttyThemeTests: GhosttyCustomConfigCase { let titleView = app.windows.element(boundBy: i).staticTexts.element(matching: NSPredicate(format: "value == '\(title ?? windowTitle)'")) let image = titleView.screenshot().image - guard let imageColor = image.colorAt(x: 0, y: 0) else { + guard let imageColor = image.colorAt(x: Int(colorLocation?.x ?? 1), y: Int(colorLocation?.y ?? 1)) else { throw XCTSkip("failed to get pixel color", file: file, line: line) } @@ -150,9 +151,9 @@ final class GhosttyThemeTests: GhosttyCustomConfigCase { app.menuBarItems["View"].firstMatch.click() app.menuItems["Quick Terminal"].firstMatch.click() let title = "Debug builds of Ghostty are very slow and you may experience performance problems. Debug builds are only recommended during development." - try assertTitlebarAppearance(.light, for: app, title: title) + try assertTitlebarAppearance(.light, for: app, title: title, colorLocation: CGPoint(x: 5, y: 5)) // to avoid dark edge XCUIDevice.shared.appearance = .dark try await Task.sleep(for: .seconds(0.5)) - try assertTitlebarAppearance(.dark, for: app, title: title) + try assertTitlebarAppearance(.dark, for: app, title: title, colorLocation: CGPoint(x: 5, y: 5)) } } diff --git a/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift b/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift index 6c32875eb..bf8b6124e 100644 --- a/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift +++ b/macos/GhosttyUITests/GhosttyTitlebarTabsUITests.swift @@ -87,7 +87,7 @@ final class GhosttyTitlebarTabsUITests: GhosttyCustomConfigCase { // check tabs in the first checkTabsGeometry(app.windows.firstMatch) // focus another window - app.windows.element(boundBy: 1).click() + app.windows.element(boundBy: 1).tabs.firstMatch.click() checkTabsGeometry(app.windows.firstMatch) }