@@ -8,33 +8,47 @@ final class ViewTests: XCTestCase {
88 XCTAssertViewIntrospection ( of: PlatformView . self) { spies in
99 let spy0 = spies [ 0 ]
1010 let spy1 = spies [ 1 ]
11- let spy2 = spies [ 2 ]
1211
1312 VStack ( spacing: 10 ) {
14- Image ( systemName : " scribble " ) . resizable ( ) . frame ( height: 30 )
13+ SUTView ( ) . frame ( height: 30 )
1514 #if os(iOS) || os(tvOS) || os(visionOS)
1615 . introspect( . view, on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . tvOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy0)
1716 #elseif os(macOS)
1817 . introspect( . view, on: . macOS( . v10_15, . v11, . v12, . v13, . v14, . v15, . v26) , customize: spy0)
1918 #endif
2019
21- Text ( " Text " ) . frame ( height: 40 )
20+ SUTView ( ) . frame ( height: 40 )
2221 #if os(iOS) || os(tvOS) || os(visionOS)
2322 . introspect( . view, on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . tvOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy1)
2423 #elseif os(macOS)
2524 . introspect( . view, on: . macOS( . v10_15, . v11, . v12, . v13, . v14, . v15, . v26) , customize: spy1)
2625 #endif
2726 }
2827 . padding ( 10 )
29- #if os(iOS) || os(tvOS) || os(visionOS)
30- . introspect( . view, on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . tvOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) , customize: spy2)
31- #elseif os(macOS)
32- . introspect( . view, on: . macOS( . v10_15, . v11, . v12, . v13, . v14, . v15, . v26) , customize: spy2)
33- #endif
3428 } extraAssertions: {
3529 XCTAssertEqual ( $0 [ safe: 0 ] ? . frame. height, 30 )
3630 XCTAssertEqual ( $0 [ safe: 1 ] ? . frame. height, 40 )
37- XCTAssertEqual ( $0 [ safe: 2 ] ? . frame. height, 100 )
3831 }
3932 }
4033}
34+
35+ struct SUTView : UIViewRepresentable {
36+ func makeUIView( context: Context ) -> some UIView {
37+ let view = UIView ( )
38+ view. translatesAutoresizingMaskIntoConstraints = false
39+
40+ let widthConstraint = view. widthAnchor. constraint ( greaterThanOrEqualToConstant: . greatestFiniteMagnitude)
41+ widthConstraint. priority = . defaultLow
42+
43+ let heightConstraint = view. heightAnchor. constraint ( greaterThanOrEqualToConstant: . greatestFiniteMagnitude)
44+ heightConstraint. priority = . defaultLow
45+
46+ NSLayoutConstraint . activate ( [ widthConstraint, heightConstraint] )
47+
48+ return view
49+ }
50+
51+ func updateUIView( _ uiView: UIViewType , context: Context ) {
52+ // NO-OP
53+ }
54+ }
0 commit comments