Style format

This commit is contained in:
2019-01-24 00:04:30 +03:00
parent acc248a579
commit b718b1c9dd
8 changed files with 38 additions and 45 deletions
+2 -4
View File
@@ -1,7 +1,6 @@
import XCTest
class AppleScriptDefinitionTests: XCTestCase {
func testInline() {
let buttonNoActionFixture = """
[ { "type": "appleScriptTitledButton", "source": { "inline": "tell everything fine" } } ]
@@ -13,7 +12,7 @@ class AppleScriptDefinitionTests: XCTestCase {
}
XCTAssertEqual(source.string, "tell everything fine")
}
func testPath() {
let buttonNoActionFixture = """
[ { "type": "appleScriptTitledButton", "source": { "filePath": "/ololo/pew" } } ]
@@ -26,7 +25,7 @@ class AppleScriptDefinitionTests: XCTestCase {
let sourceStruct = source as? Source
XCTAssertEqual(sourceStruct?.filePath, "/ololo/pew")
}
func testRefreshInterval() {
let buttonNoActionFixture = """
[ { "type": "appleScriptTitledButton", "source": { "inline": "tell everything fine" }, "refreshInterval": 305} ]
@@ -37,5 +36,4 @@ class AppleScriptDefinitionTests: XCTestCase {
return
}
}
}
+3 -5
View File
@@ -1,29 +1,27 @@
import XCTest
class BackgroundColorTests: XCTestCase {
func testOpaque() {
let buttonNoActionFixture = """
[ { "type": "staticButton", "title": "Pew", "background": "#FF0000" } ]
""".data(using: .utf8)!
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture)
guard case .background(let color)? = result?.first?.additionalParameters[.background] else {
guard case let .background(color)? = result?.first?.additionalParameters[.background] else {
XCTFail()
return
}
XCTAssertEqual(color, .red)
}
func testAlpha() {
let buttonNoActionFixture = """
[ { "type": "staticButton", "title": "Pew", "background": "#FF000080" } ]
""".data(using: .utf8)!
let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture)
guard case .background(let color)? = result?.first?.additionalParameters[.background] else {
guard case let .background(color)? = result?.first?.additionalParameters[.background] else {
XCTFail()
return
}
XCTAssertEqual(color.alphaComponent, 0.5, accuracy: 0.01)
}
}
+2 -4
View File
@@ -1,7 +1,6 @@
import XCTest
class ParseConfig: XCTestCase {
func testButtonNoAction() {
let buttonNoActionFixture = """
[ { "type": "staticButton", "title": "Pew" } ]
@@ -31,7 +30,7 @@ class ParseConfig: XCTestCase {
return
}
}
func testPredefinedItem() {
let buttonKeycodeFixture = """
[ { "type": "escape" } ]
@@ -46,7 +45,7 @@ class ParseConfig: XCTestCase {
return
}
}
func testExtendedWidthForPredefinedItem() {
let buttonKeycodeFixture = """
[ { "type": "escape", "width": 110}, ]
@@ -65,5 +64,4 @@ class ParseConfig: XCTestCase {
return
}
}
}