Add coverage for minium invalidated section in IGListCollectionViewLayout

Summary: Added a test to properly cover the `if (lastValidSection >= 0 && lastValidSection < sectionCount)` check in the `_calculateLayoutIfNeeded` pass inside `IGListCollectionViewLayout`.

Reviewed By: fabiomassimo

Differential Revision: D50000785

fbshipit-source-id: fe6b99f9592a1ae08299c599dadb03d7b8a958dc
This commit is contained in:
Tim Oliver 2023-10-11 22:30:36 -07:00 committed by Facebook GitHub Bot
parent a18565b8b2
commit 1c73ecb4e7

View file

@ -1248,6 +1248,30 @@ static const CGRect kTestFrame = (CGRect){{0, 0}, {100, 100}};
IGAssertEqualFrame([self cellForSection:0 item:2].frame, 40, 0, 20, 20);
}
- (void)test_whenMarkingASectionAsUpdated_thatLayoutUpdates {
[self setUpWithStickyHeaders:NO topInset:0];
[self prepareWithData:@[
[[IGLayoutTestSection alloc] initWithInsets:UIEdgeInsetsZero
lineSpacing:0
interitemSpacing:0
headerHeight:0
footerHeight:0
items:@[
[[IGLayoutTestItem alloc] initWithSize:CGSizeMake(10, 10)],
[[IGLayoutTestItem alloc] initWithSize:CGSizeMake(10, 10)],
]],
]];
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 10, 10);
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 10, 0, 10, 10);
[self.layout didModifySection:1];
[self.layout prepareLayout];
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 10, 10);
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 10, 0, 10, 10);
}
#pragma mark - Internal debugging
- (void)test_withDelegateNameDebugger_thatReturnedNamesAreValid {