Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds drawHierarchyInKeyWindow parameter #801

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/SnapshotTesting/Snapshotting/UIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
///
/// - Parameters:
/// - config: A set of device configuration settings.
/// - drawHierarchyInKeyWindow: Utilize the simulator's key window in order to render
/// `UIAppearance` and `UIVisualEffect`s. This option requires a host application for your
/// tests and will _not_ work for framework test targets.
/// - precision: The percentage of pixels that must match.
/// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a
/// match. 98-99% mimics
Expand All @@ -20,6 +23,7 @@
/// - traits: A trait collection override.
public static func image(
on config: ViewImageConfig,
drawHierarchyInKeyWindow: Bool = false,
precision: Float = 1,
perceptualPrecision: Float = 1,
size: CGSize? = nil,
Expand All @@ -34,7 +38,7 @@
snapshotView(
config: size.map { .init(safeArea: config.safeArea, size: $0, traits: config.traits) }
?? config,
drawHierarchyInKeyWindow: false,
drawHierarchyInKeyWindow: drawHierarchyInKeyWindow,
traits: traits,
view: viewController.view,
viewController: viewController
Expand Down