You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
I am trying to run Snapshot tests for VCs of my project. It's quite a big project so I am using xib files instead of storyboards (plus I am part of a dev team). What I don't understand is why snapshot outcome is not resizing to match current simulator's size. Strangely, if I programmatically add it in a UIWindow then it works perfectly fine. Is it a known issue with usesDrawViewHierarchyInRect? Please check sample code below.
override func setUp() {
super.setUp()
self.recordMode = true
self.usesDrawViewHierarchyInRect = true
}
func testSizeClassXibViewControllerSnapshot() {
let vc = SizeClassViewController.init(nibName: "SizeClassViewController", bundle: nil) // this is size class xib
FBSnapshotVerifyView(vc.view)
FBSnapshotVerifyLayer(vc.view.layer)
}
The above has a PNG outcome of 1200x1200 on iPhone 7 simulator.
override func setUp() {
super.setUp()
self.recordMode = true
self.usesDrawViewHierarchyInRect = true
}
func testSizeClassXibViewControllerSnapshot() {
let vc = SizeClassViewController.init(nibName: "SizeClassViewController", bundle: nil) // this is size class xib
let window = UIWindow.init(frame: UIScreen.mainScreen().bounds)
window.addSubview(vc.view)
vc.view.frame = window.bounds
FBSnapshotVerifyView(vc.view)
FBSnapshotVerifyLayer(vc.view.layer)
}
However, this one has the correct size, 750 × 1334
Running Xcode Version 8.2.1 (8C1002)
The text was updated successfully, but these errors were encountered:
Just to mention I have that I have the same problem. I had a controller declared in a storyboard and it's snapshot was sized fine. After I changed the same controller to be in a xib, now it's generated snapshot is 1200 × 1200 (using iPhone 8 simulator - Xcode 9.2)
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am trying to run Snapshot tests for VCs of my project. It's quite a big project so I am using xib files instead of storyboards (plus I am part of a dev team). What I don't understand is why snapshot outcome is not resizing to match current simulator's size. Strangely, if I programmatically add it in a UIWindow then it works perfectly fine. Is it a known issue with
usesDrawViewHierarchyInRect
? Please check sample code below.The above has a PNG outcome of 1200x1200 on iPhone 7 simulator.
However, this one has the correct size, 750 × 1334
Running Xcode Version 8.2.1 (8C1002)
The text was updated successfully, but these errors were encountered: