Running an NSApplication from a test case
Running an NSApplication from a test case
- Subject: Running an NSApplication from a test case
- From: Daniel Luis dos Santos <email@hidden>
- Date: Tue, 04 Mar 2014 21:27:50 +0000
Hello all,
I have a test case where I would like to launch a UI. I have a NIB with a window that I load through code in the test case. Here goes the code :
- (void)testExample
{
NSArray* topLevelWidgets = nil;
NSBundle* theBundle = [NSBundle bundleForClass:[self class]];
[NSApplication sharedApplication];
Boolean nibLoaded = [theBundle loadNibNamed: @"TestSetOne" owner: [NSApplication sharedApplication] topLevelObjects: &topLevelWidgets];
if (!nibLoaded)
XCTFail(@"NIB file was not loaded");
[[NSApplication sharedApplication] runModalForWindow:[topLevelWidgets objectAtIndex:2]];
}
Problem is that the last line does not cause the window in the NIB to appear. If I run the code through the debugger I can see the NSWindow instance that I am passing to the “runModalForWindow”.
What am I doing wrong ?
Regards
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden