CPArrayController -setContent: fixed a bug where objects where not rearranged if clearsFilterPredicateOnInsertion == YES and filterPredicate == nil.

This commit is contained in:
cacaodev committed 2011-01-19 19:26:01 +01:00
1 parent 66a87c472b
commit 59cc590b51
2 files changed
+13 -3

No files matched your search

+12 -2
View File
@@ -1,5 +1,6 @@
@import <AppKit/CPArrayController.j>
@import <AppKit/CPTextField.j>
@implementation CPArrayControllerTest : OJTestCase
{
@@ -190,8 +191,7 @@
[arrayController setContent:newContent];
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes]
message:@"last object cannot be selected"];
[self assert:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 2)] equals:[arrayController selectionIndexes] message:@"last object cannot be selected"];
}
- (void)testContentBinding
@@ -354,6 +354,16 @@
[self assert:@"Building 1" equals:[[self arrayController] valueForKeyPath:@"selection.department.building"]];
}
- (void)testArrangedObjectsNotEmptyAfterSetContentWhenClearsFilterOnInsertionIsTrue
{
var arrayController = [[CPArrayController alloc] init];
[arrayController setFilterPredicate:nil];
[arrayController setClearsFilterPredicateOnInsertion:YES];
[arrayController setContent:[CPArray arrayWithObject:@"a"]];
[self assertTrue:[[arrayController arrangedObjects] count] > 0];
}
- (void)observeValueForKeyPath:keyPath
ofObject:anActivity
change:change