diff --git a/GormCore/GormAbstractDelegate.h b/GormCore/GormAbstractDelegate.h index 08d4585b..d38c828c 100644 --- a/GormCore/GormAbstractDelegate.h +++ b/GormCore/GormAbstractDelegate.h @@ -78,6 +78,10 @@ - (IBAction) testInterface: (id)sender; - (IBAction) endTesting: (id)sender; +// Testing... +- (void) setTestingInterface: (BOOL)testing; +- (BOOL) isTestingInterface; + @end #endif // import guard diff --git a/GormCore/GormAbstractDelegate.m b/GormCore/GormAbstractDelegate.m index 25e72390..6e861079 100644 --- a/GormCore/GormAbstractDelegate.m +++ b/GormCore/GormAbstractDelegate.m @@ -71,6 +71,9 @@ path = [bundle pathForImageResource: @"GormTesting"]; testingImage = [[NSImage alloc] initWithContentsOfFile: path]; } + + // Initialize ivars + isTesting = NO; // regular notifications... [nc addObserver: self @@ -419,7 +422,7 @@ - (IBAction) testInterface: (id)sender { - if (isTesting == NO) + if (isTesting == NO || [self isInTool]) { // top level objects NS_DURING @@ -831,6 +834,11 @@ return isTesting; } +- (void) setTestingInterface: (BOOL)testing +{ + isTesting = testing; +} + - (NSImage*) linkImage { return linkImage; diff --git a/Tools/gormtool/AppDelegate.m b/Tools/gormtool/AppDelegate.m index 6ef01181..9fa843f5 100644 --- a/Tools/gormtool/AppDelegate.m +++ b/Tools/gormtool/AppDelegate.m @@ -91,7 +91,7 @@ NSMutableDictionary *result = [NSMutableDictionary dictionary]; NSProcessInfo *pi = [NSProcessInfo processInfo]; NSMutableArray *args = [NSMutableArray arrayWithArray: [pi arguments]]; - BOOL filenameIsLastObject = NO; + // BOOL filenameIsLastObject = NO; NSString *file = nil; // If the --read option isn't specified, we assume that the last argument is @@ -99,7 +99,7 @@ if ([args containsObject: @"--read"] == NO) { file = [args lastObject]; - filenameIsLastObject = YES; + // filenameIsLastObject = YES; [args removeObject: file]; NSDebugLog(@"file = %@", file); @@ -237,6 +237,12 @@ parse_val = YES; } + if ([obj isEqualToString: @"--test"]) + { + [pair setArgument: obj]; + parse_val = NO; + } + // If there is no parameter for the argument, set it anyway... if (parse_val == NO) { @@ -253,7 +259,8 @@ NSProcessInfo *pi = [NSProcessInfo processInfo]; [NSClassSwapper setIsInInterfaceBuilder: YES]; - + [self setTestingInterface: NO]; + if ([[pi arguments] count] > 1) { NSString *file = nil; @@ -465,6 +472,13 @@ } } } + + opt = [args objectForKey: @"--test"]; + if (opt != nil) + { + NSLog(@"Control-C to end"); + [self testInterface: self]; + } } [NSClassSwapper setIsInInterfaceBuilder: NO];