From c9e0ab654fd4a132fc4fd21b33df8ff9f04cb5b1 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Thu, 23 Sep 2010 10:58:20 +0200 Subject: [PATCH] test observations during setSelectionIndexes --- Tests/AppKit/CPArrayControllerTest.j | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Tests/AppKit/CPArrayControllerTest.j b/Tests/AppKit/CPArrayControllerTest.j index 1b9e47160..dd6c574e8 100644 --- a/Tests/AppKit/CPArrayControllerTest.j +++ b/Tests/AppKit/CPArrayControllerTest.j @@ -245,6 +245,19 @@ [self assert:[CPIndexSet indexSetWithIndex:0] equals:observation.newValue message:"new selected index should be 0"]; } +- (void)testObservationDuringSetSelectionIndexes +{ + var arrayController = [self arrayController], + newContent = [self setupObservationFixture]; + + var newSelection = [CPIndexSet indexSetWithIndex:2]; + [arrayController setSelectionIndexes:newSelection]; + + [self assertNotNull:[arrayController selection] message:@"a selection was made, selection proxy should be defined"]; + [self assert:2 equals:[observations count] message:@"exactly 2 change notifications should be sent for new selection indexes"]; + [self assert:newSelection equals:[arrayController selectionIndexes] message:@"selection was not set properly"]; +} + - (void)observeValueForKeyPath:keyPath ofObject:anActivity change:change