2
2
// InterfaceIdiomTests.swift
3
3
// OpenSwiftUITests
4
4
5
+
5
6
@testable import OpenSwiftUI
6
7
import Testing
7
8
#if canImport(UIKit)
@@ -12,14 +13,27 @@ struct InterfaceIdiomTests {
12
13
#if os(iOS) || os(tvOS)
13
14
@Test
14
15
func interfaceIdiom( ) throws {
16
+ #if OPENSWIFTUI_RELEASE_2021
17
+ #expect( UIUserInterfaceIdiom . unspecified. idiom == nil )
18
+ #expect( UIUserInterfaceIdiom . phone. idiom == AnyInterfaceIdiomType . phone)
19
+ #expect( UIUserInterfaceIdiom . pad. idiom == AnyInterfaceIdiomType . pad)
20
+ #expect( UIUserInterfaceIdiom . tv. idiom == AnyInterfaceIdiomType . tv)
21
+ #expect( UIUserInterfaceIdiom . carPlay. idiom == AnyInterfaceIdiomType . carplay)
22
+ #expect( UIUserInterfaceIdiom ( rawValue: 4 ) ? . idiom == AnyInterfaceIdiomType . watch)
23
+ #expect( UIUserInterfaceIdiom . mac. idiom == AnyInterfaceIdiomType . mac)
24
+ if #available( iOS 17 , tvOS 17 , * ) {
25
+ #expect( UIUserInterfaceIdiom . vision. idiom == AnyInterfaceIdiomType . vision)
26
+ }
27
+ #elseif OPENSWIFTUI_RELEASE_2024
15
28
#expect( UIUserInterfaceIdiom . unspecified. idiom == nil )
16
29
#expect( UIUserInterfaceIdiom . phone. idiom == AnyInterfaceIdiom ( . phone) )
17
30
#expect( UIUserInterfaceIdiom . pad. idiom == AnyInterfaceIdiom ( . pad) )
18
31
#expect( UIUserInterfaceIdiom . tv. idiom == AnyInterfaceIdiom ( . tv) )
19
32
#expect( UIUserInterfaceIdiom . carPlay. idiom == AnyInterfaceIdiom ( . carPlay) )
20
33
#expect( UIUserInterfaceIdiom ( rawValue: 4 ) ? . idiom == AnyInterfaceIdiom ( . watch) )
21
- #expect( UIUserInterfaceIdiom . carPlay . idiom == AnyInterfaceIdiom ( . carPlay ) )
34
+ #expect( UIUserInterfaceIdiom . mac . idiom == AnyInterfaceIdiom ( . mac ) )
22
35
#expect( UIUserInterfaceIdiom . vision. idiom == AnyInterfaceIdiom ( . vision) )
36
+ #endif
23
37
}
24
38
#endif
25
39
}
0 commit comments