mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-24 01:38:26 +00:00
Add test for IGListAdapter dequeue method
Summary: Adding a test to catch the bug that caused the crash in T33376364. In that bug, dequeueing two cells of the same class, but with different reuse identifiers, would cause a crash. Here in the test, if the same bug were to occur the dequeuing of the second cell would throw an exception and the test would fail. Differential Revision: D9560911 fbshipit-source-id: 9310839aaf441e919b5d443feaa44c71e991d146
This commit is contained in:
parent
3b19cfb9d7
commit
3cf7e3e95c
1 changed files with 15 additions and 0 deletions
|
|
@ -157,6 +157,21 @@
|
|||
XCTAssertEqualObjects(identifier, @"IGNibNameUICollectionViewCell");
|
||||
}
|
||||
|
||||
- (void)test_whenDequeueingTwoCellsOfTheSameClassWithDifferentReuseIdentifiers_thatBothReuseIdentifiersReturnCells {
|
||||
self.dataSource.objects = @[@1, @2];
|
||||
[self.adapter reloadDataWithCompletion:nil];
|
||||
UICollectionViewCell *cell1 = [self.adapter dequeueReusableCellOfClass:[UICollectionViewCell class]
|
||||
withReuseIdentifier:@"reuse-1"
|
||||
forSectionController:[self.adapter sectionControllerForObject:@1]
|
||||
atIndex:0];
|
||||
UICollectionViewCell *cell2 = [self.adapter dequeueReusableCellOfClass:[UICollectionViewCell class]
|
||||
withReuseIdentifier:@"reuse-2"
|
||||
forSectionController:[self.adapter sectionControllerForObject:@1]
|
||||
atIndex:0];
|
||||
XCTAssertNotNil(cell1);
|
||||
XCTAssertNotNil(cell2);
|
||||
}
|
||||
|
||||
- (void)test_whenDataSourceChanges_thatBackgroundViewVisibilityChanges {
|
||||
self.dataSource.objects = @[@1];
|
||||
UIView *background = [[UIView alloc] init];
|
||||
|
|
|
|||
Loading…
Reference in a new issue