• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Running an NSApplication from a test case
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Running an NSApplication from a test case
      • From: "email@hidden" <email@hidden>
  • Prev by Date: Re: Key event data not available in eventRef
  • Next by Date: Re: Key event data not available in eventRef
  • Previous by thread: Re: Key event data not available in eventRef
  • Next by thread: Re: Running an NSApplication from a test case
  • Index(es):
    • Date
    • Thread