Browse Source

Swiftformat.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
4dcd80e4e1
  1. 3
      Clocker/ClockerUnitTests/EventInfoTests.swift
  2. 7
      Clocker/ClockerUnitTests/StandardMenubarHandlerTests.swift
  3. 2
      Clocker/Overall App/AppKit + Additions.swift
  4. 2
      Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

3
Clocker/ClockerUnitTests/EventInfoTests.swift

@ -1,8 +1,8 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import XCTest
@testable import Clocker @testable import Clocker
import EventKit import EventKit
import XCTest
class EventInfoTests: XCTestCase { class EventInfoTests: XCTestCase {
private let eventStore = EKEventStore() private let eventStore = EKEventStore()
@ -76,5 +76,4 @@ class EventInfoTests: XCTestCase {
XCTAssert(mockEventInfo.metadataForMeeting() == "in 25h", XCTAssert(mockEventInfo.metadataForMeeting() == "in 25h",
"Metadata for meeting: \(mockEventInfo.metadataForMeeting()) doesn't match expectation") "Metadata for meeting: \(mockEventInfo.metadataForMeeting()) doesn't match expectation")
} }
} }

7
Clocker/ClockerUnitTests/StandardMenubarHandlerTests.swift

@ -1,8 +1,8 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import CoreModelKit import CoreModelKit
import XCTest
import EventKit import EventKit
import XCTest
@testable import Clocker @testable import Clocker
@ -128,7 +128,6 @@ class StandardMenubarHandlerTests: XCTestCase {
let menubarHandler = MenubarTitleProvider(with: store) let menubarHandler = MenubarTitleProvider(with: store)
XCTAssert(menubarHandler.format(event: mockEvent) == "Mock Title in 10m", XCTAssert(menubarHandler.format(event: mockEvent) == "Mock Title in 10m",
"Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation") "Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation")
} }
func testUpcomingEventHappeningWithinOneMinute() { func testUpcomingEventHappeningWithinOneMinute() {
@ -142,7 +141,6 @@ class StandardMenubarHandlerTests: XCTestCase {
let menubarHandler = MenubarTitleProvider(with: store) let menubarHandler = MenubarTitleProvider(with: store)
XCTAssert(menubarHandler.format(event: mockEvent) == "Mock Title in 1m", XCTAssert(menubarHandler.format(event: mockEvent) == "Mock Title in 1m",
"Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation") "Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation")
} }
func testUpcomingEventHappeningWithinSeconds() { func testUpcomingEventHappeningWithinSeconds() {
@ -156,7 +154,6 @@ class StandardMenubarHandlerTests: XCTestCase {
let menubarHandler = MenubarTitleProvider(with: store) let menubarHandler = MenubarTitleProvider(with: store)
XCTAssert(menubarHandler.format(event: mockEvent) == "Mock Title starts now.", XCTAssert(menubarHandler.format(event: mockEvent) == "Mock Title starts now.",
"Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation") "Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation")
} }
func testEmptyUpcomingEvent() { func testEmptyUpcomingEvent() {
@ -169,7 +166,6 @@ class StandardMenubarHandlerTests: XCTestCase {
let menubarHandler = MenubarTitleProvider(with: store) let menubarHandler = MenubarTitleProvider(with: store)
XCTAssert(menubarHandler.format(event: mockEvent) == CLEmptyString, XCTAssert(menubarHandler.format(event: mockEvent) == CLEmptyString,
"Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation") "Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation")
} }
func testLongUpcomingEvent() { func testLongUpcomingEvent() {
@ -183,6 +179,5 @@ class StandardMenubarHandlerTests: XCTestCase {
let menubarHandler = MenubarTitleProvider(with: store) let menubarHandler = MenubarTitleProvider(with: store)
XCTAssert(menubarHandler.format(event: mockEvent) == "Really long calendar event tit... starts now.", XCTAssert(menubarHandler.format(event: mockEvent) == "Really long calendar event tit... starts now.",
"Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation") "Suffix \(menubarHandler.format(event: mockEvent)) doesn't match expectation")
} }
} }

2
Clocker/Overall App/AppKit + Additions.swift

@ -21,7 +21,7 @@ extension NSTextField {
} }
extension NSFont { extension NSFont {
func size(_ string: String, _ width: Double, attributes: [NSAttributedString.Key: AnyObject]) -> CGSize { func size(for string: String, width: Double, attributes: [NSAttributedString.Key: AnyObject]) -> CGSize {
let size = CGSize(width: width, let size = CGSize(width: width,
height: Double.greatestFiniteMagnitude) height: Double.greatestFiniteMagnitude)

2
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

@ -210,7 +210,7 @@ class AppFeedbackWindowController: NSWindowController {
AppFeedbackConstants.CLClockerVersion: versionInfo, AppFeedbackConstants.CLClockerVersion: versionInfo,
AppFeedbackConstants.CLAppFeedbackDateProperty: todaysDate(), AppFeedbackConstants.CLAppFeedbackDateProperty: todaysDate(),
AppFeedbackConstants.CLAppFeedbackUserPreferences: generateUserPreferences(), AppFeedbackConstants.CLAppFeedbackUserPreferences: generateUserPreferences(),
AppFeedbackConstants.CLFeedbackEntryPoint: appFeedbackWindowDelegate?.appFeedbackWindoEntryPoint() ?? "Error" AppFeedbackConstants.CLFeedbackEntryPoint: appFeedbackWindowDelegate?.appFeedbackWindoEntryPoint() ?? "Error",
] ]
} }

Loading…
Cancel
Save