|
|
|
@ -5,7 +5,6 @@ import XCTest
|
|
|
|
|
@testable import Clocker |
|
|
|
|
|
|
|
|
|
class ThemerTests: XCTestCase { |
|
|
|
|
|
|
|
|
|
@available(macOS 10.14, *) |
|
|
|
|
func testSettingTheme() { |
|
|
|
|
// Set to some random number should set to 0 |
|
|
|
@ -29,7 +28,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedTextColor = NSColor.black |
|
|
|
|
let expectedTextBackgroundColor = NSColor(deviceRed: 241.0 / 255.0, green: 241.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let expectedShutdownImageName = "ellipsis.circle" |
|
|
|
|
let expectedPreferenceImageName = "plus" |
|
|
|
|
let expectedPinImageName = "macwindow.on.rectangle" |
|
|
|
@ -55,7 +53,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedForwardsImage = "goforward.15" |
|
|
|
|
let expectedResetSliderImage = "xmark.circle.fill" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XCTAssertEqual(subject.sliderKnobColor(), expectedSliderKnobColor) |
|
|
|
|
XCTAssertEqual(subject.sliderRightColor(), expectedSliderRightColor) |
|
|
|
|
XCTAssertEqual(subject.mainBackgroundColor(), expectedBackgroundColor) |
|
|
|
@ -97,7 +94,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedTextColor = NSColor.white |
|
|
|
|
let expectedTextBackgroundColor = NSColor(deviceRed: 42.0 / 255.0, green: 55.0 / 255.0, blue: 62.0 / 255.0, alpha: 1.0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let expectedShutdownImageName = "ellipsis.circle" |
|
|
|
|
let expectedPreferenceImageName = "plus" |
|
|
|
|
let expectedPinImageName = "macwindow.on.rectangle" |
|
|
|
@ -123,7 +119,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedForwardsImage = "goforward.15" |
|
|
|
|
let expectedResetSliderImage = "xmark.circle.fill" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XCTAssertEqual(subject.sliderKnobColor(), expectedSliderKnobColor) |
|
|
|
|
XCTAssertEqual(subject.sliderRightColor(), expectedSliderRightColor) |
|
|
|
|
XCTAssertEqual(subject.mainBackgroundColor(), expectedBackgroundColor) |
|
|
|
@ -158,7 +153,7 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
|
|
|
|
|
func testSystemTheme() throws { |
|
|
|
|
let currentSystemTheme = |
|
|
|
|
UserDefaults.standard.string(forKey: "AppleUserInterfaceStyle")?.lowercased().contains("dark") ?? false ? Themer.Theme.dark : Themer.Theme.light |
|
|
|
|
UserDefaults.standard.string(forKey: "AppleUserInterfaceStyle")?.lowercased().contains("dark") ?? false ? Themer.Theme.dark : Themer.Theme.light |
|
|
|
|
let subject = Themer(index: 2) // 2 is for system theme |
|
|
|
|
let expectedSliderKnobColor = currentSystemTheme == .light ? NSColor(deviceRed: 255.0, green: 255.0, blue: 255, alpha: 0.9) : NSColor(deviceRed: 0.0, green: 0.0, blue: 0, alpha: 0.9) |
|
|
|
|
let expectedSliderRightColor = currentSystemTheme == .dark ? NSColor.white : NSColor.gray |
|
|
|
@ -166,7 +161,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedTextColor = NSColor.textColor |
|
|
|
|
let expectedTextBackgroundColor = currentSystemTheme == .dark ? NSColor(deviceRed: 42.0 / 255.0, green: 55.0 / 255.0, blue: 62.0 / 255.0, alpha: 1.0) : NSColor(deviceRed: 241.0 / 255.0, green: 241.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let expectedShutdownImageName = "ellipsis.circle" |
|
|
|
|
let expectedPreferenceImageName = "plus" |
|
|
|
|
let expectedPinImageName = "macwindow.on.rectangle" |
|
|
|
@ -192,7 +186,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedForwardsImage = "goforward.15" |
|
|
|
|
let expectedResetSliderImage = "xmark.circle.fill" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XCTAssertEqual(subject.sliderKnobColor(), expectedSliderKnobColor) |
|
|
|
|
XCTAssertEqual(subject.sliderRightColor(), expectedSliderRightColor) |
|
|
|
|
XCTAssertEqual(subject.mainBackgroundColor(), expectedBackgroundColor) |
|
|
|
@ -233,7 +226,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedTextColor = NSColor.black |
|
|
|
|
let expectedTextBackgroundColor = NSColor(deviceRed: 238.0 / 255.0, green: 232.0 / 255.0, blue: 213.0 / 255.0, alpha: 1.0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let expectedShutdownImageName = "ellipsis.circle" |
|
|
|
|
let expectedPreferenceImageName = "plus" |
|
|
|
|
let expectedPinImageName = "macwindow.on.rectangle" |
|
|
|
@ -259,7 +251,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedForwardsImage = "goforward.15" |
|
|
|
|
let expectedResetSliderImage = "xmark.circle.fill" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XCTAssertEqual(subject.sliderKnobColor(), expectedSliderKnobColor) |
|
|
|
|
XCTAssertEqual(subject.sliderRightColor(), expectedSliderRightColor) |
|
|
|
|
XCTAssertEqual(subject.mainBackgroundColor(), expectedBackgroundColor) |
|
|
|
@ -301,7 +292,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedTextColor = NSColor.white |
|
|
|
|
let expectedTextBackgroundColor = NSColor(deviceRed: 88.0 / 255.0, green: 110.0 / 255.0, blue: 117.0 / 255.0, alpha: 1.0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let expectedShutdownImageName = "ellipsis.circle" |
|
|
|
|
let expectedPreferenceImageName = "plus" |
|
|
|
|
let expectedPinImageName = "macwindow.on.rectangle" |
|
|
|
@ -327,7 +317,6 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
let expectedForwardsImage = "goforward.15" |
|
|
|
|
let expectedResetSliderImage = "xmark.circle.fill" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
XCTAssertEqual(subject.sliderKnobColor(), expectedSliderKnobColor) |
|
|
|
|
XCTAssertEqual(subject.sliderRightColor(), expectedSliderRightColor) |
|
|
|
|
XCTAssertEqual(subject.mainBackgroundColor(), expectedBackgroundColor) |
|
|
|
@ -358,5 +347,4 @@ class ThemerTests: XCTestCase {
|
|
|
|
|
XCTAssertEqual(subject.goForwardsImage()?.accessibilityDescription, expectedForwardsImage) |
|
|
|
|
XCTAssertEqual(subject.resetModernSliderImage()?.accessibilityDescription, expectedResetSliderImage) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|