From a2903aa2e28b1f6724ba33671ee1023309e6fdf6 Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Mon, 28 Mar 2016 21:11:04 -0400 Subject: [PATCH 1/8] Uncommented tests that don't work --- TouchDrawTests/TouchDrawTests.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/TouchDrawTests/TouchDrawTests.swift b/TouchDrawTests/TouchDrawTests.swift index a0bbacb..96377ac 100644 --- a/TouchDrawTests/TouchDrawTests.swift +++ b/TouchDrawTests/TouchDrawTests.swift @@ -43,7 +43,6 @@ class TouchDrawTests: XCTestCase { XCTAssertTrue(viewController.undoIsEnabled, "Undo should be enabled") } - /* /// Tests whether you clearing empties the strokes func testClearing() { var touches = Set() @@ -68,6 +67,6 @@ class TouchDrawTests: XCTestCase { XCTAssert(viewController.touchDrawView.stack.count == 1, "Should have one stroke") viewController.touchDrawView.undo() XCTAssert(viewController.touchDrawView.stack.count == 0, "Should not have any strokes") - }*/ + } } From 10a80466a452059c40bc9047b33cf4cbac60ea57 Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Mon, 4 Apr 2016 18:19:18 -0400 Subject: [PATCH 2/8] Messing around with UIApplication.sharedApplication --- TouchDrawTests/TouchDrawTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TouchDrawTests/TouchDrawTests.swift b/TouchDrawTests/TouchDrawTests.swift index 96377ac..b71f1f9 100644 --- a/TouchDrawTests/TouchDrawTests.swift +++ b/TouchDrawTests/TouchDrawTests.swift @@ -15,13 +15,13 @@ class TouchDrawTests: XCTestCase { override func setUp() { super.setUp() - + // Put setup code here. This method is called before the invocation of each test method in the class. let storyboard = UIStoryboard(name: "Main", bundle: NSBundle(forClass: self.dynamicType)) viewController = storyboard.instantiateInitialViewController() as! ViewController - viewController.viewDidLoad() - viewController.viewDidAppear(false) + + UIApplication.sharedApplication().keyWindow!.rootViewController = viewController // Test and Load the View at the Same Time! XCTAssertNotNil(viewController.view) From 6a5b658ad2070796ebbdeda71f40f54d53b330ad Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Fri, 8 Apr 2016 20:16:37 -0400 Subject: [PATCH 3/8] Got the 3 tests working. --- TouchDraw.xcodeproj/project.pbxproj | 179 ++++++++++++++-------------- TouchDraw/TouchDrawView.swift | 31 +++-- TouchDrawTests/Main.storyboard | 17 +-- TouchDrawTests/TouchDrawTests.swift | 10 +- 4 files changed, 123 insertions(+), 114 deletions(-) diff --git a/TouchDraw.xcodeproj/project.pbxproj b/TouchDraw.xcodeproj/project.pbxproj index 859ccf1..fc82987 100644 --- a/TouchDraw.xcodeproj/project.pbxproj +++ b/TouchDraw.xcodeproj/project.pbxproj @@ -8,15 +8,15 @@ /* Begin PBXBuildFile section */ 89DB172D1BC988E6005E947E /* TouchDrawView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89DB172C1BC988E6005E947E /* TouchDrawView.swift */; }; + 89EADBB71CB87C23001130A8 /* TouchDrawTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EADBB61CB87C23001130A8 /* TouchDrawTests.swift */; }; + 89EADBB91CB87C23001130A8 /* TouchDraw.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 89F60F6B1BC9580000BCDD93 /* TouchDraw.framework */; }; + 89EADBC01CB87C3F001130A8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EADBBF1CB87C3F001130A8 /* ViewController.swift */; }; + 89EADBC21CB87CBA001130A8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89EADBC11CB87CBA001130A8 /* Main.storyboard */; }; 89F60F6F1BC9580000BCDD93 /* TouchDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = 89F60F6E1BC9580000BCDD93 /* TouchDraw.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 89F60F761BC9580000BCDD93 /* TouchDraw.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 89F60F6B1BC9580000BCDD93 /* TouchDraw.framework */; }; - 89F60F7B1BC9580000BCDD93 /* TouchDrawTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F60F7A1BC9580000BCDD93 /* TouchDrawTests.swift */; }; - 89F70C161CA729BA00133F03 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89F70C151CA729BA00133F03 /* ViewController.swift */; }; - 89F70C181CA80BDB00133F03 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89F70C171CA80BDB00133F03 /* Main.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 89F60F771BC9580000BCDD93 /* PBXContainerItemProxy */ = { + 89EADBBA1CB87C23001130A8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 89F60F621BC9580000BCDD93 /* Project object */; proxyType = 1; @@ -27,40 +27,51 @@ /* Begin PBXFileReference section */ 89DB172C1BC988E6005E947E /* TouchDrawView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TouchDrawView.swift; sourceTree = ""; }; + 89EADBB41CB87C23001130A8 /* TouchDrawTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TouchDrawTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 89EADBB61CB87C23001130A8 /* TouchDrawTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchDrawTests.swift; sourceTree = ""; }; + 89EADBB81CB87C23001130A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 89EADBBF1CB87C3F001130A8 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 89EADBC11CB87CBA001130A8 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 89F60F6B1BC9580000BCDD93 /* TouchDraw.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TouchDraw.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 89F60F6E1BC9580000BCDD93 /* TouchDraw.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TouchDraw.h; sourceTree = ""; }; 89F60F701BC9580000BCDD93 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 89F60F751BC9580000BCDD93 /* TouchDrawTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TouchDrawTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 89F60F7A1BC9580000BCDD93 /* TouchDrawTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchDrawTests.swift; sourceTree = ""; }; - 89F60F7C1BC9580000BCDD93 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 89F70C151CA729BA00133F03 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 89F70C171CA80BDB00133F03 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 89F60F671BC9580000BCDD93 /* Frameworks */ = { + 89EADBB11CB87C23001130A8 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 89EADBB91CB87C23001130A8 /* TouchDraw.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 89F60F721BC9580000BCDD93 /* Frameworks */ = { + 89F60F671BC9580000BCDD93 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 89F60F761BC9580000BCDD93 /* TouchDraw.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 89EADBB51CB87C23001130A8 /* TouchDrawTests */ = { + isa = PBXGroup; + children = ( + 89EADBB61CB87C23001130A8 /* TouchDrawTests.swift */, + 89EADBB81CB87C23001130A8 /* Info.plist */, + 89EADBBF1CB87C3F001130A8 /* ViewController.swift */, + 89EADBC11CB87CBA001130A8 /* Main.storyboard */, + ); + path = TouchDrawTests; + sourceTree = ""; + }; 89F60F611BC9580000BCDD93 = { isa = PBXGroup; children = ( 89F60F6D1BC9580000BCDD93 /* TouchDraw */, - 89F60F791BC9580000BCDD93 /* TouchDrawTests */, + 89EADBB51CB87C23001130A8 /* TouchDrawTests */, 89F60F6C1BC9580000BCDD93 /* Products */, ); sourceTree = ""; @@ -69,7 +80,7 @@ isa = PBXGroup; children = ( 89F60F6B1BC9580000BCDD93 /* TouchDraw.framework */, - 89F60F751BC9580000BCDD93 /* TouchDrawTests.xctest */, + 89EADBB41CB87C23001130A8 /* TouchDrawTests.xctest */, ); name = Products; sourceTree = ""; @@ -84,17 +95,6 @@ path = TouchDraw; sourceTree = ""; }; - 89F60F791BC9580000BCDD93 /* TouchDrawTests */ = { - isa = PBXGroup; - children = ( - 89F70C151CA729BA00133F03 /* ViewController.swift */, - 89F60F7A1BC9580000BCDD93 /* TouchDrawTests.swift */, - 89F60F7C1BC9580000BCDD93 /* Info.plist */, - 89F70C171CA80BDB00133F03 /* Main.storyboard */, - ); - path = TouchDrawTests; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -109,6 +109,24 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 89EADBB31CB87C23001130A8 /* TouchDrawTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 89EADBBC1CB87C23001130A8 /* Build configuration list for PBXNativeTarget "TouchDrawTests" */; + buildPhases = ( + 89EADBB01CB87C23001130A8 /* Sources */, + 89EADBB11CB87C23001130A8 /* Frameworks */, + 89EADBB21CB87C23001130A8 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 89EADBBB1CB87C23001130A8 /* PBXTargetDependency */, + ); + name = TouchDrawTests; + productName = TouchDrawTests; + productReference = 89EADBB41CB87C23001130A8 /* TouchDrawTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 89F60F6A1BC9580000BCDD93 /* TouchDraw */ = { isa = PBXNativeTarget; buildConfigurationList = 89F60F7F1BC9580000BCDD93 /* Build configuration list for PBXNativeTarget "TouchDraw" */; @@ -127,38 +145,20 @@ productReference = 89F60F6B1BC9580000BCDD93 /* TouchDraw.framework */; productType = "com.apple.product-type.framework"; }; - 89F60F741BC9580000BCDD93 /* TouchDrawTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 89F60F821BC9580000BCDD93 /* Build configuration list for PBXNativeTarget "TouchDrawTests" */; - buildPhases = ( - 89F60F711BC9580000BCDD93 /* Sources */, - 89F60F721BC9580000BCDD93 /* Frameworks */, - 89F60F731BC9580000BCDD93 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 89F60F781BC9580000BCDD93 /* PBXTargetDependency */, - ); - name = TouchDrawTests; - productName = TouchDrawTests; - productReference = 89F60F751BC9580000BCDD93 /* TouchDrawTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 89F60F621BC9580000BCDD93 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0700; + LastSwiftUpdateCheck = 0730; LastUpgradeCheck = 0700; ORGANIZATIONNAME = "Christian Paul Dehli"; TargetAttributes = { - 89F60F6A1BC9580000BCDD93 = { - CreatedOnToolsVersion = 7.0.1; + 89EADBB31CB87C23001130A8 = { + CreatedOnToolsVersion = 7.3; }; - 89F60F741BC9580000BCDD93 = { + 89F60F6A1BC9580000BCDD93 = { CreatedOnToolsVersion = 7.0.1; }; }; @@ -176,58 +176,82 @@ projectRoot = ""; targets = ( 89F60F6A1BC9580000BCDD93 /* TouchDraw */, - 89F60F741BC9580000BCDD93 /* TouchDrawTests */, + 89EADBB31CB87C23001130A8 /* TouchDrawTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 89F60F691BC9580000BCDD93 /* Resources */ = { + 89EADBB21CB87C23001130A8 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 89EADBC21CB87CBA001130A8 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 89F60F731BC9580000BCDD93 /* Resources */ = { + 89F60F691BC9580000BCDD93 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 89F70C181CA80BDB00133F03 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 89F60F661BC9580000BCDD93 /* Sources */ = { + 89EADBB01CB87C23001130A8 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 89DB172D1BC988E6005E947E /* TouchDrawView.swift in Sources */, + 89EADBC01CB87C3F001130A8 /* ViewController.swift in Sources */, + 89EADBB71CB87C23001130A8 /* TouchDrawTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 89F60F711BC9580000BCDD93 /* Sources */ = { + 89F60F661BC9580000BCDD93 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 89F70C161CA729BA00133F03 /* ViewController.swift in Sources */, - 89F60F7B1BC9580000BCDD93 /* TouchDrawTests.swift in Sources */, + 89DB172D1BC988E6005E947E /* TouchDrawView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 89F60F781BC9580000BCDD93 /* PBXTargetDependency */ = { + 89EADBBB1CB87C23001130A8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 89F60F6A1BC9580000BCDD93 /* TouchDraw */; - targetProxy = 89F60F771BC9580000BCDD93 /* PBXContainerItemProxy */; + targetProxy = 89EADBBA1CB87C23001130A8 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 89EADBBD1CB87C23001130A8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + INFOPLIST_FILE = TouchDrawTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.dehli.TouchDrawTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 89EADBBE1CB87C23001130A8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + INFOPLIST_FILE = TouchDrawTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.3; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = io.dehli.TouchDrawTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; 89F60F7D1BC9580000BCDD93 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -352,29 +376,17 @@ }; name = Release; }; - 89F60F831BC9580000BCDD93 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = TouchDrawTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = io.dehli.TouchDrawTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 89F60F841BC9580000BCDD93 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = TouchDrawTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = io.dehli.TouchDrawTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 89EADBBC1CB87C23001130A8 /* Build configuration list for PBXNativeTarget "TouchDrawTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 89EADBBD1CB87C23001130A8 /* Debug */, + 89EADBBE1CB87C23001130A8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; 89F60F651BC9580000BCDD93 /* Build configuration list for PBXProject "TouchDraw" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -393,15 +405,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 89F60F821BC9580000BCDD93 /* Build configuration list for PBXNativeTarget "TouchDrawTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 89F60F831BC9580000BCDD93 /* Debug */, - 89F60F841BC9580000BCDD93 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 89F60F621BC9580000BCDD93 /* Project object */; diff --git a/TouchDraw/TouchDrawView.swift b/TouchDraw/TouchDrawView.swift index d799f7b..3060917 100644 --- a/TouchDraw/TouchDrawView.swift +++ b/TouchDraw/TouchDrawView.swift @@ -58,6 +58,8 @@ internal class Stroke { /// A subclass of UIView which allows you to draw on the view using your fingers public class TouchDrawView: UIView { + + private var touchDrawUndoManager: NSUndoManager! /// must be set in whichever class is using the TouchDrawView public var delegate: TouchDrawViewDelegate! @@ -97,6 +99,11 @@ public class TouchDrawView: UIView { addSubview(mainImageView) addSubview(tempImageView) stack = [] + + touchDrawUndoManager = undoManager + if touchDrawUndoManager == nil { + touchDrawUndoManager = NSUndoManager() + } } /// sets the frames of the subviews @@ -121,7 +128,7 @@ public class TouchDrawView: UIView { let stroke = stack.last stack.popLast() redrawLinePathsInStack() - undoManager?.registerUndoWithTarget(self, selector: #selector(TouchDrawView.pushDrawing(_:)), object: stroke) + touchDrawUndoManager!.registerUndoWithTarget(self, selector: #selector(TouchDrawView.pushDrawing(_:)), object: stroke) } /// adds a new stroke to the stack @@ -129,7 +136,7 @@ public class TouchDrawView: UIView { let stroke = object as? Stroke stack.append(stroke!) drawLine(stroke!) - undoManager?.registerUndoWithTarget(self, selector: #selector(TouchDrawView.popDrawing), object: nil) + touchDrawUndoManager!.registerUndoWithTarget(self, selector: #selector(TouchDrawView.popDrawing), object: nil) } /// draws all the lines in the stack @@ -204,12 +211,12 @@ public class TouchDrawView: UIView { /// clears the drawing public func clearDrawing() -> Void { internalClear() - undoManager?.registerUndoWithTarget(self, selector: #selector(TouchDrawView.pushAll(_:)), object: stack) + touchDrawUndoManager!.registerUndoWithTarget(self, selector: #selector(TouchDrawView.pushAll(_:)), object: stack) stack = [] checkClearState() - if !undoManager!.canRedo { + if !touchDrawUndoManager!.canRedo { if redoEnabled { delegate.redoDisabled() redoEnabled = false @@ -224,7 +231,7 @@ public class TouchDrawView: UIView { drawLine(stroke) stack.append(stroke) } - undoManager?.registerUndoWithTarget(self, selector: #selector(TouchDrawView.clearDrawing), object: nil) + touchDrawUndoManager!.registerUndoWithTarget(self, selector: #selector(TouchDrawView.clearDrawing), object: nil) } /// sets the brush's color @@ -250,15 +257,15 @@ public class TouchDrawView: UIView { /// if possible, it will undo the last stroke public func undo() -> Void { - if undoManager!.canUndo { - undoManager?.undo() + if touchDrawUndoManager!.canUndo { + touchDrawUndoManager!.undo() if !redoEnabled { delegate.redoEnabled() redoEnabled = true } - if !undoManager!.canUndo { + if !touchDrawUndoManager!.canUndo { if undoEnabled { delegate.undoDisabled() undoEnabled = false @@ -271,15 +278,15 @@ public class TouchDrawView: UIView { /// if possible, it will redo the last undone stroke public func redo() -> Void { - if undoManager!.canRedo { - undoManager?.redo() + if touchDrawUndoManager!.canRedo { + touchDrawUndoManager!.redo() if !undoEnabled { delegate.undoEnabled() undoEnabled = true } - if !undoManager!.canRedo { + if !touchDrawUndoManager!.canRedo { if redoEnabled { delegate.redoDisabled() redoEnabled = false @@ -329,7 +336,7 @@ public class TouchDrawView: UIView { stack.append(stroke) - undoManager?.registerUndoWithTarget(self, selector: #selector(TouchDrawView.popDrawing), object: nil) + touchDrawUndoManager!.registerUndoWithTarget(self, selector: #selector(TouchDrawView.popDrawing), object: nil) if !undoEnabled { delegate.undoEnabled() diff --git a/TouchDrawTests/Main.storyboard b/TouchDrawTests/Main.storyboard index bb3d5ea..d3ad2af 100644 --- a/TouchDrawTests/Main.storyboard +++ b/TouchDrawTests/Main.storyboard @@ -1,26 +1,27 @@ - + + - + - + - - + + - + - + - + diff --git a/TouchDrawTests/TouchDrawTests.swift b/TouchDrawTests/TouchDrawTests.swift index b71f1f9..aafb5c5 100644 --- a/TouchDrawTests/TouchDrawTests.swift +++ b/TouchDrawTests/TouchDrawTests.swift @@ -15,14 +15,12 @@ class TouchDrawTests: XCTestCase { override func setUp() { super.setUp() - + // Put setup code here. This method is called before the invocation of each test method in the class. let storyboard = UIStoryboard(name: "Main", bundle: NSBundle(forClass: self.dynamicType)) viewController = storyboard.instantiateInitialViewController() as! ViewController - - UIApplication.sharedApplication().keyWindow!.rootViewController = viewController - + // Test and Load the View at the Same Time! XCTAssertNotNil(viewController.view) } @@ -40,14 +38,14 @@ class TouchDrawTests: XCTestCase { viewController.touchDrawView.touchesBegan(touches, withEvent: nil) viewController.touchDrawView.touchesEnded(touches, withEvent: nil) - XCTAssertTrue(viewController.undoIsEnabled, "Undo should be enabled") + XCTAssertTrue(viewController.undoIsEnabled, "Undo should be enabled") } /// Tests whether you clearing empties the strokes func testClearing() { var touches = Set() touches.insert(UITouch()) - + viewController.touchDrawView.touchesBegan(touches, withEvent: nil) viewController.touchDrawView.touchesEnded(touches, withEvent: nil) From e14792be1430c42b6b5cc683ffaed378deedc061 Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Fri, 8 Apr 2016 20:29:02 -0400 Subject: [PATCH 4/8] Added an additional test. --- TouchDrawTests/TouchDrawTests.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/TouchDrawTests/TouchDrawTests.swift b/TouchDrawTests/TouchDrawTests.swift index aafb5c5..64914f3 100644 --- a/TouchDrawTests/TouchDrawTests.swift +++ b/TouchDrawTests/TouchDrawTests.swift @@ -30,7 +30,7 @@ class TouchDrawTests: XCTestCase { super.tearDown() } - /// Tests whether the TouchDrawView enables undoing after one point is drawn + /// Tests whether TouchDrawView enables undo after one point is drawn func testEnableUndo() { var touches = Set() touches.insert(UITouch()) @@ -67,4 +67,16 @@ class TouchDrawTests: XCTestCase { XCTAssert(viewController.touchDrawView.stack.count == 0, "Should not have any strokes") } + /// Tests whether TouchDrawView enables redo after undoing a point + func testEnableRedo() { + var touches = Set() + touches.insert(UITouch()) + + viewController.touchDrawView.touchesBegan(touches, withEvent: nil) + viewController.touchDrawView.touchesEnded(touches, withEvent: nil) + + viewController.touchDrawView.undo() + XCTAssertTrue(viewController.redoIsEnabled, "Redo should be enabled") + } + } From 5f1086e8d92363fa1458c103413e4769a33f3139 Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Fri, 8 Apr 2016 20:42:28 -0400 Subject: [PATCH 5/8] Cleaned up the testing logic (removed storyboard and ViewController). Added two more tests. --- TouchDraw.xcodeproj/project.pbxproj | 9 +-- TouchDrawTests/Main.storyboard | 27 ------- TouchDrawTests/TouchDrawTests.swift | 110 ++++++++++++++++++---------- TouchDrawTests/ViewController.swift | 55 -------------- 4 files changed, 71 insertions(+), 130 deletions(-) delete mode 100644 TouchDrawTests/Main.storyboard delete mode 100644 TouchDrawTests/ViewController.swift diff --git a/TouchDraw.xcodeproj/project.pbxproj b/TouchDraw.xcodeproj/project.pbxproj index fc82987..775dfb7 100644 --- a/TouchDraw.xcodeproj/project.pbxproj +++ b/TouchDraw.xcodeproj/project.pbxproj @@ -10,8 +10,6 @@ 89DB172D1BC988E6005E947E /* TouchDrawView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89DB172C1BC988E6005E947E /* TouchDrawView.swift */; }; 89EADBB71CB87C23001130A8 /* TouchDrawTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EADBB61CB87C23001130A8 /* TouchDrawTests.swift */; }; 89EADBB91CB87C23001130A8 /* TouchDraw.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 89F60F6B1BC9580000BCDD93 /* TouchDraw.framework */; }; - 89EADBC01CB87C3F001130A8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89EADBBF1CB87C3F001130A8 /* ViewController.swift */; }; - 89EADBC21CB87CBA001130A8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89EADBC11CB87CBA001130A8 /* Main.storyboard */; }; 89F60F6F1BC9580000BCDD93 /* TouchDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = 89F60F6E1BC9580000BCDD93 /* TouchDraw.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ @@ -30,8 +28,6 @@ 89EADBB41CB87C23001130A8 /* TouchDrawTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TouchDrawTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 89EADBB61CB87C23001130A8 /* TouchDrawTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchDrawTests.swift; sourceTree = ""; }; 89EADBB81CB87C23001130A8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 89EADBBF1CB87C3F001130A8 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 89EADBC11CB87CBA001130A8 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 89F60F6B1BC9580000BCDD93 /* TouchDraw.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TouchDraw.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 89F60F6E1BC9580000BCDD93 /* TouchDraw.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TouchDraw.h; sourceTree = ""; }; 89F60F701BC9580000BCDD93 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -61,8 +57,6 @@ children = ( 89EADBB61CB87C23001130A8 /* TouchDrawTests.swift */, 89EADBB81CB87C23001130A8 /* Info.plist */, - 89EADBBF1CB87C3F001130A8 /* ViewController.swift */, - 89EADBC11CB87CBA001130A8 /* Main.storyboard */, ); path = TouchDrawTests; sourceTree = ""; @@ -186,7 +180,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 89EADBC21CB87CBA001130A8 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -204,7 +197,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 89EADBC01CB87C3F001130A8 /* ViewController.swift in Sources */, 89EADBB71CB87C23001130A8 /* TouchDrawTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -386,6 +378,7 @@ 89EADBBE1CB87C23001130A8 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; 89F60F651BC9580000BCDD93 /* Build configuration list for PBXProject "TouchDraw" */ = { isa = XCConfigurationList; diff --git a/TouchDrawTests/Main.storyboard b/TouchDrawTests/Main.storyboard deleted file mode 100644 index d3ad2af..0000000 --- a/TouchDrawTests/Main.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/TouchDrawTests/TouchDrawTests.swift b/TouchDrawTests/TouchDrawTests.swift index 64914f3..79f299a 100644 --- a/TouchDrawTests/TouchDrawTests.swift +++ b/TouchDrawTests/TouchDrawTests.swift @@ -9,20 +9,23 @@ import XCTest @testable import TouchDraw -class TouchDrawTests: XCTestCase { +class TouchDrawTests: XCTestCase, TouchDrawViewDelegate { - var viewController: ViewController! + var undoIsEnabled: Bool! + var redoIsEnabled: Bool! + var clearIsEnabled: Bool! + + var touchDrawView: TouchDrawView! override func setUp() { super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - let storyboard = UIStoryboard(name: "Main", bundle: NSBundle(forClass: self.dynamicType)) + undoIsEnabled = false + redoIsEnabled = false + clearIsEnabled = false - viewController = storyboard.instantiateInitialViewController() as! ViewController - - // Test and Load the View at the Same Time! - XCTAssertNotNil(viewController.view) + touchDrawView = TouchDrawView() + touchDrawView.delegate = self } override func tearDown() { @@ -32,51 +35,78 @@ class TouchDrawTests: XCTestCase { /// Tests whether TouchDrawView enables undo after one point is drawn func testEnableUndo() { - var touches = Set() - touches.insert(UITouch()) - - viewController.touchDrawView.touchesBegan(touches, withEvent: nil) - viewController.touchDrawView.touchesEnded(touches, withEvent: nil) - - XCTAssertTrue(viewController.undoIsEnabled, "Undo should be enabled") + simulateTouch() + XCTAssertTrue(undoIsEnabled, "Undo should be enabled") } - /// Tests whether you clearing empties the strokes + /// Tests whether clearing empties the strokes func testClearing() { - var touches = Set() - touches.insert(UITouch()) - - viewController.touchDrawView.touchesBegan(touches, withEvent: nil) - viewController.touchDrawView.touchesEnded(touches, withEvent: nil) - - XCTAssert(viewController.touchDrawView.stack.count > 0, "Should have strokes on view") - viewController.touchDrawView.clearDrawing() - XCTAssert(viewController.touchDrawView.stack.count == 0, "Should not have strokes on view") + simulateTouch() + XCTAssert(touchDrawView.stack.count > 0, "Should have strokes on view") + touchDrawView.clearDrawing() + XCTAssert(touchDrawView.stack.count == 0, "Should not have strokes on view") + } + + /// Tests to make sure clear is enabled after you make a stroke + func testClearEnabled() { + simulateTouch() + XCTAssertTrue(clearIsEnabled, "Clear should be enabled after a stroke") + } + + /// Tests to make sure clear is diabled after calling clearDrawing() + func testClearDisabled() { + simulateTouch() + touchDrawView.clearDrawing() + XCTAssertFalse(clearIsEnabled, "Clear should not be enabled after calling clearDrawing()") } /// Tests undoing functionality func testUndo() { - var touches = Set() - touches.insert(UITouch()) - - viewController.touchDrawView.touchesBegan(touches, withEvent: nil) - viewController.touchDrawView.touchesEnded(touches, withEvent: nil) - - XCTAssert(viewController.touchDrawView.stack.count == 1, "Should have one stroke") - viewController.touchDrawView.undo() - XCTAssert(viewController.touchDrawView.stack.count == 0, "Should not have any strokes") + simulateTouch() + XCTAssert(touchDrawView.stack.count == 1, "Should have one stroke") + touchDrawView.undo() + XCTAssert(touchDrawView.stack.count == 0, "Should not have any strokes") } /// Tests whether TouchDrawView enables redo after undoing a point func testEnableRedo() { + simulateTouch() + touchDrawView.undo() + XCTAssertTrue(redoIsEnabled, "Redo should be enabled") + } + + /// Internal function used to simulate a touch + private func simulateTouch() { var touches = Set() touches.insert(UITouch()) - - viewController.touchDrawView.touchesBegan(touches, withEvent: nil) - viewController.touchDrawView.touchesEnded(touches, withEvent: nil) - - viewController.touchDrawView.undo() - XCTAssertTrue(viewController.redoIsEnabled, "Redo should be enabled") + touchDrawView.touchesBegan(touches, withEvent: nil) + touchDrawView.touchesEnded(touches, withEvent: nil) + } + + // MARK: - TouchDrawViewDelegate + + func undoEnabled() { + self.undoIsEnabled = true + } + + func undoDisabled() { + self.undoIsEnabled = false + } + + func redoEnabled() { + self.redoIsEnabled = true + } + + func redoDisabled() { + self.redoIsEnabled = false + } + + func clearEnabled() { + self.clearIsEnabled = true + } + + func clearDisabled() { + self.clearIsEnabled = false } } diff --git a/TouchDrawTests/ViewController.swift b/TouchDrawTests/ViewController.swift deleted file mode 100644 index 10a6d10..0000000 --- a/TouchDrawTests/ViewController.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// ViewController.swift -// TouchDraw -// -// Created by Christian Paul Dehli on 3/26/16. -// Copyright © 2016 Christian Paul Dehli. All rights reserved. -// - -@testable import TouchDraw - -class ViewController: UIViewController, TouchDrawViewDelegate { - - internal var undoIsEnabled: Bool! - internal var redoIsEnabled: Bool! - internal var clearIsEnabled: Bool! - - internal var touchDrawView: TouchDrawView! - - override func viewDidLoad() { - super.viewDidLoad() - - self.undoIsEnabled = false - self.redoIsEnabled = false - self.clearIsEnabled = false - - touchDrawView = self.view as! TouchDrawView - touchDrawView.delegate = self - } - - // MARK: - TouchDrawViewDelegate - - func undoEnabled() { - self.undoIsEnabled = true - } - - func undoDisabled() { - self.undoIsEnabled = false - } - - func redoEnabled() { - self.redoIsEnabled = true - } - - func redoDisabled() { - self.redoIsEnabled = false - } - - func clearEnabled() { - self.clearIsEnabled = true - } - - func clearDisabled() { - self.clearIsEnabled = false - } -} \ No newline at end of file From e465e719826e4f9739def8bf8263f839f08dad1a Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Fri, 8 Apr 2016 20:47:51 -0400 Subject: [PATCH 6/8] Added a few more tests that were missing. --- TouchDrawTests/TouchDrawTests.swift | 45 ++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/TouchDrawTests/TouchDrawTests.swift b/TouchDrawTests/TouchDrawTests.swift index 79f299a..57e24ca 100644 --- a/TouchDrawTests/TouchDrawTests.swift +++ b/TouchDrawTests/TouchDrawTests.swift @@ -33,14 +33,8 @@ class TouchDrawTests: XCTestCase, TouchDrawViewDelegate { super.tearDown() } - /// Tests whether TouchDrawView enables undo after one point is drawn - func testEnableUndo() { - simulateTouch() - XCTAssertTrue(undoIsEnabled, "Undo should be enabled") - } - - /// Tests whether clearing empties the strokes - func testClearing() { + /// Tests whether clear empties the strokes + func testClear() { simulateTouch() XCTAssert(touchDrawView.stack.count > 0, "Should have strokes on view") touchDrawView.clearDrawing() @@ -60,7 +54,7 @@ class TouchDrawTests: XCTestCase, TouchDrawViewDelegate { XCTAssertFalse(clearIsEnabled, "Clear should not be enabled after calling clearDrawing()") } - /// Tests undoing functionality + /// Tests undo functionality func testUndo() { simulateTouch() XCTAssert(touchDrawView.stack.count == 1, "Should have one stroke") @@ -68,13 +62,44 @@ class TouchDrawTests: XCTestCase, TouchDrawViewDelegate { XCTAssert(touchDrawView.stack.count == 0, "Should not have any strokes") } + /// Tests whether TouchDrawView enables undo after one point is drawn + func testUndoEnabled() { + simulateTouch() + XCTAssertTrue(undoIsEnabled, "Undo should be enabled") + } + + /// Tests whether TouchDrawView enables undo after one point is drawn + func testUndoDisabled() { + simulateTouch() + touchDrawView.undo() + XCTAssertFalse(undoIsEnabled, "Undo should not be enabled") + } + + /// Tests redo functionality + func testRedo() { + simulateTouch() + XCTAssert(touchDrawView.stack.count == 1, "Should have one stroke") + touchDrawView.undo() + XCTAssert(touchDrawView.stack.count == 0, "Should not have any strokes") + touchDrawView.redo() + XCTAssert(touchDrawView.stack.count == 1, "Should have one stroke") + } + /// Tests whether TouchDrawView enables redo after undoing a point - func testEnableRedo() { + func testRedoEnabled() { simulateTouch() touchDrawView.undo() XCTAssertTrue(redoIsEnabled, "Redo should be enabled") } + /// Tests whether TouchDrawView disables redo when no more redos are available + func testRedoDisabled() { + simulateTouch() + touchDrawView.undo() // Redo is now enabled (covered in another test) + touchDrawView.redo() + XCTAssertFalse(redoIsEnabled, "Redo should not be enabled") + } + /// Internal function used to simulate a touch private func simulateTouch() { var touches = Set() From 184dd06432a5161640548932bda8a1316fbd62bc Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Fri, 8 Apr 2016 20:50:37 -0400 Subject: [PATCH 7/8] Deleted tests from TouchDrawDemo. --- Demo/TouchDrawDemo.xcodeproj/project.pbxproj | 131 ------------------ Demo/TouchDrawDemoTests/Info.plist | 24 ---- .../TouchDrawDemoTests.swift | 35 ----- 3 files changed, 190 deletions(-) delete mode 100644 Demo/TouchDrawDemoTests/Info.plist delete mode 100644 Demo/TouchDrawDemoTests/TouchDrawDemoTests.swift diff --git a/Demo/TouchDrawDemo.xcodeproj/project.pbxproj b/Demo/TouchDrawDemo.xcodeproj/project.pbxproj index 9f2260a..8550ec8 100644 --- a/Demo/TouchDrawDemo.xcodeproj/project.pbxproj +++ b/Demo/TouchDrawDemo.xcodeproj/project.pbxproj @@ -13,19 +13,8 @@ EE43D4781A14A6F200311C06 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE43D4761A14A6F200311C06 /* Main.storyboard */; }; EE43D47A1A14A6F200311C06 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EE43D4791A14A6F200311C06 /* Images.xcassets */; }; EE43D47D1A14A6F200311C06 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = EE43D47B1A14A6F200311C06 /* LaunchScreen.xib */; }; - EE43D4891A14A6F200311C06 /* TouchDrawDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE43D4881A14A6F200311C06 /* TouchDrawDemoTests.swift */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - EE43D4831A14A6F200311C06 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = EE43D4651A14A6F200311C06 /* Project object */; - proxyType = 1; - remoteGlobalIDString = EE43D46C1A14A6F200311C06; - remoteInfo = TouchDrawDemo; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ A093867C58B2C460504D298A /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D0CED83AB5650AA7BC4770C2 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; @@ -37,9 +26,6 @@ EE43D4771A14A6F200311C06 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; EE43D4791A14A6F200311C06 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; EE43D47C1A14A6F200311C06 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - EE43D4821A14A6F200311C06 /* TouchDrawDemo.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TouchDrawDemo.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - EE43D4871A14A6F200311C06 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - EE43D4881A14A6F200311C06 /* TouchDrawDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchDrawDemoTests.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -51,13 +37,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - EE43D47F1A14A6F200311C06 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -90,7 +69,6 @@ isa = PBXGroup; children = ( EE43D46F1A14A6F200311C06 /* TouchDrawDemo */, - EE43D4851A14A6F200311C06 /* TouchDrawDemoTests */, EE43D46E1A14A6F200311C06 /* Products */, 5C43080F56C56385ECE95311 /* Pods */, B90ADA956422C12ACFECF533 /* Frameworks */, @@ -101,7 +79,6 @@ isa = PBXGroup; children = ( EE43D46D1A14A6F200311C06 /* TouchDrawDemo.app */, - EE43D4821A14A6F200311C06 /* TouchDrawDemo.xctest */, ); name = Products; sourceTree = ""; @@ -127,23 +104,6 @@ name = "Supporting Files"; sourceTree = ""; }; - EE43D4851A14A6F200311C06 /* TouchDrawDemoTests */ = { - isa = PBXGroup; - children = ( - EE43D4881A14A6F200311C06 /* TouchDrawDemoTests.swift */, - EE43D4861A14A6F200311C06 /* Supporting Files */, - ); - path = TouchDrawDemoTests; - sourceTree = ""; - }; - EE43D4861A14A6F200311C06 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - EE43D4871A14A6F200311C06 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -167,24 +127,6 @@ productReference = EE43D46D1A14A6F200311C06 /* TouchDrawDemo.app */; productType = "com.apple.product-type.application"; }; - EE43D4811A14A6F200311C06 /* TouchDrawDemoTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = EE43D48F1A14A6F200311C06 /* Build configuration list for PBXNativeTarget "TouchDrawDemoTests" */; - buildPhases = ( - EE43D47E1A14A6F200311C06 /* Sources */, - EE43D47F1A14A6F200311C06 /* Frameworks */, - EE43D4801A14A6F200311C06 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - EE43D4841A14A6F200311C06 /* PBXTargetDependency */, - ); - name = TouchDrawDemoTests; - productName = TouchDrawDemoTests; - productReference = EE43D4821A14A6F200311C06 /* TouchDrawDemo.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -198,10 +140,6 @@ EE43D46C1A14A6F200311C06 = { CreatedOnToolsVersion = 6.1; }; - EE43D4811A14A6F200311C06 = { - CreatedOnToolsVersion = 6.1; - TestTargetID = EE43D46C1A14A6F200311C06; - }; }; }; buildConfigurationList = EE43D4681A14A6F200311C06 /* Build configuration list for PBXProject "TouchDrawDemo" */; @@ -218,7 +156,6 @@ projectRoot = ""; targets = ( EE43D46C1A14A6F200311C06 /* TouchDrawDemo */, - EE43D4811A14A6F200311C06 /* TouchDrawDemoTests */, ); }; /* End PBXProject section */ @@ -234,13 +171,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - EE43D4801A14A6F200311C06 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -301,24 +231,8 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - EE43D47E1A14A6F200311C06 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - EE43D4891A14A6F200311C06 /* TouchDrawDemoTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - EE43D4841A14A6F200311C06 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = EE43D46C1A14A6F200311C06 /* TouchDrawDemo */; - targetProxy = EE43D4831A14A6F200311C06 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ EE43D4761A14A6F200311C06 /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -441,42 +355,6 @@ }; name = Release; }; - EE43D4901A14A6F200311C06 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = TouchDrawDemoTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.razeware.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = TouchDrawDemo; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TouchDrawDemo.app/TouchDrawDemo"; - }; - name = Debug; - }; - EE43D4911A14A6F200311C06 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = TouchDrawDemoTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.razeware.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = TouchDrawDemo; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TouchDrawDemo.app/TouchDrawDemo"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -498,15 +376,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - EE43D48F1A14A6F200311C06 /* Build configuration list for PBXNativeTarget "TouchDrawDemoTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - EE43D4901A14A6F200311C06 /* Debug */, - EE43D4911A14A6F200311C06 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = EE43D4651A14A6F200311C06 /* Project object */; diff --git a/Demo/TouchDrawDemoTests/Info.plist b/Demo/TouchDrawDemoTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/Demo/TouchDrawDemoTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Demo/TouchDrawDemoTests/TouchDrawDemoTests.swift b/Demo/TouchDrawDemoTests/TouchDrawDemoTests.swift deleted file mode 100644 index 373a7b3..0000000 --- a/Demo/TouchDrawDemoTests/TouchDrawDemoTests.swift +++ /dev/null @@ -1,35 +0,0 @@ -// -// TouchDrawDemoTests.swift -// TouchDrawDemoTests -// -// Created by Christian Paul Dehli on 10/12/15. -// - -import UIKit -import XCTest - -class TouchDrawDemoTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - XCTAssert(true, "Pass") - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measureBlock() { - // Put the code you want to measure the time of here. - } - } - -} From cefedcf41ddb8a2097d4d3f7589545b52d74353c Mon Sep 17 00:00:00 2001 From: Christian Paul Dehli Date: Fri, 8 Apr 2016 20:53:33 -0400 Subject: [PATCH 8/8] Bumped to version 1.2.3 --- CHANGELOG.md | 5 +++++ Demo/TouchDrawDemo/Info.plist | 2 +- TouchDraw.podspec | 2 +- TouchDraw/Info.plist | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9a94a..d55c0fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.2.3 + +- Added a handful of tests +- Updated `README.md` + # 1.2.2 - Switched project settings to recommended settings diff --git a/Demo/TouchDrawDemo/Info.plist b/Demo/TouchDrawDemo/Info.plist index 93bb9e8..f385f01 100644 --- a/Demo/TouchDrawDemo/Info.plist +++ b/Demo/TouchDrawDemo/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2.2 + 1.2.3 CFBundleSignature ???? CFBundleVersion diff --git a/TouchDraw.podspec b/TouchDraw.podspec index afe784d..f96d656 100644 --- a/TouchDraw.podspec +++ b/TouchDraw.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.name = "TouchDraw" - s.version = "1.2.2" + s.version = "1.2.3" s.summary = "TouchDraw is a UIView you can draw on." s.description = <<-DESC diff --git a/TouchDraw/Info.plist b/TouchDraw/Info.plist index 0eb186c..6b6e806 100644 --- a/TouchDraw/Info.plist +++ b/TouchDraw/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.2.2 + 1.2.3 CFBundleSignature ???? CFBundleVersion