Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use non-zero size view in tests #333

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions Tests/LayoutTests/UIKit/UIView+AutoLayoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ final class UIViewAutoLayoutTests: XCTestCase {

// GIVEN

let view: UIView = .init()
let view: UIView = .init(frame: CGRect(x: 0, y: 0, width: 10, height: 20))

// WHEN

Expand All @@ -173,9 +173,9 @@ final class UIViewAutoLayoutTests: XCTestCase {

expect(sizeConstraints1.count) == 2
expect(sizeConstraints1[0].firstAttribute) == .width
expect(sizeConstraints1[0].constant) == 0
expect(sizeConstraints1[0].constant) == 10
expect(sizeConstraints1[1].firstAttribute) == .height
expect(sizeConstraints1[1].constant) == 0
expect(sizeConstraints1[1].constant) == 20

// WHEN

Expand All @@ -196,13 +196,16 @@ final class UIViewAutoLayoutTests: XCTestCase {

// GIVEN

let view: UIView = .init()
let view: UIView = .init(frame: CGRect(x: 0, y: 0, width: 10, height: 20))

// WHEN

let widthConstraint1: NSLayoutConstraint = view.widthConstraint(is: .equal)

// THEN

expect(widthConstraint1.relation) == .equal
expect(widthConstraint1.constant) == 0
expect(widthConstraint1.constant) == 10

// GIVEN

Expand Down Expand Up @@ -237,13 +240,16 @@ final class UIViewAutoLayoutTests: XCTestCase {

// GIVEN

let view: UIView = .init()
let view: UIView = .init(frame: CGRect(x: 0, y: 0, width: 10, height: 20))

// WHEN

let widthConstraint1: NSLayoutConstraint = view.widthConstraint()

// THEN

expect(widthConstraint1.relation) == .equal
expect(widthConstraint1.constant) == 0
expect(widthConstraint1.constant) == 10

// GIVEN

Expand All @@ -264,7 +270,7 @@ final class UIViewAutoLayoutTests: XCTestCase {

// GIVEN

let view: UIView = .init()
let view: UIView = .init(frame: CGRect(x: 0, y: 0, width: 10, height: 20))

// WHEN

Expand All @@ -273,7 +279,7 @@ final class UIViewAutoLayoutTests: XCTestCase {
// THEN

expect(heightConstraint1.relation) == .equal
expect(heightConstraint1.constant) == 0
expect(heightConstraint1.constant) == 20

// GIVEN

Expand Down Expand Up @@ -308,13 +314,16 @@ final class UIViewAutoLayoutTests: XCTestCase {

// GIVEN

let view: UIView = .init()
let view: UIView = .init(frame: CGRect(x: 0, y: 0, width: 10, height: 20))

// WHEN

let heightConstraint1: NSLayoutConstraint = view.heightConstraint()

// THEN

expect(heightConstraint1.relation) == .equal
expect(heightConstraint1.constant) == 0
expect(heightConstraint1.constant) == 20

// GIVEN

Expand Down
Loading