//
//  PermissionApplyViewsTests.swift
//  suixinkanTests
//

import XCTest
@testable import suixinkan

/// 权限申请页标签流式布局测试。
@MainActor
final class PermissionApplyViewsTests: XCTestCase {

    func testSelectedChipsAreLeftAlignedAndWrapWithAndroidSpacing() {
        let frames = PermissionChipLayoutMetrics.makeFrames(
            itemWidths: [80, 120, 90],
            containerWidth: 260
        )

        XCTAssertEqual(frames[0].minX, 0, accuracy: 0.5)
        XCTAssertEqual(frames[1].minX, frames[0].maxX + 12, accuracy: 0.5)
        XCTAssertEqual(frames[2].minX, 0, accuracy: 0.5)
        XCTAssertEqual(frames[2].minY, frames[0].maxY + 2, accuracy: 0.5)
        XCTAssertTrue(frames.allSatisfy { $0.maxX <= 260.5 })
    }
}
