Skip to content

Commit

Permalink
Add coverage for minium invalidated section in IGListCollectionViewLa…
Browse files Browse the repository at this point in the history
…yout

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
  • Loading branch information
TimOliver authored and facebook-github-bot committed Oct 12, 2023
1 parent a18565b commit 1c73ecb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Tests/IGListCollectionViewLayoutTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,30 @@ - (void)test_whenUpdatingSizes_thatLayoutUpdates {
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 {
Expand Down

0 comments on commit 1c73ecb

Please sign in to comment.