Browse Source

Merge branch 'master' of https://github.com/n0shake/Clocker

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
3e396fd4df
  1. 6
      Clocker/ClockerUITests/ShortcutTests.swift
  2. 24
      Clocker/Panel/UI/TimezoneCellView.swift

6
Clocker/ClockerUITests/ShortcutTests.swift

@ -27,8 +27,8 @@ class ShortcutTests: XCTestCase {
let randomAlphabet = randomLetter() let randomAlphabet = randomLetter()
app.windows["Clocker"].buttons["ShortcutControl"].click() app.windows["Clocker"].otherElements["ShortcutControl"].click()
app.windows["Clocker"].buttons["ShortcutControl"].typeKey(randomAlphabet, modifierFlags: [.shift, .command]) app.windows["Clocker"].otherElements["ShortcutControl"].typeKey(randomAlphabet, modifierFlags: [.shift, .command])
// Close the window to really test // Close the window to really test
app.windows["Clocker"].buttons["_XCUI:CloseWindow"].click() app.windows["Clocker"].buttons["_XCUI:CloseWindow"].click()
@ -44,7 +44,7 @@ class ShortcutTests: XCTestCase {
// Reset the shortcut // Reset the shortcut
app.tables["mainTableView"].typeKey(",", modifierFlags: .command) app.tables["mainTableView"].typeKey(",", modifierFlags: .command)
app.windows["Clocker"].buttons["ShortcutControl"].click() app.windows["Clocker"].otherElements["ShortcutControl"].click()
app.windows["Clocker"].typeKey(XCUIKeyboardKey.delete, modifierFlags: []) app.windows["Clocker"].typeKey(XCUIKeyboardKey.delete, modifierFlags: [])
app.windows["Clocker"].typeKey(randomAlphabet, modifierFlags: [.shift, .command]) app.windows["Clocker"].typeKey(randomAlphabet, modifierFlags: [.shift, .command])
XCTAssertFalse(app.tables["mainTableView"].exists) XCTAssertFalse(app.tables["mainTableView"].exists)

24
Clocker/Panel/UI/TimezoneCellView.swift

@ -198,16 +198,20 @@ class TimezoneCellView: NSTableCellView {
Logger.log(object: nil, for: "Open Extra Options") Logger.log(object: nil, for: "Open Extra Options")
} }
override func mouseDown(with _: NSEvent) { override func mouseDown(with event: NSEvent) {
// Text is copied in the following format: Chicago - 1625185925 if (event.clickCount == 1) {
let clipboardCopy = "\(customName.stringValue) - \(time.stringValue)" // Text is copied in the following format: Chicago - 1625185925
let pasteboard = NSPasteboard.general let clipboardCopy = "\(customName.stringValue) - \(time.stringValue)"
pasteboard.declareTypes([.string], owner: nil) let pasteboard = NSPasteboard.general
pasteboard.setString(clipboardCopy, forType: .string) pasteboard.declareTypes([.string], owner: nil)
pasteboard.setString(clipboardCopy, forType: .string)
window?.contentView?.makeToast("Copied to Clipboard".localized())
window?.contentView?.makeToast("Copied to Clipboard".localized())
window?.endEditing(for: nil)
window?.endEditing(for: nil)
} else if (event.clickCount == 2) {
//TODO: Favourite this timezone
}
} }
override func rightMouseDown(with event: NSEvent) { override func rightMouseDown(with event: NSEvent) {

Loading…
Cancel
Save