Closed blladnar closed 8 years ago
Hey Randall, I'm sorry you're having this issues.
You mentioned this doesn't occur when you run your tests with XCTest -- how are you running your tests with Cedar? Do you have a spec suite that runs your tests in a separate application, or are you using a test bundle?
My expectation is that this should work with Cedar when running in a test bundle. In that case, your real application starts up in the simulator, and there is a real window backing it.
If your tests are setup as a stand-alone spec suite, I imagine you may have to do some additional setup to make this work. You may need to create a UIWindow and set your view controller as the root view controller on it.
@blladnar did that help? Still having issues? If you have a small reproducible test case, I'd love to dig into this more.
I've definitely encountered this in the past using Cedar and found it difficult to work around, but possible with enough work. Would love to help you out if I can.
I'm trying to write some view controller tests that differ in behavior between iPhone and iPad in a universal app. When running the tests, the horizontal size class returned is always UIUserInterfaceSizeClassUnspecified. With XCTest, it returns the correct size class depending on whether I run it on an iPhone or an iPad.