mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 00:58:37 +00:00
replace garbage in the app with garbage in the tests (until apple fix that), enable coverage
This commit is contained in:
parent
85aa2c4f2b
commit
a3c7fa7464
@ -11,7 +11,8 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
codeCoverageEnabled = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
||||
@ -332,59 +332,6 @@ enum LongActionType: Decodable {
|
||||
}
|
||||
}
|
||||
|
||||
extension ItemType: Equatable {}
|
||||
func ==(lhs: ItemType, rhs: ItemType) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case let (.staticButton(a), .staticButton(b)):
|
||||
return a == b
|
||||
case let (.appleScriptTitledButton(a, b), .appleScriptTitledButton(c, d)):
|
||||
return a == c && b == d
|
||||
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
extension ActionType: Equatable {}
|
||||
func ==(lhs: ActionType, rhs: ActionType) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.none, .none):
|
||||
return true
|
||||
case let (.hidKey(a), .hidKey(b)):
|
||||
return a == b
|
||||
case let (.keyPress(a), .keyPress(b)):
|
||||
return a == b
|
||||
case let (.appleSctipt(a), .appleSctipt(b)):
|
||||
return a == b
|
||||
case let (.shellScript(a, b), .shellScript(c, d)):
|
||||
return a == c && b == d
|
||||
case let (.openUrl(a), .openUrl(b)):
|
||||
return a == b
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension LongActionType: Equatable {}
|
||||
func ==(lhs: LongActionType, rhs: LongActionType) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.none, .none):
|
||||
return true
|
||||
case let (.hidKey(a), .hidKey(b)):
|
||||
return a == b
|
||||
case let (.keyPress(a), .keyPress(b)):
|
||||
return a == b
|
||||
case let (.appleSctipt(a), .appleSctipt(b)):
|
||||
return a == b
|
||||
case let (.shellScript(a, b), .shellScript(c, d)):
|
||||
return a == c && b == d
|
||||
case let (.openUrl(a), .openUrl(b)):
|
||||
return a == b
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
enum GeneralParameter {
|
||||
case width(_: CGFloat)
|
||||
@ -470,10 +417,6 @@ extension NSImage: SourceProtocol {
|
||||
return self
|
||||
}
|
||||
}
|
||||
extension SourceProtocol where Self: Equatable {}
|
||||
func ==(left: SourceProtocol, right: SourceProtocol) -> Bool {
|
||||
return left.data == right.data
|
||||
}
|
||||
|
||||
extension String {
|
||||
var base64Data: Data? {
|
||||
|
||||
@ -7,8 +7,14 @@ class ParseConfig: XCTestCase {
|
||||
[ { "type": "staticButton", "title": "Pew" } ]
|
||||
""".data(using: .utf8)!
|
||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture)
|
||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "Pew"))
|
||||
XCTAssertEqual(result?.first?.action, .some(.none))
|
||||
guard case .staticButton("Pew")? = result?.first?.type else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
guard case .none? = result?.first?.action else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func testButtonKeyCodeAction() {
|
||||
@ -16,8 +22,14 @@ class ParseConfig: XCTestCase {
|
||||
[ { "type": "staticButton", "title": "Pew", "action": "hidKey", "keycode": 123} ]
|
||||
""".data(using: .utf8)!
|
||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "Pew"))
|
||||
XCTAssertEqual(result?.first?.action, .hidKey(keycode: 123))
|
||||
guard case .staticButton("Pew")? = result?.first?.type else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
guard case .hidKey(keycode: 123)? = result?.first?.action else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func testPredefinedItem() {
|
||||
@ -25,8 +37,14 @@ class ParseConfig: XCTestCase {
|
||||
[ { "type": "escape" } ]
|
||||
""".data(using: .utf8)!
|
||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "esc"))
|
||||
XCTAssertEqual(result?.first?.action, .keyPress(keycode: 53))
|
||||
guard case .staticButton("esc")? = result?.first?.type else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
guard case .keyPress(keycode: 53)? = result?.first?.action else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func testExtendedWidthForPredefinedItem() {
|
||||
@ -34,8 +52,18 @@ class ParseConfig: XCTestCase {
|
||||
[ { "type": "escape", "width": 110}, ]
|
||||
""".data(using: .utf8)!
|
||||
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture)
|
||||
XCTAssertEqual(result?.first?.type, .staticButton(title: "esc"))
|
||||
XCTAssertEqual(result?.first?.action, .keyPress(keycode: 53))
|
||||
guard case .staticButton("esc")? = result?.first?.type else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
guard case .keyPress(keycode: 53)? = result?.first?.action else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
guard case .width(110)? = result?.first?.additionalParameters[.width] else {
|
||||
XCTFail()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user