-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Rightpoint/colejd/improve-inheritance-exp…
…erience Add full Stackable functionality for UIStackView derivatives
- Loading branch information
Showing
12 changed files
with
121 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: PackageTests | ||
|
||
on: | ||
push: | ||
branches: [ develop ] | ||
pull_request: | ||
branches: [ develop ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run tests | ||
run: xcodebuild test -scheme RPStackable -destination 'platform=iOS Simulator,name=iPhone 12' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// InheritanceTests.swift | ||
// | ||
// | ||
// Created by Jonathan Cole on 11/30/21. | ||
// | ||
|
||
import Stackable | ||
import XCTest | ||
|
||
class InheritingStackView: UIStackView {} | ||
|
||
/** | ||
In these tests, we make sure that classes inheriting from | ||
UIStackView also have full Stackable capabilities applied. | ||
*/ | ||
class InheritanceTests: XCTestCase { | ||
|
||
func testDerivingClassHasStackableAddMethod() { | ||
let stack = InheritingStackView() | ||
stack.stackable.add([ | ||
CGFloat(0), | ||
]) | ||
|
||
XCTAssert(true, "Passes if it compiles.") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// StackableTests.swift | ||
// | ||
// | ||
// Created by Jonathan Cole on 12/1/21. | ||
// | ||
|
||
@testable import Stackable | ||
import XCTest | ||
|
||
class StackableTests: XCTestCase { | ||
|
||
func testHairlineConfigLogic() { | ||
// Test Global config | ||
UIStackView.stackable.hairlineColor = .blue | ||
let stack1 = UIStackView() | ||
stack1.stackable.add([ | ||
UIStackView.stackable.hairline, | ||
]) | ||
let hairline1 = stack1.arrangedSubviews.first as! StackableHairlineView | ||
XCTAssert(hairline1.backgroundColor == .blue) | ||
|
||
// Test instance config | ||
let stack2 = UIStackView() | ||
stack2.stackable.hairlineColor = .brown | ||
stack2.stackable.add([ | ||
UIStackView.stackable.hairline, | ||
]) | ||
let hairline2 = stack2.arrangedSubviews.first as! StackableHairlineView | ||
XCTAssert(hairline2.backgroundColor == .brown) | ||
|
||
// Test per-hairline Config | ||
let stack3 = UIStackView() | ||
stack3.stackable.hairlineColor = .brown | ||
stack3.stackable.add([ | ||
UIStackView.stackable.hairline, | ||
UIStackView.stackable.hairline | ||
.color(.yellow), | ||
]) | ||
let hairline3 = stack3.arrangedSubviews.first as! StackableHairlineView | ||
XCTAssert(hairline3.backgroundColor == .brown) | ||
|
||
let hairline4 = stack3.arrangedSubviews.last as! StackableHairlineView | ||
XCTAssert(hairline4.backgroundColor == .yellow) | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.