From 651258b01f222c78bbc5575fd055af1335c15321 Mon Sep 17 00:00:00 2001 From: Serg Date: Sun, 6 May 2018 17:13:31 +0700 Subject: [PATCH] fix building test target, add one more test --- MTMR.xcodeproj/project.pbxproj | 21 ++------------------- MTMRTests/ParseConfigTests.swift | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/MTMR.xcodeproj/project.pbxproj b/MTMR.xcodeproj/project.pbxproj index 4aa24bc..1bdee76 100644 --- a/MTMR.xcodeproj/project.pbxproj +++ b/MTMR.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 36300E83209F040900B31C71 /* SupportHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0008E542080286C003AD4DD /* SupportHelpers.swift */; }; 368EDDE720812A1D00E10953 /* ScrollViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368EDDE620812A1D00E10953 /* ScrollViewItem.swift */; }; 36C2ECD7207B6DAE003CDA33 /* TimeTouchBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36C2ECD6207B6DAE003CDA33 /* TimeTouchBarItem.swift */; }; 36C2ECD9207B74B4003CDA33 /* AppleScriptTouchBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36C2ECD8207B74B4003CDA33 /* AppleScriptTouchBarItem.swift */; }; @@ -46,16 +47,6 @@ B0F8771A207AC1EA00D6E430 /* TouchBarSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F87719207AC1EA00D6E430 /* TouchBarSupport.m */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - B082B262205C7D8000BC04DC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = B082B247205C7D8000BC04DC /* Project object */; - proxyType = 1; - remoteGlobalIDString = B082B24E205C7D8000BC04DC; - remoteInfo = MTMR; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ 368EDDE620812A1D00E10953 /* ScrollViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollViewItem.swift; sourceTree = ""; }; 36BDC22F207CDA8600FCFEBE /* TECHNICAL_DEBT.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = TECHNICAL_DEBT.md; sourceTree = ""; }; @@ -266,7 +257,6 @@ buildRules = ( ); dependencies = ( - B082B263205C7D8000BC04DC /* PBXTargetDependency */, ); name = MTMRTests; productName = MTMRTests; @@ -379,20 +369,13 @@ buildActionMask = 2147483647; files = ( 36C2ECDD207C723B003CDA33 /* ParseConfigTests.swift in Sources */, + 36300E83209F040900B31C71 /* SupportHelpers.swift in Sources */, 36C2ECDE207C82DE003CDA33 /* ItemsParsing.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - B082B263205C7D8000BC04DC /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = B082B24E205C7D8000BC04DC /* MTMR */; - targetProxy = B082B262205C7D8000BC04DC /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ B082B258205C7D8000BC04DC /* Main.storyboard */ = { isa = PBXVariantGroup; diff --git a/MTMRTests/ParseConfigTests.swift b/MTMRTests/ParseConfigTests.swift index bd29393..6a0a806 100644 --- a/MTMRTests/ParseConfigTests.swift +++ b/MTMRTests/ParseConfigTests.swift @@ -23,11 +23,20 @@ class ParseConfig: XCTestCase { func testPredefinedItem() { let buttonKeycodeFixture = """ - [ { "type": "brightnessUp" } ] + [ { "type": "escape" } ] """.data(using: .utf8)! let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonKeycodeFixture) - XCTAssertEqual(result?.first?.type, .staticButton(title: "🔆")) - XCTAssertEqual(result?.first?.action, .keyPress(keycode: 113)) + XCTAssertEqual(result?.first?.type, .staticButton(title: "esc")) + XCTAssertEqual(result?.first?.action, .keyPress(keycode: 53)) + } + + func testExtendedWidthForPredefinedItem() { + let buttonKeycodeFixture = """ + [ { "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)) } }