11#if !os(tvOS) && !os(macOS)
22import SwiftUI
33import SwiftUIIntrospect
4- import XCTest
4+ import Testing
55
66@MainActor
7- final class PickerWithWheelStyleTests : XCTestCase {
7+ @Suite
8+ struct PickerWithWheelStyleTests {
89 #if canImport(UIKit)
910 typealias PlatformPickerWithWheelStyle = UIPickerView
1011 #endif
1112
12- func testPickerWithWheelStyle( ) {
13- XCTAssertViewIntrospection ( of: PlatformPickerWithWheelStyle . self) { spies in
14- let spy0 = spies [ 0 ]
15- let spy1 = spies [ 1 ]
16- let spy2 = spies [ 2 ]
17-
13+ @Test func introspect( ) async throws {
14+ let ( entity1, entity2, entity3) = try await introspection ( of: PlatformPickerWithWheelStyle . self) { spy1, spy2, spy3 in
1815 VStack {
1916 Picker ( " Pick " , selection: . constant( " 1 " ) ) {
2017 Text ( " 1 " ) . tag ( " 1 " )
2118 }
2219 . pickerStyle ( . wheel)
2320 #if os(iOS) || os(visionOS)
24- . introspect( . picker( style: . wheel) , on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy0 )
21+ . introspect( . picker( style: . wheel) , on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy1 )
2522 #endif
2623 . cornerRadius( 8 )
2724
@@ -31,7 +28,7 @@ final class PickerWithWheelStyleTests: XCTestCase {
3128 }
3229 . pickerStyle ( . wheel)
3330 #if os(iOS) || os(visionOS)
34- . introspect( . picker( style: . wheel) , on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy1 )
31+ . introspect( . picker( style: . wheel) , on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy2 )
3532 #endif
3633 . cornerRadius( 8 )
3734
@@ -42,16 +39,15 @@ final class PickerWithWheelStyleTests: XCTestCase {
4239 }
4340 . pickerStyle ( . wheel)
4441 #if os(iOS) || os(visionOS)
45- . introspect( . picker( style: . wheel) , on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy2 )
42+ . introspect( . picker( style: . wheel) , on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy3 )
4643 #endif
4744 }
48- } extraAssertions: {
49- #if canImport(UIKit)
50- XCTAssertEqual ( $0 [ safe: 0 ] ? . numberOfRows ( inComponent: 0 ) , 1 )
51- XCTAssertEqual ( $0 [ safe: 1 ] ? . numberOfRows ( inComponent: 0 ) , 2 )
52- XCTAssertEqual ( $0 [ safe: 2 ] ? . numberOfRows ( inComponent: 0 ) , 3 )
53- #endif
5445 }
46+ #if canImport(UIKit)
47+ #expect( entity1. numberOfRows ( inComponent: 0 ) == 1 )
48+ #expect( entity2. numberOfRows ( inComponent: 0 ) == 2 )
49+ #expect( entity3. numberOfRows ( inComponent: 0 ) == 3 )
50+ #endif
5551 }
5652}
5753#endif
0 commit comments