Skip to content

Commit

Permalink
testView
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Oct 27, 2023
1 parent a861029 commit bb896ca
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Tests/CommonAppleKitTests/CommonAppleKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ private final class ControllerB: CAViewController { }

private final class CellA: CAListViewCell { }

private final class ViewA: CAView {
override init(frame: CARect) {
super.init(frame: frame)

addSubview(CALabel())
addSubview(CATextField())
#if canImport(AppKit)
layer?.backgroundColor = CAColor.red.cgColor
#elseif canImport(UIKit)
backgroundColor = CAColor.red
#endif
}

required init?(coder: NSCoder) {
nil
}
}

final class CommonAppleKitTests: XCTestCase {
func testButton() {
let button = CAButton()
Expand All @@ -38,6 +56,13 @@ final class CommonAppleKitTests: XCTestCase {
XCTAssertEqual(viewControllers, tabBarController.viewControllers)
}

func testView() {
let view = ViewA(frame: .zero)

XCTAssertTrue(view.subviews.contains { $0 is CALabel })
XCTAssertTrue(view.subviews.contains { $0 is CATextField })
}

func testCollectionView() {
let layout: CACollectionViewLayout = CACollectionViewFlowLayout()
let collectionView = CACollectionView(frame: .zero, collectionViewLayout: layout)
Expand Down

0 comments on commit bb896ca

Please sign in to comment.