From e78200838fd6a147cdb6e142ddf1b67b2ae0157c Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Wed, 6 Oct 2010 09:04:54 +0200 Subject: [PATCH] don't make a modally run window the main window --- AppKit/CPApplication.j | 3 ++- Tests/AppKit/CPApplicationTest.j | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Tests/AppKit/CPApplicationTest.j 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