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()
app.windows["Clocker"].buttons["ShortcutControl"].click()
app.windows["Clocker"].buttons["ShortcutControl"].typeKey(randomAlphabet, modifierFlags: [.shift, .command])
app.windows["Clocker"].otherElements["ShortcutControl"].click()
app.windows["Clocker"].otherElements["ShortcutControl"].typeKey(randomAlphabet, modifierFlags: [.shift, .command])
// Close the window to really test
app.windows["Clocker"].buttons["_XCUI:CloseWindow"].click()
@ -44,7 +44,7 @@ class ShortcutTests: XCTestCase {
// Reset the shortcut
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(randomAlphabet, modifierFlags: [.shift, .command])
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")
}
override func mouseDown(with _: NSEvent) {
// Text is copied in the following format: Chicago - 1625185925
let clipboardCopy = "\(customName.stringValue) - \(time.stringValue)"
let pasteboard = NSPasteboard.general
pasteboard.declareTypes([.string], owner: nil)
pasteboard.setString(clipboardCopy, forType: .string)
window?.contentView?.makeToast("Copied to Clipboard".localized())
window?.endEditing(for: nil)
override func mouseDown(with event: NSEvent) {
if (event.clickCount == 1) {
// Text is copied in the following format: Chicago - 1625185925
let clipboardCopy = "\(customName.stringValue) - \(time.stringValue)"
let pasteboard = NSPasteboard.general
pasteboard.declareTypes([.string], owner: nil)
pasteboard.setString(clipboardCopy, forType: .string)
window?.contentView?.makeToast("Copied to Clipboard".localized())
window?.endEditing(for: nil)
} else if (event.clickCount == 2) {
//TODO: Favourite this timezone
}
}
override func rightMouseDown(with event: NSEvent) {

Loading…
Cancel
Save