-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fabf99
commit 7df5437
Showing
13 changed files
with
216 additions
and
82 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
57 changes: 37 additions & 20 deletions
57
...DelegateFlowLayout/BaseCollectionViewAdapterUICollectionViewDelegateFlowLayoutTests.swift
Large diffs are not rendered by default.
Oops, something went wrong.
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
10 changes: 10 additions & 0 deletions
10
SectionKit/Tests/SectionController/BaseFlowLayoutSectionControllerTests.swift
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,10 @@ | ||
import SectionKit | ||
import XCTest | ||
|
||
internal final class BaseFlowLayoutSectionControllerTests: XCTestCase { | ||
@MainActor | ||
internal func testFlowDelegateIsSelf() { | ||
let sectionController = BaseFlowLayoutSectionController() | ||
XCTAssert(sectionController.flowDelegate === sectionController) | ||
} | ||
} |
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
43 changes: 23 additions & 20 deletions
43
SectionKit/Tests/SectionController/ProtocolDefaultValuesSectionControllerTests.swift
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 |
---|---|---|
@@ -1,42 +1,45 @@ | ||
import SectionKit | ||
import XCTest | ||
|
||
@MainActor | ||
internal final class ProtocolDefaultValuesSectionControllerTests: XCTestCase { | ||
private func createSectionController() -> SectionController { | ||
final class ProtocolDefaultValuesSectionControllerTests: XCTestCase { | ||
private var sut: SectionController! | ||
|
||
@MainActor | ||
override func setUp() { | ||
super.setUp() | ||
class DefaultSectionController: SectionController { | ||
var context: CollectionViewContext? | ||
var dataSource: SectionDataSource = MockSectionDataSource() | ||
func didUpdate(model: Any) { } | ||
} | ||
return DefaultSectionController() | ||
sut = DefaultSectionController() | ||
} | ||
|
||
@available(iOS 10.0, *) | ||
internal func testDataSourcePrefetchingDelegateIsNil() { | ||
let sectionController = createSectionController() | ||
XCTAssertNil(sectionController.dataSourcePrefetchingDelegate) | ||
override func tearDown() { | ||
sut = nil | ||
super.tearDown() | ||
} | ||
|
||
internal func testDelegateIsNil() { | ||
let sectionController = createSectionController() | ||
XCTAssertNil(sectionController.delegate) | ||
@MainActor | ||
@available(iOS 10.0, *) | ||
func testDataSourcePrefetchingDelegateIsNil() { | ||
XCTAssertNil(sut.dataSourcePrefetchingDelegate) | ||
} | ||
|
||
internal func testFlowDelegateIsNil() { | ||
let sectionController = createSectionController() | ||
XCTAssertNil(sectionController.flowDelegate) | ||
@MainActor | ||
func testDelegateIsNil() { | ||
XCTAssertNil(sut.delegate) | ||
} | ||
|
||
@MainActor | ||
@available(iOS 11.0, *) | ||
internal func testDragDelegateIsNil() { | ||
let sectionController = createSectionController() | ||
XCTAssertNil(sectionController.dragDelegate) | ||
func testDragDelegateIsNil() { | ||
XCTAssertNil(sut.dragDelegate) | ||
} | ||
|
||
@MainActor | ||
@available(iOS 11.0, *) | ||
internal func testDropDelegateIsNil() { | ||
let sectionController = createSectionController() | ||
XCTAssertNil(sectionController.dropDelegate) | ||
func testDropDelegateIsNil() { | ||
XCTAssertNil(sut.dropDelegate) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...Controller/SectionCompositionalLayout/BaseCompositionalLayoutSectionControllerTests.swift
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,24 @@ | ||
@testable import SectionKit | ||
import XCTest | ||
|
||
final class BaseCompositionalLayoutSectionControllerTests: XCTestCase { | ||
final class TestLayoutEnvironment: NSObject, NSCollectionLayoutEnvironment { | ||
final class TestLayoutContainer: NSObject, NSCollectionLayoutContainer { | ||
let contentSize: CGSize = .zero | ||
let effectiveContentSize: CGSize = .zero | ||
let contentInsets: NSDirectionalEdgeInsets = .zero | ||
let effectiveContentInsets: NSDirectionalEdgeInsets = .zero | ||
} | ||
let container: NSCollectionLayoutContainer = TestLayoutContainer() | ||
let traitCollection: UITraitCollection = .current | ||
} | ||
|
||
@MainActor | ||
func test_layout_isEmpty() { | ||
let sut = BaseCompositionalLayoutSectionController() | ||
let layoutSection = sut.layoutSection( | ||
layoutEnvironment: TestLayoutEnvironment() | ||
) | ||
XCTAssertEqual(layoutSection, .empty) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...troller/SectionFlowDelegate/BaseFlowLayoutSectionControllerSectionFlowDelegateTests.swift
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,9 @@ | ||
import SectionKit | ||
import XCTest | ||
|
||
internal final class BaseFlowLayoutSectionControllerSectionFlowDelegateTests: BaseFlowLayoutSectionFlowDelegateTests { | ||
@MainActor | ||
override func createSectionFlowDelegate() throws -> SectionFlowDelegate { | ||
BaseFlowLayoutSectionController() | ||
} | ||
} |
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
9 changes: 0 additions & 9 deletions
9
...SectionController/SectionFlowDelegate/BaseSectionControllerSectionFlowDelegateTests.swift
This file was deleted.
Oops, something went wrong.
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
10 changes: 10 additions & 0 deletions
10
SectionKit/Tests/TestUtilities/MockFlowLayoutSectionController.swift
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,10 @@ | ||
import SectionKit | ||
import XCTest | ||
|
||
final class MockFlowLayoutSectionController: MockSectionController, | ||
FlowLayoutSectionController { | ||
lazy var flowDelegate: SectionFlowDelegate? = { | ||
XCTFail("flow delegate is not set") | ||
return nil | ||
}() | ||
} |
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