Merge branch 'master' into NSTableRowView_branch

This commit is contained in:
Gregory Casamento 2024-06-11 02:08:53 -04:00 committed by GitHub
commit 44c0836bd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 800 additions and 737 deletions

View file

@ -1,13 +1,13 @@
1 Announcement
**************
This is version 0.31.0 of the GNUstep GUI library (gnustep-gui).
This is version 0.31.1 of the GNUstep GUI library ('gnustep-gui').
1.1 What is the GNUstep GUI Library?
====================================
It is a library of graphical user interface classes written completely
in the Objective-C language; the classes are based upon Apples Cocoa
in the Objective-C language; the classes are based upon Apple's Cocoa
framework. The library has been enhanced in a number of ways to take
advantage of the GNU system. These classes include graphical objects
such as buttons, text fields, popup lists, browser lists, and windows;
@ -25,65 +25,32 @@ systems.
The GNUstep GUI Library requires the GNU Objective-C compiler, the
GNUstep Base Library, the TIFF Graphics library, Independent JPEG
Groups libjpeg library, and a back-end component from the GNUstep
Back library.
Group's libjpeg library, and a back-end component from the GNUstep
'Back' library.
Additional functionality may be enabled by installing additional
libraries. For example, to build the Cairo backend in the GNUstep Back
library, you will need to install Cairo.
1.2 Noteworthy changes in version 0.31.0
1.2 Noteworthy changes in version '0.31.1'
==========================================
This version adds view based cell support for NSTableView and
NSOutlineView. Plus the usual bunch of bug fixes.
This is a bugfix release
• Add TGA detection for ImageMagick extension.
• Correct endianess swapping for saving 16 and 32 bit TIFF images.
• NSParagraphStyle restore old behaviour to have default tab stops.
• Documentation updates.
• A fix for autogsdoc documentation creation.
• Improve theming for many classes.
• Correct keyEquivalentModifierMask decoding in XIB files.
• Add imageViewWithImage: to NSImageView.
• Add implementation of NSUserInterfaceItemIdentifier to NSView.
• Fix NSImageView intercepting mouse events when not editable
• Move NSBox method isOpaque to GSTheme.
• Many decoding improvements.
• Fix compiler warnings.
• Generate and install a gnustep-gui.pc file.
• Add support for NSFilenamenPboardType in NSTextView.
• Add support for NSPasteboardTypePNG in NSBitmapImageRep if the
libpng is present.
• Add support for ImageMagick >= 7.0
• Increase pasteboard timeout to 30 seconds.
• Add NSAppearance implementation.
• Make PACKAGE_SCOPE public on MinGW.
• Started implementing NSShadow.
• Move awakeFromNib implementation to NSObject instead of NSView.
• Changes for libGIF 5.2 and later.
• Update NSViewController with lifeCycle methods.
• Avoid accessing instance variables in inline functions when
compiling with MSVC.
• Add method removeAllItems to NSMenu.
• Add badge handling to NSDockTile.
• More improvements to layout constraints.
• Add implementation of NSDictionaryController.
• Add implementation of the NSCollectionView classes.
• Improve NSDrawer opening.
• Improver CI pipeline.
* Fix bug decoding menu items (breaking archive)
* Remove use of deprecated lock from base library
1.3 Where can you get it? How can you compile it?
=================================================
The gnustep-gui-0.31.0.tar.gz distribution file has been placed at
The gnustep-gui-0.31.1.tar.gz distribution file has been placed at
<ftp://ftp.gnustep.org/pub/gnustep/core>.
It is accompanied by gnustep-gui-0.31.0.tar.gz.sig, a PGP signature
It is accompanied by gnustep-gui-0.31.1.tar.gz.sig, a PGP signature
which you can validate by putting both files in the same directory and
using:
gpg --verify gnustep-gui-0.31.0.tar.gz.sig
gpg --verify gnustep-gui-0.31.1.tar.gz.sig
Signature has been created using the key with the following
fingerprint:

View file

