From 24fbfbee6012bdb359ed0765f312cd37a603abcf Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Fri, 17 Feb 2012 14:26:28 +0000 Subject: [PATCH] Unit test for previous fix. --- Tests/AppKit/CPCollectionViewTest.j | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tests/AppKit/CPCollectionViewTest.j b/Tests/AppKit/CPCollectionViewTest.j index 36a7a787e..eefe2a9bc 100644 --- a/Tests/AppKit/CPCollectionViewTest.j +++ b/Tests/AppKit/CPCollectionViewTest.j @@ -46,7 +46,7 @@ reloadContentCount = [collectionView reloadContentCallCount]; [collectionView setContent:content]; - [self assert:reloadContentCount+1 equals:[collectionView reloadContentCallCount] message:@"first call to setContent should have called reloadContent once"]; + [self assert:reloadContentCount + 1 equals:[collectionView reloadContentCallCount] message:@"first call to setContent should have called reloadContent once"]; [content removeObjectAtIndex:0]; [self assertTrue:[collectionView content] === content message:@"collection view content should be as assigned"]; @@ -54,7 +54,7 @@ // make sure we call reloadContent even when the content hasn't changed for key-value binding compatibility reloadContentCount = [collectionView reloadContentCallCount]; [collectionView setContent:content]; - [self assert:[collectionView reloadContentCallCount] equals:reloadContentCount+1 message:@"subsequent calls to setContent should have called reloadContent once"]; + [self assert:[collectionView reloadContentCallCount] equals:reloadContentCount + 1 message:@"subsequent calls to setContent should have called reloadContent once"]; } - (void)testCallCollectionViewDidChangeSelectionDelegateMethod @@ -86,6 +86,14 @@ [self assert:"selection changed: 1" equals:_globalResults]; } +- (void)testSelectionIndexes +{ + [_collectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:0]]; + [self assert:[CPIndexSet indexSetWithIndex:0] equals:[_collectionView selectionIndexes]]; + [_collectionView setSelectionIndexes:nil]; + [self assert:[CPIndexSet indexSet] equals:[_collectionView selectionIndexes]]; +} + @end @implementation _CPCollectionViewWithHooks : CPCollectionView