mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Add NSProgress
This commit is contained in:
parent
dd36855923
commit
9c4d2ca982
5 changed files with 178 additions and 5 deletions
44
Tests/base/NSProgress/basic.m
Normal file
44
Tests/base/NSProgress/basic.m
Normal file
|
@ -0,0 +1,44 @@
|
|||
#import <Foundation/NSProgress.h>
|
||||
#import <Foundation/NSThread.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import "ObjectTesting.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
id obj1;
|
||||
id obj2;
|
||||
NSMutableArray *testObjs = [[NSMutableArray alloc] init];
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSDictionary *dict = [NSDictionary dictionary];
|
||||
NSProgress *progress = [[NSProgress alloc] initWithParent: nil
|
||||
userInfo: dict];
|
||||
PASS(progress != nil, "[NSProgress initWithParent:userInfo:] returns instance");
|
||||
|
||||
progress = [NSProgress discreteProgressWithTotalUnitCount:100];
|
||||
PASS(progress != nil, "[NSProgress discreteProgressWithTotalUnitCount:] returns instance");
|
||||
|
||||
progress = [NSProgress progressWithTotalUnitCount:100];
|
||||
PASS(progress != nil, "[NSProgress progressWithTotalUnitCount:] returns instance");
|
||||
|
||||
progress = [NSProgress progressWithTotalUnitCount:100
|
||||
parent:progress
|
||||
pendingUnitCount:50];
|
||||
PASS(progress != nil, "[NSProgress progressWithTotalUnitCount:] returns instance");
|
||||
|
||||
[progress becomeCurrentWithPendingUnitCount:50];
|
||||
NSProgress *currentProgress = [NSProgress currentProgress];
|
||||
PASS(currentProgress == progress, "Correct progress object associated with current thread");
|
||||
|
||||
NSProgress *new_progress = [NSProgress progressWithTotalUnitCount:100
|
||||
parent:progress
|
||||
pendingUnitCount:50];
|
||||
[new_progress addChild:[[NSProgress alloc] initWithParent: nil userInfo: nil]
|
||||
withPendingUnitCount:50];
|
||||
|
||||
[currentProgress resignCurrent];
|
||||
|
||||
PASS([NSProgress currentProgress] == nil, "Current progress is nil after resign current");
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue