Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ final class KeyboardVisualizerGroupViewSnapshotTests: XCTestCase {
)
}

func testRendersPBTBlackCommandShiftKKeycaps() {
self.assertCommandShiftKSnapshot(
style: .pbt,
theme: .black,
named: "pbt-black-command-shift-k-keycaps"
)
}

func testRendersMinimalBlackCommandShiftKKeycaps() {
self.assertCommandShiftKSnapshot(
style: .minimal,
theme: .black,
named: "minimal-black-command-shift-k-keycaps"
)
}

func testRendersRetroBlackCommandShiftKKeycaps() {
self.assertCommandShiftKSnapshot(
style: .retro,
theme: .black,
named: "retro-black-command-shift-k-keycaps"
)
}

func testRendersM0116StyleKeycap() {
self.assertGroupSnapshot(
style: .m0116,
Expand Down Expand Up @@ -63,21 +87,11 @@ final class KeyboardVisualizerGroupViewSnapshotTests: XCTestCase {
}

func testRendersM0116StyleCommandShiftKKeycaps() {
let settings = self.settings(style: .m0116, theme: .white)
let items = KeycapItemFactory.modifierItems(
currentFlags: [],
releasedFlags: Self.commandShiftFlags,
palette: settings.palette
)
+ KeycapItemFactory.keycapItems(
keyCode: KeyboardKeyCode.k.rawValue,
legend: EventLegend(text: "K"),
modifierFlags: [],
isPressed: false,
palette: settings.palette
self.assertCommandShiftKSnapshot(
style: .m0116,
theme: .white,
named: "m0116-command-shift-k-keycaps"
)

self.assertGroupSnapshot(style: .m0116, theme: .white, items: items, named: "m0116-command-shift-k-keycaps")
}

func testRendersAppleBlackEscapeKeycap() {
Expand Down Expand Up @@ -128,6 +142,39 @@ private extension KeyboardVisualizerGroupViewSnapshotTests {
)
}

func assertCommandShiftKSnapshot(
style: KeycapStyle,
theme: KeyboardVisualizerTheme,
named name: String,
file: StaticString = #filePath,
testName: String = #function,
line: UInt = #line
) {
let settings = self.settings(style: style, theme: theme)
let items = KeycapItemFactory.modifierItems(
currentFlags: [],
releasedFlags: Self.commandShiftFlags,
palette: settings.palette
)
+ KeycapItemFactory.keycapItems(
keyCode: KeyboardKeyCode.k.rawValue,
legend: EventLegend(text: "K"),
modifierFlags: [],
isPressed: false,
palette: settings.palette
)

self.assertGroupSnapshot(
style: style,
theme: theme,
items: items,
named: name,
file: file,
testName: testName,
line: line
)
}

func assertAppleBlackSnapshot(
items: [KeycapItem],
named name: String,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading