mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Add userInfo accessor to NSProgress.
This commit is contained in:
parent
57eae2e779
commit
8ca4381676
3 changed files with 13 additions and 2 deletions
|
@ -118,6 +118,7 @@ GS_NSProgress_IVARS;
|
|||
- (void) setKind: (NSProgressKind)k;
|
||||
- (void) setUserInfoObject: (id)obj
|
||||
forKey: (NSProgressUserInfoKey)key;
|
||||
- (GS_GENERIC_CLASS(NSDictionary,NSProgressUserInfoKey,id) *)userInfo;
|
||||
|
||||
// Instance property accessors...
|
||||
- (void) setFileOperationKind: (NSProgressFileOperationKind)k;
|
||||
|
|
|
@ -116,7 +116,6 @@ static NSMutableDictionary *__subscribers = nil;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(internal->_userInfo);
|
||||
RELEASE(internal->_fileOperationKind);
|
||||
RELEASE(internal->_kind);
|
||||
RELEASE(internal->_estimatedTimeRemaining);
|
||||
|
@ -345,6 +344,11 @@ static NSMutableDictionary *__subscribers = nil;
|
|||
[internal->_userInfo setObject: obj forKey: key];
|
||||
}
|
||||
|
||||
- (GS_GENERIC_CLASS(NSDictionary,NSProgressUserInfoKey,id) *)userInfo
|
||||
{
|
||||
return AUTORELEASE([internal->_userInfo copy]);
|
||||
}
|
||||
|
||||
// Instance property accessors...
|
||||
- (void) setFileOperationKind: (NSProgressFileOperationKind)k;
|
||||
{
|
||||
|
|
|
@ -6,11 +6,17 @@
|
|||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSDictionary *dict = [NSDictionary dictionary];
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
||||
[dict setObject:@"value" forKey:@"key"];
|
||||
NSProgress *progress = [[NSProgress alloc] initWithParent: nil
|
||||
userInfo: dict];
|
||||
PASS(progress != nil, "[NSProgress initWithParent:userInfo:] returns instance");
|
||||
|
||||
PASS_EQUAL([progress userInfo], dict, @"[NSProgress userInfo] returns correct user info");
|
||||
|
||||
[progress setUserInfoObject:@"new value" forKey:@"key"];
|
||||
PASS_EQUAL([[progress userInfo] objectForKey:@"key"], @"new value", @"[NSProgress setUserInfoObject:forKey:] updates user info");
|
||||
|
||||
progress = [NSProgress discreteProgressWithTotalUnitCount:100];
|
||||
PASS(progress != nil, "[NSProgress discreteProgressWithTotalUnitCount:] returns instance");
|
||||
|
||||
|
|
Loading…
Reference in a new issue