mirror of
https://github.com/fxm90/GradientLoadingBar.git
synced 2026-06-16 12:24:31 +00:00
♻️ :: Use property drawHierarchyInKeyWindow instead of own custom helper
This commit is contained in:
+9
-1
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user