libs-gui/Tests/gui/NSCell/basic.m
fredkiefer e45644b3fd * 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
2013-03-18 22:50:11 +00:00

60 lines
1.5 KiB
Objective-C

#import "ObjectTesting.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSAutoreleasePool.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSCell.h>
#import <AppKit/NSImage.h>
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
id testObject;
id testObject1;
id testObject2;
NSArray *testObjects;
[NSApplication sharedApplication];
test_alloc(@"NSCell");
testObject = [NSCell new];
testObject1 = [[NSCell alloc] initImageCell: [NSImage imageNamed: @"GNUstep"]];
testObject2 = [[NSCell alloc] initTextCell: @"GNUstep"];
testObjects = [NSArray arrayWithObjects: testObject, testObject1, testObject2, nil];
test_NSObject(@"NSCell", testObjects);
test_NSCoding(testObjects);
test_keyed_NSCoding(testObjects);
test_NSCopying(@"NSCell",
@"NSCell",
testObjects, NO, NO);
[arp release];
return 0;
}
@implementation NSCell (Testing)
- (BOOL) isEqual: (id)anObject
{
if (self == anObject)
return YES;
if (![anObject isKindOfClass: [NSCell class]])
return NO;
if (![[anObject stringValue] isEqual: [self stringValue]])
return NO;
if (![[anObject title] isEqual: [self title]])
return NO;
if (!([anObject image] == [self image]) && ![[anObject image] isEqual: [self image]])
{
NSLog(@"image differ %@ %@", [self image], [anObject image]);
return NO;
}
if ([anObject type] != [self type])
return NO;
if ([anObject tag] != [self tag])
return NO;
return YES;
}
@end