2011-02-19 16:57:57 +00:00
|
|
|
/*
|
|
|
|
copyright 2004 Alexander Malmberg <alexander@malmberg.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Testing.h"
|
|
|
|
|
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSAutoreleasePool.h>
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
#include <AppKit/NSPasteboard.h>
|
|
|
|
|
|
|
|
static NSString *theString=@"QUUX!!1!!\"$!";
|
|
|
|
|
|
|
|
@interface Foo : NSObject
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation Foo
|
|
|
|
+(void) pasteboard: (NSPasteboard *)pb
|
|
|
|
provideDataForType: (NSString *)type
|
|
|
|
{
|
|
|
|
// printf("pasteboard: %@ provideDataForType: %@\n",pb,type);
|
|
|
|
[pb setString: theString
|
|
|
|
forType: NSStringPboardType];
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
CREATE_AUTORELEASE_POOL(arp);
|
|
|
|
|
|
|
|
NSPasteboard *pb=[NSPasteboard pasteboardWithName: @"lazy copy test"];
|
|
|
|
NSString *s;
|
|
|
|
|
2017-12-28 16:18:03 +00:00
|
|
|
[pb declareTypes: [NSArray arrayWithObject: NSStringPboardType]
|
2011-02-19 16:57:57 +00:00
|
|
|
owner: [Foo self]];
|
|
|
|
DESTROY(arp);
|
|
|
|
|
|
|
|
arp=[NSAutoreleasePool new];
|
|
|
|
pb=[NSPasteboard pasteboardWithName: @"lazy copy test"];
|
|
|
|
s=[pb stringForType: NSStringPboardType];
|
|
|
|
|
2016-05-13 15:41:27 +00:00
|
|
|
testHopeful = YES;
|
2011-02-19 16:57:57 +00:00
|
|
|
pass([s isEqual: theString], "NSPasteboard handles lazy setting of data");
|
2016-05-13 15:41:27 +00:00
|
|
|
testHopeful = NO;
|
2011-02-19 16:57:57 +00:00
|
|
|
|
|
|
|
DESTROY(arp);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-05-13 15:41:27 +00:00
|
|
|
|