mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Add support to test gui in gormtool
This commit is contained in:
parent
d0879eeb84
commit
5c3b84748e
3 changed files with 30 additions and 4 deletions
|
@ -78,6 +78,10 @@
|
||||||
- (IBAction) testInterface: (id)sender;
|
- (IBAction) testInterface: (id)sender;
|
||||||
- (IBAction) endTesting: (id)sender;
|
- (IBAction) endTesting: (id)sender;
|
||||||
|
|
||||||
|
// Testing...
|
||||||
|
- (void) setTestingInterface: (BOOL)testing;
|
||||||
|
- (BOOL) isTestingInterface;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // import guard
|
#endif // import guard
|
||||||
|
|
|
@ -71,6 +71,9 @@
|
||||||
path = [bundle pathForImageResource: @"GormTesting"];
|
path = [bundle pathForImageResource: @"GormTesting"];
|
||||||
testingImage = [[NSImage alloc] initWithContentsOfFile: path];
|
testingImage = [[NSImage alloc] initWithContentsOfFile: path];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize ivars
|
||||||
|
isTesting = NO;
|
||||||
|
|
||||||
// regular notifications...
|
// regular notifications...
|
||||||
[nc addObserver: self
|
[nc addObserver: self
|
||||||
|
@ -419,7 +422,7 @@
|
||||||
|
|
||||||
- (IBAction) testInterface: (id)sender
|
- (IBAction) testInterface: (id)sender
|
||||||
{
|
{
|
||||||
if (isTesting == NO)
|
if (isTesting == NO || [self isInTool])
|
||||||
{
|
{
|
||||||
// top level objects
|
// top level objects
|
||||||
NS_DURING
|
NS_DURING
|
||||||
|
@ -831,6 +834,11 @@
|
||||||
return isTesting;
|
return isTesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setTestingInterface: (BOOL)testing
|
||||||
|
{
|
||||||
|
isTesting = testing;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSImage*) linkImage
|
- (NSImage*) linkImage
|
||||||
{
|
{
|
||||||
return linkImage;
|
return linkImage;
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
||||||
NSProcessInfo *pi = [NSProcessInfo processInfo];
|
NSProcessInfo *pi = [NSProcessInfo processInfo];
|
||||||
NSMutableArray *args = [NSMutableArray arrayWithArray: [pi arguments]];
|
NSMutableArray *args = [NSMutableArray arrayWithArray: [pi arguments]];
|
||||||
BOOL filenameIsLastObject = NO;
|
// BOOL filenameIsLastObject = NO;
|
||||||
NSString *file = nil;
|
NSString *file = nil;
|
||||||
|
|
||||||
// If the --read option isn't specified, we assume that the last argument is
|
// If the --read option isn't specified, we assume that the last argument is
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
if ([args containsObject: @"--read"] == NO)
|
if ([args containsObject: @"--read"] == NO)
|
||||||
{
|
{
|
||||||
file = [args lastObject];
|
file = [args lastObject];
|
||||||
filenameIsLastObject = YES;
|
// filenameIsLastObject = YES;
|
||||||
[args removeObject: file];
|
[args removeObject: file];
|
||||||
NSDebugLog(@"file = %@", file);
|
NSDebugLog(@"file = %@", file);
|
||||||
|
|
||||||
|
@ -237,6 +237,12 @@
|
||||||
parse_val = YES;
|
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 there is no parameter for the argument, set it anyway...
|
||||||
if (parse_val == NO)
|
if (parse_val == NO)
|
||||||
{
|
{
|
||||||
|
@ -253,7 +259,8 @@
|
||||||
NSProcessInfo *pi = [NSProcessInfo processInfo];
|
NSProcessInfo *pi = [NSProcessInfo processInfo];
|
||||||
|
|
||||||
[NSClassSwapper setIsInInterfaceBuilder: YES];
|
[NSClassSwapper setIsInInterfaceBuilder: YES];
|
||||||
|
[self setTestingInterface: NO];
|
||||||
|
|
||||||
if ([[pi arguments] count] > 1)
|
if ([[pi arguments] count] > 1)
|
||||||
{
|
{
|
||||||
NSString *file = nil;
|
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];
|
[NSClassSwapper setIsInInterfaceBuilder: NO];
|
||||||
|
|
Loading…
Reference in a new issue