diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index f962a8b6c..2205726e2 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -507,7 +507,8 @@ CPRunContinuesResponse = -1002; var theWindow = aModalSession._window; [theWindow center]; - [theWindow makeKeyAndOrderFront:self]; + [theWindow makeKeyWindow]; + [theWindow orderFront:self]; // [theWindow._bridge _obscureWindowsBelowModalWindow]; diff --git a/Tests/AppKit/CPApplicationTest.j b/Tests/AppKit/CPApplicationTest.j new file mode 100644 index 000000000..1b2589225 --- /dev/null +++ b/Tests/AppKit/CPApplicationTest.j @@ -0,0 +1,24 @@ +@import +@import + +@implementation CPApplicationTest : OJTestCase +{ +} + +- (void)setUp +{ + // This sets up the CPApp convenience variable, the unit tests fails + // if this is not done, because the framework internally uses CPApp. + [CPApplication sharedApplication] +} + +- (void)testRunModalForWindow +{ + var aWindow = [[CPWindow alloc] init]; + [[CPApplication sharedApplication] runModalForWindow:aWindow]; + + [self assertTrue:[aWindow isKeyWindow] message:@"A window must be made key when it's run modally"]; + [self assertFalse:[aWindow isMainWindow] message:@"A window must not become the main window when it's run modally"]; +} + +@end \ No newline at end of file