Make sure -[CPArrayController arrangedObjects] always has a non-nil value.

This commit is contained in:
Brian Donovan committed 2011-03-15 19:53:14 -07:00
1 parent e1d45fd385
commit abce41d6fd
2 files changed
+19 -1

No files matched your search

+1 -1
View File
@@ -136,7 +136,7 @@
_sortDescriptors = [CPArray array];
_filterPredicate = nil;
_selectionIndexes = [CPIndexSet indexSet];
_arrangedObjects = nil;
_arrangedObjects = [CPArray array];
}
- (void)prepareContent
+18
View File
@@ -56,6 +56,24 @@
[self assert:object equals:[[arrayController arrangedObjects] objectAtIndex:1]];
}
- (void)testAddObjectUpdatesArrangedObjectsWithoutSortDescriptors
{
var arrayController = [[CPArrayController alloc] init];
[arrayController addObject:@"content"];
[self assert:[@"content"] equals:[arrayController content]];
[self assert:[@"content"] equals:[arrayController arrangedObjects]];
}
- (void)testInsertObjectUpdatesArrangedObjectsWithoutSortDescriptors
{
var arrayController = [[CPArrayController alloc] init];
[arrayController insertObject:@"content" atArrangedObjectIndex:0];
[self assert:[@"content"] equals:[arrayController content]];
[self assert:[@"content"] equals:[arrayController arrangedObjects]];
}
- (void)testSelectPrevious
{
var arrayController = [self arrayController];