1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#import "ObjectTesting.h"
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
// For some nib/xibs the AppDelegate is defined...
@interface AppDelegate : NSObject
{
IBOutlet NSWindow *window;
}
@end
@implementation AppDelegate
@end
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSArray **testObjects = NULL;
BOOL success = NO;
NSFileManager *mgr = [NSFileManager defaultManager];
NSString *path = [mgr currentDirectoryPath];
NSBundle *bundle = [[NSBundle alloc] initWithPath: path];
START_SET("NSNibLoading GNUstep basic")
NS_DURING
{
[NSApplication sharedApplication];
}
NS_HANDLER
{
if ([[localException name]
isEqualToString: NSInternalInconsistencyException])
{
SKIP("It looks like GNUstep backend is not yet installed")
}
}
NS_ENDHANDLER
if ([[path lastPathComponent] isEqualToString: @"obj"])
{
path = [path stringByDeletingLastPathComponent];
}
PASS(bundle != nil, "NSBundle was initialized");
NS_DURING
{
success = [bundle loadNibNamed: @"Test-gorm"
owner: [NSApplication sharedApplication]
topLevelObjects: testObjects];
PASS(success == YES, ".gorm file was loaded properly"
" using loadNibNamed:owner:topLevelObjects:");
success = [bundle loadNibNamed: @"Test-xib"
owner: [NSApplication sharedApplication]
topLevelObjects: testObjects];
PASS(success == YES, ".xib file was loaded properly"
" using loadNibNamed:owner:topLevelObjects:");
success = [bundle loadNibNamed: @"Test-nib"
owner: [NSApplication sharedApplication]
topLevelObjects: testObjects];
PASS(success == YES, ".nib file was loaded properly"
" using loadNibNamed:owner:topLevelObjects:");
}
NS_HANDLER
{
NSLog(@"%@", [localException reason]);
}
NS_ENDHANDLER
END_SET("NSNibLoading GNUstep basic")
[arp release];
return 0;
}
|