@@ -44,14 +44,16 @@ extension Snapshotting where Value == UIView, Format == UIImage {
44
44
/// - parameter markerColors: The array of colors which will be chosen from when creating the overlays.
45
45
/// - parameter showUserInputLabels: Controls when to show elements' accessibility user input labels (used by Voice
46
46
/// Control).
47
+ /// - parameter shouldRunInHostApplication: Controls whether a host application is required to run the test or not.
47
48
public static func accessibilityImage(
48
49
showActivationPoints activationPointDisplayMode: ActivationPointDisplayMode = . whenOverridden,
49
50
useMonochromeSnapshot: Bool = true ,
50
51
drawHierarchyInKeyWindow: Bool = false ,
51
52
markerColors: [ UIColor ] = [ ] ,
52
- showUserInputLabels: Bool = true
53
+ showUserInputLabels: Bool = true ,
54
+ shouldRunInHostApplication: Bool = true
53
55
) -> Snapshotting {
54
- guard isRunningInHostApplication else {
56
+ guard !shouldRunInHostApplication || isRunningInHostApplication else {
55
57
fatalError ( " Accessibility snapshot tests cannot be run in a test target without a host application " )
56
58
}
57
59
@@ -257,15 +259,17 @@ extension Snapshotting where Value == UIViewController, Format == UIImage {
257
259
useMonochromeSnapshot: Bool = true ,
258
260
drawHierarchyInKeyWindow: Bool = false ,
259
261
markerColors: [ UIColor ] = [ ] ,
260
- showUserInputLabels: Bool = true
262
+ showUserInputLabels: Bool = true ,
263
+ shouldRunInHostApplication: Bool = true
261
264
) -> Snapshotting {
262
265
return Snapshotting < UIView , UIImage >
263
266
. accessibilityImage (
264
267
showActivationPoints: activationPointDisplayMode,
265
268
useMonochromeSnapshot: useMonochromeSnapshot,
266
269
drawHierarchyInKeyWindow: drawHierarchyInKeyWindow,
267
270
markerColors: markerColors,
268
- showUserInputLabels: showUserInputLabels
271
+ showUserInputLabels: showUserInputLabels,
272
+ shouldRunInHostApplication: shouldRunInHostApplication
269
273
)
270
274
. pullback { viewController in
271
275
viewController. view
0 commit comments