mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-19 12:49:02 +00:00
Update exception test for new constrainedSize method (#2445)
This commit is contained in:
parent
d0421195eb
commit
41c0781aa9
@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user