Add userInfo accessor to NSProgress.

This commit is contained in:
Frederik Seiffert 2022-04-29 14:38:35 +02:00 committed by Frederik Seiffert
parent 57eae2e779
commit 8ca4381676
3 changed files with 13 additions and 2 deletions

View file

@ -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");