♻️ :: Use property drawHierarchyInKeyWindow instead of own custom helper

This commit is contained in:
Felix Mau
2022-03-10 14:08:02 +01:00
parent 03b9fac539
commit 07f2733ef8
4 changed files with 18 additions and 60 deletions
@@ -12,6 +12,13 @@ import SnapshotTesting
@testable import GradientLoadingBar
final class GradientLoadingBarControllerTestCase: XCTestCase {
// MARK: - Config
private enum Config {
/// The percentage of pixels that must match.
static let precision: Float = 0.99
}
// MARK: - Tests
func test_gradientLoadingBarController() {
@@ -30,6 +37,7 @@ final class GradientLoadingBarControllerTestCase: XCTestCase {
// Then
wait(for: [expectation], timeout: 1)
assertSnapshot(matching: rootViewController, as: .windowedImage)
assertSnapshot(matching: rootViewController,
as: .image(drawHierarchyInKeyWindow: true, precision: Config.precision))
}
}
@@ -14,6 +14,13 @@ import SnapshotTesting
final class NotchGradientLoadingBarControllerTestCase: XCTestCase {
// swiftlint:disable:previous type_name
// MARK: - Config
private enum Config {
/// The percentage of pixels that must match.
static let precision: Float = 0.99
}
// MARK: - Tests
func test_notchGradientLoadingBarController() {
@@ -32,6 +39,7 @@ final class NotchGradientLoadingBarControllerTestCase: XCTestCase {
// Then
wait(for: [expectation], timeout: 1)
assertSnapshot(matching: rootViewController, as: .windowedImage)
assertSnapshot(matching: rootViewController,
as: .image(drawHierarchyInKeyWindow: true, precision: Config.precision))
}
}