Fix some edge cases

This commit is contained in:
Lars
2025-10-28 10:13:56 +01:00
committed by Mitchell Hashimoto
parent 27729bf8a7
commit 4154a730ee
2 changed files with 5 additions and 4 deletions

View File

@@ -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))
}
}

View File

@@ -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)
}