Skip to content

Commit

Permalink
Fix for #276
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Jun 3, 2024
1 parent 51ed6a9 commit d312fbe
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
15 changes: 7 additions & 8 deletions Source/NSMenuItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ - (id) initWithCoder: (NSCoder*)aDecoder
NSString *action;
NSString *key;
BOOL isSeparator = NO;
NSNumber *keyMask;

if ([aDecoder containsValueForKey: @"NSIsSeparator"])
{
Expand Down Expand Up @@ -703,13 +702,13 @@ - (id) initWithCoder: (NSCoder*)aDecoder
[self setSubmenu: submenu];
}

// Set the key mask when it is present; or default to NSCommandKeyMask
// when not specified
keyMask = (NSNumber*)[aDecoder decodeObjectForKey: @"NSKeyEquivModMask"];

if (keyMask != nil)
{
[self setKeyEquivalentModifierMask: [keyMask intValue]];
/* Set the key mask when it is present; or default to NSCommandKeyMask
* when not specified
*/
if ([aDecoder containsValueForKey: @"NSKeyEquivModMask"])
{
[self setKeyEquivalentModifierMask:
[aDecoder decodeIntegerForKey: @"NSKeyEquivModMask"]];
}
else
{
Expand Down
38 changes: 22 additions & 16 deletions Tests/gui/NSNibLoading/basic.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,27 @@ @implementation AppDelegate

int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSArray **testObjects;
BOOL success = NO;
NSFileManager *mgr = [NSFileManager defaultManager];
NSString *path = [mgr currentDirectoryPath];
NSBundle *bundle = [[NSBundle alloc] initWithPath: path];
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];
}
{
[NSApplication sharedApplication];
}
NS_HANDLER
{
if ([[localException name] isEqualToString: NSInternalInconsistencyException ])
SKIP("It looks like GNUstep backend is not yet installed")
}
{
if ([[localException name]
isEqualToString: NSInternalInconsistencyException])
{
SKIP("It looks like GNUstep backend is not yet installed")
}
}
NS_ENDHANDLER

if ([[path lastPathComponent] isEqualToString: @"obj"])
Expand All @@ -49,19 +52,22 @@ int main()
owner: [NSApplication sharedApplication]
topLevelObjects: testObjects];

PASS(success == YES, ".gorm file was loaded properly using loadNibNamed:owner:topLevelObjects:");
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:");
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:");
PASS(success == YES, ".nib file was loaded properly"
" using loadNibNamed:owner:topLevelObjects:");
}
NS_HANDLER
{
Expand Down

0 comments on commit d312fbe

Please sign in to comment.