mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 19:20:37 +00:00
* Tests/gui/NSImage/basic.m: Add basic tests for NSImage.
* Tests/gui/NSCell/basic.m: Extend basic tests for NSCell. * Source/NSImage.m: Try to correct keyed encoding/decoding. Add incomplete isEqual: method. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36384 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0334fe3bca
commit
e45644b3fd
5 changed files with 172 additions and 49 deletions
56
Tests/gui/NSImage/basic.m
Normal file
56
Tests/gui/NSImage/basic.m
Normal file
|
@ -0,0 +1,56 @@
|
|||
#import "ObjectTesting.h"
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <AppKit/NSApplication.h>
|
||||
#import <AppKit/NSImage.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
id testObject;
|
||||
id testObject1;
|
||||
id testObject2;
|
||||
NSArray *testObjects;
|
||||
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
test_alloc(@"NSImage");
|
||||
|
||||
testObject = [NSImage new];
|
||||
testObject1 = [NSImage imageNamed: @"GNUstep"];
|
||||
testObject2 = [[NSImage alloc] initWithData: nil];
|
||||
|
||||
testObjects = [NSArray arrayWithObjects: testObject, testObject1, testObject2, nil];
|
||||
RELEASE(testObject);
|
||||
|
||||
test_NSObject(@"NSImage", testObjects);
|
||||
test_NSCoding(testObjects);
|
||||
test_keyed_NSCoding(testObjects);
|
||||
test_NSCopying(@"NSImage",
|
||||
@"NSImage",
|
||||
testObjects, NO, NO);
|
||||
|
||||
[arp release];
|
||||
return 0;
|
||||
}
|
||||
|
||||
@implementation NSImage (Testing)
|
||||
|
||||
- (BOOL) isEqual: (id)anObject
|
||||
{
|
||||
if (self == anObject)
|
||||
return YES;
|
||||
if (![anObject isKindOfClass: [NSImage class]])
|
||||
return NO;
|
||||
if (![[anObject backgroundColor] isEqual: [self backgroundColor]])
|
||||
return NO;
|
||||
if ([anObject isFlipped] != [self isFlipped])
|
||||
return NO;
|
||||
if (!NSEqualSizes([anObject size], [self size]))
|
||||
return NO;
|
||||
|
||||
// FIXME
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue