@@ -16,175 +16,71 @@ final class UIViewControllerModalStyleTests: XCTestCase {
16
16
func testCover( ) {
17
17
18
18
let modalStyle : ModalStyle = . cover( )
19
- let viewController : UIViewController = givenViewController ( with: modalStyle)
20
-
21
19
expect ( modalStyle. behavior) == . cover
22
- expect ( modalStyle. controlStatusBarAppearance) == true
23
- expect ( modalStyle. allowInteractiveDismissal) == false
24
-
25
- expect ( viewController. modalPresentationStyle) == . fullScreen
26
- if #available( macCatalyst 13 . 0 , * ) {
27
- #if !os(tvOS)
28
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == true
29
- #endif
30
- }
31
- if #available( macCatalyst 13 . 0 , iOS 13 . 0 , tvOS 13 . 0 , * ) {
32
- expect ( viewController. isModalInPresentation) == true
33
- }
34
- }
35
-
36
- func testOverlay( ) {
37
20
38
- let modalStyle : ModalStyle = . overlay( controlStatusBarAppearance: true )
39
21
let viewController : UIViewController = givenViewController ( with: modalStyle)
22
+ expect ( viewController. modalPresentationStyle) == . fullScreen
40
23
41
- expect ( modalStyle. behavior) == ModalStyle . Behavior. overlay
42
- expect ( modalStyle. controlStatusBarAppearance) == true
43
- expect ( modalStyle. allowInteractiveDismissal) == false
44
-
45
- expect ( viewController. modalPresentationStyle) == . overFullScreen
46
- if #available( macCatalyst 13 . 0 , * ) {
47
- #if !os(tvOS)
48
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == true
49
- #endif
50
- }
51
- if #available( macCatalyst 13 . 0 , iOS 13 . 0 , tvOS 13 . 0 , * ) {
24
+ if #available( iOS 13 . 0 , tvOS 13 . 0 , * ) {
52
25
expect ( viewController. isModalInPresentation) == true
53
26
}
54
27
}
55
28
56
29
func testOverlayWithDefaults( ) {
57
30
58
31
let modalStyle : ModalStyle = . overlay( )
59
- let viewController : UIViewController = givenViewController ( with: modalStyle)
60
-
61
32
expect ( modalStyle. behavior) == ModalStyle . Behavior. overlay
62
- expect ( modalStyle. controlStatusBarAppearance) == false
63
- expect ( modalStyle. allowInteractiveDismissal) == false
64
33
34
+ let viewController : UIViewController = givenViewController ( with: modalStyle)
65
35
expect ( viewController. modalPresentationStyle) == . overFullScreen
66
- if #available( macCatalyst 13 . 0 , * ) {
67
- #if !os(tvOS)
68
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == false
69
- #endif
70
- }
71
- if #available( macCatalyst 13 . 0 , iOS 13 . 0 , tvOS 13 . 0 , * ) {
36
+
37
+ if #available( iOS 13 . 0 , tvOS 13 . 0 , * ) {
72
38
expect ( viewController. isModalInPresentation) == true
73
39
}
74
40
}
75
41
76
- @available ( macCatalyst 13 . 0 , iOS 13 . 0 , * )
42
+ @available ( iOS 13 . 0 , * )
77
43
@available ( tvOS, unavailable)
78
44
func testPageSheet( ) {
79
45
80
- let modalStyle : ModalStyle = . sheet( style: . page,
81
- controlStatusBarAppearance: true ,
82
- allowInteractiveDismissal: true )
83
- let viewController : UIViewController = givenViewController ( with: modalStyle)
84
-
85
- expect ( modalStyle. behavior) == . page
86
- expect ( modalStyle. controlStatusBarAppearance) == true
87
- expect ( modalStyle. allowInteractiveDismissal) == true
88
-
89
- expect ( viewController. modalPresentationStyle) == . pageSheet
90
- if #available( macCatalyst 13 . 0 , * ) {
91
- #if !os(tvOS)
92
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == true
93
- #endif
94
- }
95
- expect ( viewController. isModalInPresentation) == false
96
- }
97
-
98
- @available ( macCatalyst 13 . 0 , iOS 13 . 0 , * )
99
- @available ( tvOS, unavailable)
100
- func testPageSheetWithDefaults( ) {
101
-
102
46
let modalStyle : ModalStyle = . sheet( style: . page)
103
- let viewController : UIViewController = givenViewController ( with: modalStyle)
104
-
105
47
expect ( modalStyle. behavior) == . page
106
- expect ( modalStyle. controlStatusBarAppearance) == false
107
- expect ( modalStyle. allowInteractiveDismissal) == false
108
48
49
+ let viewController : UIViewController = givenViewController ( with: modalStyle)
109
50
expect ( viewController. modalPresentationStyle) == . pageSheet
110
- if #available( macCatalyst 13 . 0 , * ) {
111
- #if !os(tvOS)
112
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == false
113
- #endif
114
- }
115
51
expect ( viewController. isModalInPresentation) == true
116
52
}
117
53
118
- @available ( macCatalyst 13 . 0 , iOS 13 . 0 , * )
54
+ @available ( iOS 13 . 0 , * )
119
55
@available ( tvOS, unavailable)
120
56
func testFormSheet( ) {
121
57
122
- let modalStyle : ModalStyle = . sheet( style: . form,
123
- controlStatusBarAppearance: true ,
124
- allowInteractiveDismissal: true )
125
- let viewController : UIViewController = givenViewController ( with: modalStyle)
126
-
127
- expect ( modalStyle. behavior) == . form
128
- expect ( modalStyle. controlStatusBarAppearance) == true
129
- expect ( modalStyle. allowInteractiveDismissal) == true
130
-
131
- expect ( viewController. modalPresentationStyle) == . formSheet
132
- if #available( macCatalyst 13 . 0 , * ) {
133
- #if !os(tvOS)
134
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == true
135
- #endif
136
- }
137
- expect ( viewController. isModalInPresentation) == false
138
- }
139
-
140
- @available ( macCatalyst 13 . 0 , iOS 13 . 0 , * )
141
- @available ( tvOS, unavailable)
142
- func testFormSheetWithDefaults( ) {
143
-
144
58
let modalStyle : ModalStyle = . sheet( style: . form)
145
- let viewController : UIViewController = givenViewController ( with: modalStyle)
146
-
147
59
expect ( modalStyle. behavior) == . form
148
- expect ( modalStyle. controlStatusBarAppearance) == false
149
- expect ( modalStyle. allowInteractiveDismissal) == false
150
60
61
+ let viewController : UIViewController = givenViewController ( with: modalStyle)
151
62
expect ( viewController. modalPresentationStyle) == . formSheet
152
- if #available( macCatalyst 13 . 0 , * ) {
153
- #if !os(tvOS)
154
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == false
155
- #endif
156
- }
157
63
expect ( viewController. isModalInPresentation) == true
158
64
}
159
65
160
66
func testCustom( ) {
161
67
162
68
let modalStyle : ModalStyle = . custom( )
163
- let viewController : UIViewController = givenViewController ( with: modalStyle)
164
-
165
69
expect ( modalStyle. behavior) == . custom
166
- expect ( modalStyle. controlStatusBarAppearance) == false
167
- expect ( modalStyle. allowInteractiveDismissal) == false
168
-
169
- expect ( viewController. modalPresentationStyle) == . custom
170
- if #available( macCatalyst 13 . 0 , * ) {
171
- #if !os(tvOS)
172
- expect ( viewController. modalPresentationCapturesStatusBarAppearance) == false
173
- #endif
174
- }
175
- if #available( macCatalyst 13 . 0 , iOS 13 . 0 , tvOS 13 . 0 , * ) {
176
- expect ( viewController. isModalInPresentation) == true
177
- }
70
+
71
+ let viewController : UIViewController = givenViewController ( with: modalStyle)
72
+ expect ( viewController. modalPresentationStyle) == UIModalPresentationStyle . none
73
+ expect ( viewController. isModalInPresentation) == true
178
74
}
179
75
180
76
func testAdditionalConfiguration( ) {
181
77
var additionalConfiguration1 : [ UIViewController ] = [ ]
182
78
var additionalConfiguration2 : [ UIViewController ] = [ ]
183
79
var additionalConfiguration3 : [ UIViewController ] = [ ]
184
80
let modalStyle : ModalStyle = . cover( )
185
- . _withAdditionalConfiguration { additionalConfiguration1. append ( $0. _asUIViewController ( ) ) }
186
- . _withAdditionalConfiguration { additionalConfiguration2. append ( $0. _asUIViewController ( ) ) }
187
- . _withAdditionalConfiguration { additionalConfiguration3. append ( $0. _asUIViewController ( ) ) }
81
+ . withAdditionalConfiguration { additionalConfiguration1. append ( $0. _asUIViewController ( ) ) }
82
+ . withAdditionalConfiguration { additionalConfiguration2. append ( $0. _asUIViewController ( ) ) }
83
+ . withAdditionalConfiguration { additionalConfiguration3. append ( $0. _asUIViewController ( ) ) }
188
84
let viewController : UIViewController = givenViewController ( with: modalStyle)
189
85
expect ( additionalConfiguration1) == [ viewController]
190
86
expect ( additionalConfiguration2) == [ viewController]
0 commit comments