Add coverage for testing initial and final layout attributes without a transitioning delegate

Summary: Duplicates an existing test and tests the same circumstances without a section controller `transitionDelegate` set. This causes all the logic to no-op and return the same instance of the original layout attributes object.

Differential Revision: D49900561

fbshipit-source-id: 8f768a998308c1aff73e8195aacdfd70579be601
This commit is contained in:
Tim Oliver 2023-10-06 03:08:34 -07:00 committed by Facebook GitHub Bot
parent 97570b41d7
commit 312e0a03ba

View file

@ -1734,6 +1734,24 @@
IGAssertEqualPoint(finalAttribute.center, attribute.center.x + offset.x ,attribute.center.y + offset.y);
}
- (void)test_whenModifyingInitialAndFinalAttribute_withoutTransitionDelegate_thatLayoutIsCorrect {
// set up the custom layout
IGListCollectionViewLayout *layout = [[IGListCollectionViewLayout alloc] initWithStickyHeaders:NO topContentInset:0 stretchToEdge:YES];
self.collectionView.collectionViewLayout = layout;
IGTestObject *object = genTestObject(@1, @2);
[self setupWithObjects:@ [object]];
// When no transition delegate is set, the initial and final layout methods no-op, so these values should all match
NSIndexPath *indexPath = genIndexPath(0, 0);
UICollectionViewLayoutAttributes *attribute = [layout layoutAttributesForItemAtIndexPath:indexPath];
UICollectionViewLayoutAttributes *initialAttribute = [layout initialLayoutAttributesForAppearingItemAtIndexPath:indexPath];
UICollectionViewLayoutAttributes *finalAttribute = [layout finalLayoutAttributesForDisappearingItemAtIndexPath:indexPath];
IGAssertEqualPoint(attribute.center, initialAttribute.center.x, initialAttribute.center.y);
IGAssertEqualPoint(attribute.center, finalAttribute.center.x, finalAttribute.center.y);
}
- (void)test_whenSwappingCollectionViewsAfterUpdate_thatUpdatePerformedOnTheCorrectCollectionView {
// BEGIN: setup of FIRST adapter+dataSource+collectionView
IGListAdapter *adapter1 = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new] viewController:nil];