From 9f7e9214d006c6499c2ae9982963c7ed1740a893 Mon Sep 17 00:00:00 2001 From: Laszlo Teveli Date: Wed, 14 Aug 2024 18:45:52 +0200 Subject: [PATCH] Added test for VStack line spacing --- Tests/FlowTests/FlowTests.swift | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Tests/FlowTests/FlowTests.swift b/Tests/FlowTests/FlowTests.swift index 9bdd7a6d..a5dc8537 100644 --- a/Tests/FlowTests/FlowTests.swift +++ b/Tests/FlowTests/FlowTests.swift @@ -253,6 +253,28 @@ final class FlowTests: XCTestCase { """) } + func test_VFlow_size_singleElement() throws { + // Given + let sut: FlowLayout = .vertical(alignment: .center, itemSpacing: 10, lineSpacing: 20) + + // When + let size = sut.sizeThatFits(proposal: 100×100, subviews: [50×50]) + + // Then + XCTAssertEqual(size, 50×50) + } + + func test_VFlow_size_multipleElements() throws { + // Given + let sut: FlowLayout = .vertical(alignment: .center, itemSpacing: 10, lineSpacing: 20) + + // When + let size = sut.sizeThatFits(proposal: 130×130, subviews: repeated(50×50, times: 3)) + + // Then + XCTAssertEqual(size, 120×110) + } + func test_VFlow_layout_leading() { // Given let sut: FlowLayout = .vertical(alignment: .leading, itemSpacing: 1, lineSpacing: 1)