From 41c0781aa9f47acc7592ae6875e8c55ffe87026f Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Thu, 20 Oct 2016 14:41:11 -0700 Subject: [PATCH] Update exception test for new constrainedSize method (#2445) --- .../ASCollectionViewFlowLayoutInspectorTests.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/AsyncDisplayKitTests/ASCollectionViewFlowLayoutInspectorTests.m b/AsyncDisplayKitTests/ASCollectionViewFlowLayoutInspectorTests.m index 22b2768d6d..443e1d7534 100644 --- a/AsyncDisplayKitTests/ASCollectionViewFlowLayoutInspectorTests.m +++ b/AsyncDisplayKitTests/ASCollectionViewFlowLayoutInspectorTests.m @@ -402,22 +402,24 @@ - (void)testThatItThrowsIfNodeConstrainedSizeIsImplementedOnDataSourceButNotOnDelegateFlowLayoutInspector { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - ASCollectionView *collectionView = [[ASCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + ASCollectionNode *node = [[ASCollectionNode alloc] initWithCollectionViewLayout:layout]; + ASCollectionView *collectionView = node.view; id dataSourceAndDelegate = [OCMockObject mockForProtocol:@protocol(InspectorTestDataSourceDelegateProtocol)]; ASSizeRange constrainedSize = ASSizeRangeMake(CGSizeZero, CGSizeZero); NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0]; NSValue *value = [NSValue value:&constrainedSize withObjCType:@encode(ASSizeRange)]; - [[[dataSourceAndDelegate stub] andReturnValue:value] collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]; - collectionView.asyncDataSource = dataSourceAndDelegate; + [[[dataSourceAndDelegate stub] andReturnValue:value] collectionNode:node constrainedSizeForItemAtIndexPath:indexPath]; + node.dataSource = dataSourceAndDelegate; id delegate = [InspectorTestDataSourceDelegateWithoutNodeConstrainedSize new]; - collectionView.asyncDelegate = delegate; + node.delegate = delegate; ASCollectionViewFlowLayoutInspector *inspector = collectionView.layoutInspector; + XCTAssertThrows([inspector collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]); - collectionView.asyncDelegate = dataSourceAndDelegate; + node.delegate = dataSourceAndDelegate; XCTAssertNoThrow([inspector collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath]); }