Skip to content

Commit

Permalink
half sheet is causing problem again.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhenry committed Jul 8, 2024
1 parent e2de1f8 commit 5d86f58
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Demo/DemoTests/Helpers/Snapshotting+WindowImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension Snapshotting where Value: UIViewController, Format == UIImage {
guard let window = UIApplication.shared.connectedScenes.compactMap({ $0 as? UIWindowScene }).first?.windows.first else { return }
window.rootViewController = vc
action()
DispatchQueue.main.sync {
DispatchQueue.main.async {
let image = UIGraphicsImageRenderer(bounds: window.bounds).image { _ in
window.drawHierarchy(in: window.bounds, afterScreenUpdates: true)
}
Expand Down
8 changes: 4 additions & 4 deletions Demo/DemoTests/SnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,29 @@ final class SnapshotTests: XCTestCase {
}

func testInputValueViewController() throws {
let vc = InputValueViewController(viewModel: .init(model: .init(key: "Hello", value: "World", displayName: "Hello"))).wrapInsideNavVC().preferAsHalfSheet()
let vc = InputValueViewController(viewModel: .init(model: .init(key: "Hello", value: "World", displayName: "Hello"))).wrapInsideNavVC()
assertVCSnapshotWithActionFromHost {
$0.present(vc, animated: false)
}
}

func testInputValueViewControllerJSON() throws {
let vc = InputValueViewController(viewModel: .init(model: .init(key: "JSON", value: "{\"name\":\"Kel\", \"city\": \"Melbourne\" }", displayName: "Contact"))).wrapInsideNavVC().preferAsHalfSheet()
let vc = InputValueViewController(viewModel: .init(model: .init(key: "JSON", value: "{\"name\":\"Kel\", \"city\": \"Melbourne\" }", displayName: "Contact"))).wrapInsideNavVC()
assertVCSnapshotWithActionFromHost {
$0.present(vc, animated: false)
}
}

func testInputValueViewControllerURL() throws {
let vc = InputValueViewController(viewModel: .init(model: .init(key: "URL", value: "https://google.com", displayName: "URL"))).wrapInsideNavVC().preferAsHalfSheet()
let vc = InputValueViewController(viewModel: .init(model: .init(key: "URL", value: "https://google.com", displayName: "URL"))).wrapInsideNavVC()
assertVCSnapshotWithActionFromHost {
$0.present(vc, animated: false)
}
}

func testOptionViewController() throws {
let choices = [1, 2, 3, 4].map { "Value\($0)" }.map { Choice(displayName: $0, value: $0) }
let vc = OptionViewController(viewModel: .init(model: .init(key: "Name", value: "Value1", choices: choices, displayName: "Name"))).wrapInsideNavVC().preferAsHalfSheet()
let vc = OptionViewController(viewModel: .init(model: .init(key: "Name", value: "Value1", choices: choices, displayName: "Name"))).wrapInsideNavVC()
assertVCSnapshotWithActionFromHost {
$0.present(vc, animated: false)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5d86f58

Please sign in to comment.