|
|
@ -95,6 +95,7 @@ class AppDelegateTests: XCTestCase { |
|
|
|
|
|
|
|
|
|
|
|
func testCompactModeMenubarSetup() { |
|
|
|
func testCompactModeMenubarSetup() { |
|
|
|
let subject = NSApplication.shared.delegate as? AppDelegate |
|
|
|
let subject = NSApplication.shared.delegate as? AppDelegate |
|
|
|
|
|
|
|
let olderTimezones = DataStore.shared().timezones() |
|
|
|
|
|
|
|
|
|
|
|
let timezone1 = TimezoneData() |
|
|
|
let timezone1 = TimezoneData() |
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
@ -108,17 +109,22 @@ class AppDelegateTests: XCTestCase { |
|
|
|
let statusItemHandler = subject?.statusItemForPanel() |
|
|
|
let statusItemHandler = subject?.statusItemForPanel() |
|
|
|
XCTAssertNotNil(statusItemHandler?.statusItem.view) // This won't be nil for compact mode |
|
|
|
XCTAssertNotNil(statusItemHandler?.statusItem.view) // This won't be nil for compact mode |
|
|
|
|
|
|
|
|
|
|
|
DataStore.shared().setTimezones([]) |
|
|
|
DataStore.shared().setTimezones(olderTimezones) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func testStandardModeMenubarSetup() { |
|
|
|
func testStandardModeMenubarSetup() { |
|
|
|
|
|
|
|
let olderTimezones = DataStore.shared().timezones() |
|
|
|
UserDefaults.standard.set(1, forKey: CLMenubarCompactMode) // Set the menubar mode to standard |
|
|
|
UserDefaults.standard.set(1, forKey: CLMenubarCompactMode) // Set the menubar mode to standard |
|
|
|
|
|
|
|
|
|
|
|
let subject = NSApplication.shared.delegate as? AppDelegate |
|
|
|
let subject = NSApplication.shared.delegate as? AppDelegate |
|
|
|
let statusItemHandler = subject?.statusItemForPanel() |
|
|
|
let statusItemHandler = subject?.statusItemForPanel() |
|
|
|
subject?.setupMenubarTimer() |
|
|
|
subject?.setupMenubarTimer() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if olderTimezones.isEmpty { |
|
|
|
XCTAssertEqual(statusItemHandler?.statusItem.button?.image?.name(), "LightModeIcon") |
|
|
|
XCTAssertEqual(statusItemHandler?.statusItem.button?.image?.name(), "LightModeIcon") |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
XCTAssertTrue(statusItemHandler?.statusItem.button?.title != nil) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let timezone1 = TimezoneData() |
|
|
|
let timezone1 = TimezoneData() |
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
|
timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier |
|
|
@ -132,8 +138,6 @@ class AppDelegateTests: XCTestCase { |
|
|
|
|
|
|
|
|
|
|
|
XCTAssertNil(subject?.statusItemForPanel().statusItem.view) // This will be nil for standard mode |
|
|
|
XCTAssertNil(subject?.statusItemForPanel().statusItem.view) // This will be nil for standard mode |
|
|
|
|
|
|
|
|
|
|
|
DataStore.shared().setTimezones([]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UserDefaults.standard.set(0, forKey: CLMenubarCompactMode) // Set the menubar mode back to compact |
|
|
|
UserDefaults.standard.set(0, forKey: CLMenubarCompactMode) // Set the menubar mode back to compact |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|