Skip to content

Commit

Permalink
Fix .text changes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Dec 27, 2024
1 parent 840334f commit 283e9f4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Tests/ThemeParkTests/BBEditThemeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class BBEditThemeTests: XCTestCase {
PlatformColor(red: 0.077525, green: 0.077522, blue: 0.077524, alpha: 1.000000).toHex()
)
XCTAssertEqual(
theme.style(for: Query(key: .syntax(.text), context: .init(colorScheme: .light))).color.toHex(),
theme.style(for: Query(key: .syntax(.text(nil)), context: .init(colorScheme: .light))).color.toHex(),
PlatformColor(hue: 0.0, saturation: 0.0, brightness: 0.68, alpha: 1.0).toHex()
)
}
Expand Down
12 changes: 6 additions & 6 deletions Tests/ThemeParkTests/CodableStylerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ final class CodableStylerTests: XCTestCase {
)

XCTAssertEqual(
mock.style(for: .syntax(.text), context: context),
theme.style(for: .syntax(.text), context: context)
mock.style(for: .syntax(.text(nil)), context: context),
theme.style(for: .syntax(.text(nil)), context: context)
)
}

Expand All @@ -44,8 +44,8 @@ final class CodableStylerTests: XCTestCase {
)

XCTAssertEqual(
mock.style(for: .syntax(.text), context: context),
theme.style(for: .syntax(.text), context: context)
mock.style(for: .syntax(.text(nil)), context: context),
theme.style(for: .syntax(.text(nil)), context: context)
)
}

Expand All @@ -64,8 +64,8 @@ final class CodableStylerTests: XCTestCase {
)

XCTAssertEqual(
mock.style(for: .syntax(.text), context: context),
decodedTheme.style(for: .syntax(.text), context: context)
mock.style(for: .syntax(.text(nil)), context: context),
decodedTheme.style(for: .syntax(.text(nil)), context: context)
)
}
}
2 changes: 1 addition & 1 deletion Tests/ThemeParkTests/TextMateThemeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class TextMateThemeTests: XCTestCase {
Style(color: PlatformColor(hex: "#0C1021")!)
)
XCTAssertEqual(
theme.style(for: Query(key: .syntax(.text), context: .init(colorScheme: .light))),
theme.style(for: Query(key: .syntax(.text(nil)), context: .init(colorScheme: .light))),
Style(color: PlatformColor(hex: "#F8F8F8")!)
)
XCTAssertEqual(
Expand Down
11 changes: 3 additions & 8 deletions Tests/ThemeParkTests/XcodeThemeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@ final class XcodeThemeTests: XCTestCase {
func testSemanticQueries() throws {
let url = try XCTUnwrap(Bundle.module.url(forResource: "Default (Light)", withExtension: "xccolortheme", subdirectory: "Resources"))
let theme = try XcodeTheme(contentsOf: url)
#if os(macOS)
let fallbackFont = PlatformFont.systemFont(ofSize: 10.0)
#else
let fallbackFont = PlatformFont.preferredFont(forTextStyle: .body)
#endif

// color equality here is actually quite tricky
XCTAssertEqual(
theme.style(for: .editor(.background)),
Style(color: PlatformColor(hex: "#ffffff")!, font: fallbackFont)
Style(color: PlatformColor(hex: "#ffffff")!)
)
XCTAssertEqual(
theme.style(for: .syntax(.text)).color.toHex(),
theme.style(for: .syntax(.text(nil))).color.toHex(),
PlatformColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.85).toHex()
)
XCTAssertEqual(
Expand All @@ -42,7 +37,7 @@ final class XcodeThemeTests: XCTestCase {
)
XCTAssertEqual(
theme.style(for: .gutter(.label)),
theme.style(for: .syntax(.text))
theme.style(for: .syntax(.text(nil)))
)
}
}

0 comments on commit 283e9f4

Please sign in to comment.