Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tevelee committed Jun 26, 2024
1 parent c576def commit cc9a722
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions Tests/FlowTests/FlowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final class FlowTests: XCTestCase {
""")
}

func test_HFlow_layout() {
func test_HFlow_default() {
// Given
let sut: FlowLayout = .horizontal(alignment: .center, itemSpacing: 1, lineSpacing: 0)

Expand All @@ -125,6 +125,23 @@ final class FlowTests: XCTestCase {
""")
}

func test_HFlow_distibuted() throws {
// Given
let sut: FlowLayout = .horizontal(alignment: .center, itemSpacing: 1, lineSpacing: 0, distibuteItemsEvenly: true)

// When
let result = sut.layout(repeated(1×1, times: 13), in: 11×3)

// Then
XCTAssertEqual(render(result), """
+-----------+
|X X X X X |
|X X X X |
|X X X X |
+-----------+
""")
}

func test_HFlow_justifiedSpaces_rigid() {
// Given
let sut: FlowLayout = .horizontal(alignment: .center, itemSpacing: 1, lineSpacing: 0, justification: .stretchSpaces)
Expand Down Expand Up @@ -293,18 +310,18 @@ final class FlowTests: XCTestCase {
""")
}

func test_VFlow_layout() {
func test_VFlow_default() {
// Given
let sut: FlowLayout = .vertical(alignment: .center, itemSpacing: 0, lineSpacing: 0)

// When
let result = sut.layout(repeated(1×1, times: 17), in: 6×3)
let result = sut.layout(repeated(1×1, times: 16), in: 6×3)

// Then
XCTAssertEqual(render(result), """
+------+
|XXXXXX|
|XXXXXX|
|XXXXX |
|XXXXX |
+------+
""")
Expand Down

0 comments on commit cc9a722

Please sign in to comment.