@ -15,6 +15,19 @@
* Source/NSTableView.m: Update to use NSTableRowView
when it is view-based.
2024-06-05 Richard Frith-Macdonald <rfm@gnu.org>
* ChangeLog: Update for new release
* ANNOUNCE:
* NEWS:
* Documentation/news.texi: Update of release notes for 0.31.1.
* Version: bump to 0.31.1
2024-06-03 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSMenuitem.m:
Fix bug in decoding of archived menu item modifier mask.
2024-05-30 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSDisplayServer.m:

View file

@ -9,6 +9,17 @@
The currently released version of the library is @samp{@value{GNUSTEP-GUI-VERSION}}.
@end ifclear
@section Noteworthy changes in version @samp{0.31.1}
This is a bugfix release
@itemize @bullet
@item Fix bug decoding menu items (breaking archive)
@item Remove use of deprecated lock from base library
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.31.0}
This version adds view based cell support for NSTableView and NSOutlineView.
@ -49,8 +60,6 @@ Plus the usual bunch of bug fixes.
@item Improver CI pipeline.
@end itemize
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.30.0}
This version adds parsing support for layout constraints, compilation with MSVC

906
NEWS

File diff suppressed because it is too large Load diff

View file

@ -650,7 +650,6 @@ static Class imageClass;
NSString *action;
NSString *key;
BOOL isSeparator = NO;
NSNumber *keyMask;
if ([aDecoder containsValueForKey: @"NSIsSeparator"])
{
@ -703,13 +702,13 @@ static Class imageClass;
[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
{

View file

@ -10,49 +10,60 @@
int main()
{
START_SET("GSXib5KeyedUnarchiver NSButtonCell tests")
START_SET("GSXib5KeyedUnarchiver NSButtonCell tests")
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
NSData* data = [NSData dataWithContentsOfFile:@"ButtonCell.xib"];
GSXibKeyedUnarchiver* unarchiver = [GSXibKeyedUnarchiver unarchiverForReadingWithData:data];
NSData *data;
GSXibKeyedUnarchiver *unarchiver;
NSArray *rootObjects;
NSEnumerator *enumerator;
NSMatrix *matrix;
id element;
NSArray *rootObjects;
data = [NSData dataWithContentsOfFile: @"ButtonCell.xib"];
unarchiver = [GSXibKeyedUnarchiver unarchiverForReadingWithData:data];
rootObjects = [unarchiver decodeObjectForKey: @"IBDocument.RootObjects"];
NSMatrix* matrix;
for (id element in rootObjects) {
if ([element isKindOfClass:[NSMatrix class]]) {
enumerator = [rootObjects objectEnumerator];
while ((element = [enumerator nextObject]) != nil)
{
if ([element isKindOfClass: [NSMatrix class]])
{
matrix = (NSMatrix*)element;
break;
}
}
}
}
PASS(matrix != nil, "Top-level NSMatrix was found");
PASS(matrix != nil, "Top-level NSMatrix was found")
NSArray* cells = [matrix cells];
NSArray *cells = [matrix cells];
// <modifierMask key="keyEquivalentModifierMask" shift="YES"/> node
PASS_MODIFIER(0, NSShiftKeyMask);
PASS_MODIFIER(0, NSShiftKeyMask)
// <modifierMask key="keyEquivalentModifierMask" command="YES"/> node
PASS_MODIFIER(1, NSCommandKeyMask);
PASS_MODIFIER(1, NSCommandKeyMask)
// <modifierMask key="keyEquivalentModifierMask" />
PASS_MODIFIER(2, 0);
PASS_MODIFIER(2, 0)
// Unlike NSMenuItem, the default for NSButtonCell is 0
PASS_MODIFIER(3, 0);
PASS_MODIFIER(3, 0)
END_SET("GSXib5KeyedUnarchiver NSButtonCell tests")
END_SET("GSXib5KeyedUnarchiver NSButtonCell tests")
return 0;
}

View file

@ -9,56 +9,67 @@
int main()
{
START_SET("GSXib5KeyedUnarchiver NSMenu tests")
START_SET("GSXib5KeyedUnarchiver NSMenu tests")
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
NSData* data = [NSData dataWithContentsOfFile:@"Menu.xib"];
GSXibKeyedUnarchiver* unarchiver = [GSXibKeyedUnarchiver unarchiverForReadingWithData:data];
NSData *data
GSXibKeyedUnarchiver *unarchiver;
NSArray *rootObjects;
NSEnumerator *enumerator;
id element;
NSMenu *menu;
NSArray *rootObjects;
data = [NSData dataWithContentsOfFile:@"Menu.xib"];
unarchiver = [GSXibKeyedUnarchiver unarchiverForReadingWithData:data];
rootObjects = [unarchiver decodeObjectForKey: @"IBDocument.RootObjects"];
enumerator = [rootObjects objectenumerator];
NSMenu* menu;
for (id element in rootObjects) {
if ([element isKindOfClass:[NSMenu class]]) {
while ((element = [enumerator nextObject]) != nil)
{
if ([element isKindOfClass: [NSMenu class]])
{
menu = (NSMenu*)element;
break;
}
}
}
}
PASS(menu != nil, "Top-level NSMenu was found");
PASS(menu != nil, "Top-level NSMenu was found")
// Empty <modifierMask key="keyEquivalentModifierMask"/> node
PASS_MODIFIER(0, 0);
PASS_MODIFIER(0, 0)
// <modifierMask key="keyEquivalentModifierMask" shift="YES"/>
PASS_MODIFIER(1, NSShiftKeyMask);
PASS_MODIFIER(1, NSShiftKeyMask)
// <modifierMask key="keyEquivalentModifierMask" command="YES"/>
PASS_MODIFIER(2, NSCommandKeyMask);
PASS_MODIFIER(2, NSCommandKeyMask)
// <modifierMask key="keyEquivalentModifierMask" option="YES"/>
PASS_MODIFIER(3, NSAlternateKeyMask);
PASS_MODIFIER(3, NSAlternateKeyMask)
// No modifierMask element
PASS_MODIFIER(4, NSCommandKeyMask);
PASS_MODIFIER(4, NSCommandKeyMask)
// No modifierMask element and no keyEquivalent attribute
PASS_MODIFIER(5, NSCommandKeyMask);
PASS_MODIFIER(5, NSCommandKeyMask)
// no modfierMask
PASS_MODIFIER(6, NSCommandKeyMask);
PASS_MODIFIER(6, NSCommandKeyMask)
// empty modifierMask
PASS_MODIFIER(7, 0);
PASS_MODIFIER(7, 0)
// explicit modifier mask
PASS_MODIFIER(8, NSCommandKeyMask);
PASS_MODIFIER(8, NSCommandKeyMask)
END_SET("GSXib5KeyedUnarchiver NSMenu tests")
END_SET("GSXib5KeyedUnarchiver NSMenu tests")
return 0;
}

View file

@ -11,159 +11,159 @@ copyright 2004 Alexander Malmberg <alexander@malmberg.org>
int main(int argc, char **argv)
{
CREATE_AUTORELEASE_POOL(arp);
NSBezierPath *p=[[NSBezierPath alloc] init];
NSRect r;
CREATE_AUTORELEASE_POOL(arp);
NSBezierPath *p=[[NSBezierPath alloc] init];
NSRect r;
pass(NSIsEmptyRect([p bounds]),"empty path gives empty bounds");
pass(NSIsEmptyRect([p bounds]),"empty path gives empty bounds");
[p moveToPoint: NSMakePoint(100,100)];
[p lineToPoint: NSMakePoint(150,150)];
[p moveToPoint: NSMakePoint(100,100)];
[p lineToPoint: NSMakePoint(150,150)];
pass(NSEqualRects([p bounds],NSMakeRect(100,100,50,50)),"bounds accuracy (1)");
pass(NSEqualRects([p controlPointBounds],NSMakeRect(100,100,50,50)),"control-point bounds accuracy (1)");
pass(NSEqualRects([p bounds],NSMakeRect(100,100,50,50)),"bounds accuracy (1)");
pass(NSEqualRects([p controlPointBounds],NSMakeRect(100,100,50,50)),"control-point bounds accuracy (1)");
[p removeAllPoints];
pass(NSIsEmptyRect([p bounds]),"empty path gives empty bounds (2)");
[p removeAllPoints];
pass(NSIsEmptyRect([p bounds]),"empty path gives empty bounds (2)");
[p moveToPoint: NSMakePoint(100,100)];
[p curveToPoint: NSMakePoint(200,100)
controlPoint1: NSMakePoint(125,50)
controlPoint2: NSMakePoint(175,150)];
[p moveToPoint: NSMakePoint(100,100)];
[p curveToPoint: NSMakePoint(200,100)
controlPoint1: NSMakePoint(125,50)
controlPoint2: NSMakePoint(175,150)];
/* Basic checking Y. */
r=[p bounds];
if (fabs(r.origin.x - 100.0000) > 0.001 ||
fabs(r.origin.y - 85.5662) > 0.001 ||
fabs(r.size.width - 100.0000) > 0.001 ||
fabs(r.size.height - 28.8678) > 0.001)
{
pass(0,"bounds accuracy (2)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(100.0000, 85.5662, 100.0000, 28.8678)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"bounds accuracy (2)");
/* Basic checking Y. */
r=[p bounds];
if (fabs(r.origin.x - 100.0000) > 0.001 ||
fabs(r.origin.y - 85.5662) > 0.001 ||
fabs(r.size.width - 100.0000) > 0.001 ||
fabs(r.size.height - 28.8678) > 0.001)
{
pass(0,"bounds accuracy (2)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(100.0000, 85.5662, 100.0000, 28.8678)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"bounds accuracy (2)");
pass(NSEqualRects([p controlPointBounds],NSMakeRect(100,50,100,100)),"control-point bounds accuracy (2)");
pass(NSEqualRects([p controlPointBounds],NSMakeRect(100,50,100,100)),"control-point bounds accuracy (2)");
/* Basic checking X. */
[p removeAllPoints];
[p moveToPoint: NSMakePoint(100,100)];
[p curveToPoint: NSMakePoint(100,200)
controlPoint1: NSMakePoint(50,125)
controlPoint2: NSMakePoint(150,175)];
/* Basic checking X. */
[p removeAllPoints];
[p moveToPoint: NSMakePoint(100,100)];
[p curveToPoint: NSMakePoint(100,200)
controlPoint1: NSMakePoint(50,125)
controlPoint2: NSMakePoint(150,175)];
r=[p bounds];
if (fabs(r.origin.y - 100.0000) > 0.001 ||
fabs(r.origin.x - 85.5662) > 0.001 ||
fabs(r.size.height - 100.0000) > 0.001 ||
fabs(r.size.width - 28.8678) > 0.001)
{
pass(0,"bounds accuracy (3)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(85.5662, 100.0000, 28.8678, 100.0000)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"bounds accuracy (3)");
r=[p bounds];
if (fabs(r.origin.y - 100.0000) > 0.001 ||
fabs(r.origin.x - 85.5662) > 0.001 ||
fabs(r.size.height - 100.0000) > 0.001 ||
fabs(r.size.width - 28.8678) > 0.001)
{
pass(0,"bounds accuracy (3)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(85.5662, 100.0000, 28.8678, 100.0000)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"bounds accuracy (3)");
/* A bit of both, and extreme values beyond the initial points. */
[p removeAllPoints];
[p moveToPoint: NSMakePoint(-100,0)];
[p curveToPoint: NSMakePoint(100,0)
controlPoint1: NSMakePoint(-118.2, 10.393)
controlPoint2: NSMakePoint( 118.2,-10.393)];
/* A bit of both, and extreme values beyond the initial points. */
[p removeAllPoints];
[p moveToPoint: NSMakePoint(-100,0)];
[p curveToPoint: NSMakePoint(100,0)
controlPoint1: NSMakePoint(-118.2, 10.393)
controlPoint2: NSMakePoint( 118.2,-10.393)];
r=[p bounds];
if (fabs(r.origin.x + 101.0) > 0.001 ||
fabs(r.origin.y + 3.0) > 0.001 ||
fabs(r.size.width - 202.0) > 0.001 ||
fabs(r.size.height - 6.0) > 0.001)
{
pass(0,"bounds accuracy (4)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(-101.0, -3.0, 202.0, 6.0)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"bounds accuracy (4)");
r=[p bounds];
if (fabs(r.origin.x + 101.0) > 0.001 ||
fabs(r.origin.y + 3.0) > 0.001 ||
fabs(r.size.width - 202.0) > 0.001 ||
fabs(r.size.height - 6.0) > 0.001)
{
pass(0,"bounds accuracy (4)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(-101.0, -3.0, 202.0, 6.0)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"bounds accuracy (4)");
/* Check the control-point bounding box. */
r=[p controlPointBounds];
if (fabs(r.origin.x + 118.2 ) > 0.001 ||
fabs(r.origin.y + 10.393) > 0.001 ||
fabs(r.size.width - 236.4 ) > 0.001 ||
fabs(r.size.height - 20.786) > 0.001)
{
pass(0,"control-point bounds accuracy (3)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(-118.2, -10.393, 236.4, 20.786)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"control-point bounds accuracy (3)");
/* Check the control-point bounding box. */
r=[p controlPointBounds];
if (fabs(r.origin.x + 118.2 ) > 0.001 ||
fabs(r.origin.y + 10.393) > 0.001 ||
fabs(r.size.width - 236.4 ) > 0.001 ||
fabs(r.size.height - 20.786) > 0.001)
{
pass(0,"control-point bounds accuracy (3)");
printf("expected %s, got %s\n",
[NSStringFromRect(NSMakeRect(-118.2, -10.393, 236.4, 20.786)) lossyCString],
[NSStringFromRect(r) lossyCString]);
}
else
pass(1,"control-point bounds accuracy (3)");
/*
/*
p=(1-t)^3*a + 3*(1-t)^2*t*b + 3*(1-t)*t^2*c + t^3*d
p=(1-t)^3*a + 3*(1-t)^2*t*b + 3*(1-t)*t^2*c + t^3*d
c-2b+a +- sqrt(a(d-c)+b(-d-c)+c^2+b^2)
t= --------------------------------------
-d+3c-3b+a
c-2b+a +- sqrt(a(d-c)+b(-d-c)+c^2+b^2)
t= --------------------------------------
-d+3c-3b+a
*/
*/
if (0)
{
NSPoint a,b,c,d;
double t1,t2;
double t,ti;
NSPoint p;
if (0)
{
NSPoint a,b,c,d;
double t1,t2;
double t,ti;
NSPoint p;
a=NSMakePoint(-100,0);
b=NSMakePoint(-118.2,10.39);
c=NSMakePoint(118.2,-10.39);
d=NSMakePoint(100,0);
a=NSMakePoint(-100,0);
b=NSMakePoint(-118.2,10.39);
c=NSMakePoint(118.2,-10.39);
d=NSMakePoint(100,0);
#define D \
ti=1.0-t; \
p.x=ti*ti*ti*a.x + 3*ti*ti*t*b.x + 3*ti*t*t*c.x + t*t*t*d.x; \
p.y=ti*ti*ti*a.y + 3*ti*ti*t*b.y + 3*ti*t*t*c.y + t*t*t*d.y; \
printf(" t=%15.7f (%15.7f %15.7f)\n",t,p.x,p.y);
ti=1.0-t; \
p.x=ti*ti*ti*a.x + 3*ti*ti*t*b.x + 3*ti*t*t*c.x + t*t*t*d.x; \
p.y=ti*ti*ti*a.y + 3*ti*ti*t*b.y + 3*ti*t*t*c.y + t*t*t*d.y; \
printf(" t=%15.7f (%15.7f %15.7f)\n",t,p.x,p.y);
t=0; D
t=1; D
t=0.5; D
t=0; D
t=1; D
t=0.5; D
t1=(c.x-2*b.x+a.x + sqrt(a.x*(d.x-c.x)+b.x*(-d.x-c.x)+c.x*c.x+b.x*b.x)) / (-d.x+3*c.x-3*b.x+a.x);
t2=(c.x-2*b.x+a.x - sqrt(a.x*(d.x-c.x)+b.x*(-d.x-c.x)+c.x*c.x+b.x*b.x)) / (-d.x+3*c.x-3*b.x+a.x);
printf("x:\n");
t1=(c.x-2*b.x+a.x + sqrt(a.x*(d.x-c.x)+b.x*(-d.x-c.x)+c.x*c.x+b.x*b.x)) / (-d.x+3*c.x-3*b.x+a.x);
t2=(c.x-2*b.x+a.x - sqrt(a.x*(d.x-c.x)+b.x*(-d.x-c.x)+c.x*c.x+b.x*b.x)) / (-d.x+3*c.x-3*b.x+a.x);
printf("x:\n");
t=t1;
D
t=t2;
D
t=t1;
D
t=t2;
D
t1=(c.y-2*b.y+a.y + sqrt(a.y*(d.y-c.y)+b.y*(-d.y-c.y)+c.y*c.y+b.y*b.y)) / (-d.y+3*c.y-3*b.y+a.y);
t2=(c.y-2*b.y+a.y - sqrt(a.y*(d.y-c.y)+b.y*(-d.y-c.y)+c.y*c.y+b.y*b.y)) / (-d.y+3*c.y-3*b.y+a.y);
printf("y:\n");
t=t1;
D
t=t2;
D
}
t1=(c.y-2*b.y+a.y + sqrt(a.y*(d.y-c.y)+b.y*(-d.y-c.y)+c.y*c.y+b.y*b.y)) / (-d.y+3*c.y-3*b.y+a.y);
t2=(c.y-2*b.y+a.y - sqrt(a.y*(d.y-c.y)+b.y*(-d.y-c.y)+c.y*c.y+b.y*b.y)) / (-d.y+3*c.y-3*b.y+a.y);
printf("y:\n");
t=t1;
D
t=t2;
D
}
// printf("bounds=%@\n",NSStringFromRect([p bounds]));
DESTROY(arp);
DESTROY(arp);
return 0;
return 0;
}

View file

@ -8,44 +8,57 @@
int main()
{
START_SET("NSButtonCell encoding tests")
START_SET("NSButtonCell encoding tests")
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
NSString* mask = @"NSButtonFlags2";
NSButtonCell* item = [[NSButtonCell alloc] init];
NSString *mask = @"NSButtonFlags2";
NSButtonCell *item = [[NSButtonCell alloc] init];
item.keyEquivalent = @"A";
item.keyEquivalentModifierMask = NSShiftKeyMask;
NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver;
[archiver encodeRootObject:item];
archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData: data];
[archiver encodeRootObject: item];
[archiver finishEncoding];
NSError* error;
NSDictionary* archive = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:nil error:&error];
NSError *error;
NSDictionary *archive;
NSArray* topLevelObjects = [archive objectForKey:@"$objects"];
archive = [NSPropertyListSerialization
propertyListWithData: data
options: NSPropertyListImmutable
format: nil
error: &error];
NSDictionary* dict;
NSArray *topLevelObjects = [archive objectForKey: @"$objects"];
NSEnumerator *enumerator = [topLevelObjects objectEnumerator];
NSDictionary *dict;
id element;
for (id element in topLevelObjects)
while ((element = [enumerator nextObject]) != nil)
{
if ([element isKindOfClass:[NSDictionary class]])
if ([element isKindOfClass: [NSDictionary class]])
{
dict = (NSDictionary*)element;
if ([[dict allKeys] containsObject:mask])
if ([[dict allKeys] containsObject: mask])
{
break;
}
@ -53,14 +66,22 @@ int main()
{
dict = nil;
}
}
}
}
}
PASS(dict != nil, "Found a dict with a NSButtonFlags2 entry");
NSNumber* encodedKeyMask = [dict valueForKey:mask];
NSNumber *encodedKeyMask = [dict valueForKey: mask];
int expect = (NSShiftKeyMask << 8);
int modMask = (NSEventModifierFlagDeviceIndependentFlagsMask << 8);
int found = [encodedKeyMask intValue] & modMask;
PASS(encodedKeyMask != nil, "Retrieved the NSButtonFlags2 value");
PASS([encodedKeyMask intValue] & NSEventModifierFlagDeviceIndependentFlagsMask << 8 == NSShiftKeyMask, "Encoded key mask 0x%x matches expected key mask 0x%x", [encodedKeyMask intValue] & NSEventModifierFlagDeviceIndependentFlagsMask << 8, NSShiftKeyMask << 8);
PASS(found == expect,
"Encoded key mask 0x%x matches expected key mask 0x%x",
found, expect);
END_SET("NSButtonCell encoding tests")
}
END_SET("NSButtonCell encoding tests")
return 0;
}

View file

@ -7,30 +7,42 @@
int main()
{
NSString* mask = @"NSKeyEquivModMask";
NSMenuItem* item = [[NSMenuItem alloc] init];
START_SET("NSMenuItem key equivalent mask")
NSString *mask = @"NSKeyEquivModMask";
NSMenuItem *item = [[NSMenuItem alloc] init];
NSMutableData *data = [NSMutableData data];
NSNumber *encodedKeyMask;
NSError *error = nil;
NSDictionary *dict = nil;
NSArray *topLevelObjects;
NSKeyedArchiver *archiver;
NSDictionary *archive;
NSEnumerator *enumerator;
id element;
item.keyEquivalentModifierMask = NSShiftKeyMask;
NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData: data];
[archiver encodeRootObject:item];
[archiver encodeRootObject: item];
[archiver finishEncoding];
NSError* error;
NSDictionary* archive = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:nil error:&error];
archive = [NSPropertyListSerialization propertyListWithData: data
options: NSPropertyListImmutable
format: nil
error: &error];
NSArray* topLevelObjects = [archive objectForKey:@"$objects"];
topLevelObjects = [archive objectForKey: @"$objects"];
enumerator = [topLevelObjects objectEnumerator];
NSDictionary* dict;
for (id element in topLevelObjects)
while ((element = [enumerator nextObject]) != nil)
{
if ([element isKindOfClass:[NSDictionary class]])
if ([element isKindOfClass: [NSDictionary class]])
{
dict = (NSDictionary*)element;
if ([[dict allKeys] containsObject:mask])
if ([[dict allKeys] containsObject: mask])
{
break;
}
@ -43,7 +55,13 @@ int main()
PASS(dict != nil, "Found a dict with a NSKeyEquivModMask entry");
NSNumber* encodedKeyMask = [dict valueForKey:mask];
PASS(encodedKeyMask != nil, "Retrieved the NSKeyEquivModMask value");
PASS([encodedKeyMask intValue] == NSShiftKeyMask, "Encoded key mask 0x%x matches expected key mask 0x%x", [encodedKeyMask intValue], NSShiftKeyMask);
}
encodedKeyMask = [dict valueForKey: mask];
PASS(encodedKeyMask != nil, "Retrieved the NSKeyEquivModMask value")
PASS([encodedKeyMask intValue] == NSShiftKeyMask,
"Encoded key mask 0x%x matches expected key mask 0x%x",
[encodedKeyMask intValue], NSShiftKeyMask)
END_SET("NSMenuItem key equivalent mask")
return 0;
}

View file

@ -16,24 +16,27 @@
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"])
@ -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
{

View file

@ -11,9 +11,9 @@ GNUSTEP_GUI_LIBTIFF=3.4
# The version number of this release.
GNUSTEP_GUI_MAJOR_VERSION=0
GNUSTEP_GUI_MINOR_VERSION=31
GNUSTEP_GUI_SUBMINOR_VERSION=0
GNUSTEP_GUI_SUBMINOR_VERSION=1
# numeric value should match above
VERSION_NUMBER=031.0
VERSION_NUMBER=031.1
GNUSTEP_GUI_VERSION=${GNUSTEP_GUI_MAJOR_VERSION}.${GNUSTEP_GUI_MINOR_VERSION}.${GNUSTEP_GUI_SUBMINOR_VERSION}
VERSION=${GNUSTEP_GUI_VERSION}