Skip to content

Commit

Permalink
Merge pull request #476 from IBAnimatable/testing/rotation-designable
Browse files Browse the repository at this point in the history
Add tests for RotationDesignable #no-public-changes
  • Loading branch information
SD10 committed May 16, 2017
2 parents eb6174b + 81df3d6 commit 85a85bb
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 1 deletion.
4 changes: 4 additions & 0 deletions IBAnimatable.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
B062C7671E94D13B006C3CB8 /* SystemTransitionAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B062C7661E94D13B006C3CB8 /* SystemTransitionAnimator.swift */; };
B0B332411ECA7FF400928CB4 /* AnimatableSliderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B332401ECA7FF400928CB4 /* AnimatableSliderTests.swift */; };
B0B332431ECA81A800928CB4 /* SliderImagesDesignableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B332421ECA81A800928CB4 /* SliderImagesDesignableTests.swift */; };
B0B332451ECA880A00928CB4 /* RotationDesignableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0B332441ECA880A00928CB4 /* RotationDesignableTests.swift */; };
B0FF353E1EC6916A005C5F62 /* CornerDesignableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0FF353D1EC6916A005C5F62 /* CornerDesignableTests.swift */; };
B0FF35431EC6968F005C5F62 /* AnimatableViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0FF35421EC6968F005C5F62 /* AnimatableViewTests.swift */; };
B0FF35451EC6A5F5005C5F62 /* AnimatableScrollViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0FF35441EC6A5F5005C5F62 /* AnimatableScrollViewTests.swift */; };
Expand Down Expand Up @@ -346,6 +347,7 @@
B062C7661E94D13B006C3CB8 /* SystemTransitionAnimator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemTransitionAnimator.swift; sourceTree = "<group>"; };
B0B332401ECA7FF400928CB4 /* AnimatableSliderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableSliderTests.swift; sourceTree = "<group>"; };
B0B332421ECA81A800928CB4 /* SliderImagesDesignableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderImagesDesignableTests.swift; sourceTree = "<group>"; };
B0B332441ECA880A00928CB4 /* RotationDesignableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RotationDesignableTests.swift; sourceTree = "<group>"; };
B0FF353D1EC6916A005C5F62 /* CornerDesignableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CornerDesignableTests.swift; sourceTree = "<group>"; };
B0FF35421EC6968F005C5F62 /* AnimatableViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableViewTests.swift; sourceTree = "<group>"; };
B0FF35441EC6A5F5005C5F62 /* AnimatableScrollViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableScrollViewTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -838,6 +840,7 @@
B0FF353D1EC6916A005C5F62 /* CornerDesignableTests.swift */,
B0FF35491EC6A8D3005C5F62 /* FillDesignableTests.swift */,
B0B332421ECA81A800928CB4 /* SliderImagesDesignableTests.swift */,
B0B332441ECA880A00928CB4 /* RotationDesignableTests.swift */,
);
name = TestProtocols;
sourceTree = "<group>";
Expand Down Expand Up @@ -1371,6 +1374,7 @@
buildActionMask = 2147483647;
files = (
B0FF35531EC6B024005C5F62 /* AnimatableCheckBoxTests.swift in Sources */,
B0B332451ECA880A00928CB4 /* RotationDesignableTests.swift in Sources */,
B0FF353E1EC6916A005C5F62 /* CornerDesignableTests.swift in Sources */,
B0FF355F1EC6B57D005C5F62 /* AnimatableCollectionViewCellTests.swift in Sources */,
B0FF35611EC6B65D005C5F62 /* AnimatableTextFieldTests.swift in Sources */,
Expand Down
10 changes: 10 additions & 0 deletions IBAnimatableTests/AnimatableImageViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ extension AnimatableImageViewTests: FillDesignableTests {
}

}

// MARK: - RotationDesignable Tests

extension AnimatableImageViewTests: RotationDesignableTests {

func testRotate() {
_testRotate(animatableImageView)
}

}
10 changes: 10 additions & 0 deletions IBAnimatableTests/AnimatableLabelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ extension AnimatableLabelTests: FillDesignableTests {
}

}

// MARK: - RotationDesignable Tests

extension AnimatableLabelTests: RotationDesignableTests {

func testRotate() {
_testRotate(animatableLabel)
}

}
10 changes: 10 additions & 0 deletions IBAnimatableTests/AnimatableScrollViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ extension AnimatableScrollViewTests: FillDesignableTests {
}

}

// MARK: - RotationDesignable Tests

extension AnimatableScrollViewTests: RotationDesignableTests {

func testRotate() {
_testRotate(animatableScrollView)
}

}
12 changes: 11 additions & 1 deletion IBAnimatableTests/AnimatableSliderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class AnimatableSliderTests: XCTestCase {

}

// MARK: - AnimatableSlider Tests
// MARK: - SliderImagesDesignable Tests

extension AnimatableSliderTests: SliderImagesDesignableTests {

Expand Down Expand Up @@ -53,3 +53,13 @@ extension AnimatableSliderTests: SliderImagesDesignableTests {
}

}

// MARK: - RotationDesignable Tests

extension AnimatableSliderTests: RotationDesignableTests {

func testRotate() {
_testRotate(animatableSlider)
}

}
10 changes: 10 additions & 0 deletions IBAnimatableTests/AnimatableStackViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ extension AnimatableStackViewTests: FillDesignableTests {
}

}

// MARK: - RotationDesignable Tests

extension AnimatableStackViewTests: RotationDesignableTests {

func testRotate() {
_testRotate(animatableStackView)
}

}
10 changes: 10 additions & 0 deletions IBAnimatableTests/AnimatableViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ extension AnimatableViewTests: FillDesignableTests {
}

}

// MARK: - RotationDesignable Tests

extension AnimatableViewTests: RotationDesignableTests {

func testRotate() {
_testRotate(animatableView)
}

}
32 changes: 32 additions & 0 deletions IBAnimatableTests/RotationDesignableTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// RotationDesignableTests.swift
// IBAnimatable
//
// Created by Steven on 5/15/17.
// Copyright © 2017 IBAnimatable. All rights reserved.
//

import XCTest
@testable import IBAnimatable

protocol RotationDesignableTests {

func testRotate()

}

// MARK: - UIView Tests

extension RotationDesignableTests {

func _testRotate<E: UIView>(_ element: E) where E: RotationDesignable {
element.rotate = -360
XCTAssertEqual(element.transform, .identity)
element.rotate = 360
XCTAssertEqual(element.transform, .identity)
element.rotate = 90
let mockTransform = CGAffineTransform(rotationAngle: .pi * 90 / 180)
XCTAssertEqual(element.transform, mockTransform)
}

}

0 comments on commit 85a85bb

Please sign in to comment.