mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 09:18:29 +00:00
Increased timeout time, close #669
Summary: Simple find and replace for `waitForExpectationsWithTimeout:15` and `waitForExpectationsWithTimeout:16` Issue fixed: #669 - [ ] All tests pass. Demo project builds and runs. - [ ] I added tests, an experiment, or detailed why my change isn't tested. - [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. - [ ] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Closes https://github.com/Instagram/IGListKit/pull/670 Differential Revision: D4915711 Pulled By: rnystrom fbshipit-source-id: 7afd990cd5d18844ec1da08c5335f7138feb0b87
This commit is contained in:
parent
301f1471c9
commit
04e6c1bff1
9 changed files with 106 additions and 106 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
|
|
@ -115,7 +115,7 @@
|
|||
XCTAssertEqual(cell.delegate, [self.adapter sectionControllerForObject:self.dataSource.objects[0]]);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReloadingItem_cellConfigurationChanges {
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenUpdatesComplete_thatCellsExist {
|
||||
|
|
@ -185,7 +185,7 @@
|
|||
XCTAssertNotNil([self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:1]]);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReloadDataCompletes_thatCellsExist {
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
XCTAssertNotNil([self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:1]]);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSectionControllerInsertsIndexes_thatCountsAreUpdated {
|
||||
|
|
@ -222,7 +222,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSectionControllerDeletesIndexes_thatCountsAreUpdated {
|
||||
|
|
@ -244,7 +244,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 1);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSectionControllerReloadsIndexes_thatCellConfigurationUpdates {
|
||||
|
|
@ -269,7 +269,7 @@
|
|||
XCTAssertEqualObjects(updatedCell.label.text, @"c");
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSectionControllerReloads_thatCountsAreUpdated {
|
||||
|
|
@ -290,7 +290,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withSectionControllerMutations_thatCollectionCountsAreUpdated {
|
||||
|
|
@ -328,7 +328,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSectionControllerMoves_withSectionControllerMutations_thatCollectionViewWorks {
|
||||
|
|
@ -360,7 +360,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenItemIsRemoved_withSectionControllerMutations_thatCollectionViewWorks {
|
||||
|
|
@ -389,7 +389,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withUnequalItem_withItemMoving_thatCollectionViewCountsUpdate {
|
||||
|
|
@ -410,7 +410,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withItemMoving_withSectionControllerReloadIndexes_thatCollectionViewCountsUpdate {
|
||||
|
|
@ -437,7 +437,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withSectionControllerReloadIndexes_withItemDeleted_thatCollectionViewCountsUpdate {
|
||||
|
|
@ -462,7 +462,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withNewItemInstances_thatSectionControllersEqual {
|
||||
|
|
@ -495,7 +495,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingMultipleUpdates_withNewItemInstances_thatSectionControllersReceiveNewInstances {
|
||||
|
|
@ -536,7 +536,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenQueryingCollectionContext_withNewItemInstances_thatSectionMatchesCurrentIndex {
|
||||
|
|
@ -569,7 +569,7 @@
|
|||
}];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSectionControllerMutates_withReloadData_thatSectionControllerMutationIsApplied {
|
||||
|
|
@ -593,7 +593,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenContentOffsetChanges_withPerformUpdates_thatCollectionViewWorks {
|
||||
|
|
@ -618,7 +618,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfSections], 2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReloadingItems_withNewItemInstances_thatSectionControllersReceiveNewInstances {
|
||||
|
|
@ -674,7 +674,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSectionControllerMutates_whenThereIsNoWindow_thatCollectionViewCountsAreUpdated {
|
||||
|
|
@ -701,7 +701,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 6);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withoutSettingDataSource_thatCompletionBlockExecutes {
|
||||
|
|
@ -739,7 +739,7 @@
|
|||
// simulate display reloading data on the collection view
|
||||
[collectionView layoutIfNeeded];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withItemsMovingInBlocks_thatCollectionViewWorks {
|
||||
|
|
@ -783,7 +783,7 @@
|
|||
XCTAssertEqual([collectionView numberOfSections], 10);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReleasingObjects_thatAssertDoesntFire {
|
||||
|
|
@ -811,7 +811,7 @@
|
|||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[expectation fulfill];
|
||||
});
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenItemDeleted_withDisplayDelegate_thatDelegateReceivesDeletedItem {
|
||||
|
|
@ -836,7 +836,7 @@
|
|||
XCTAssertTrue(finished2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenItemReloaded_withDisplacingMutations_thatCollectionViewWorks {
|
||||
|
|
@ -861,7 +861,7 @@
|
|||
XCTAssertTrue(finished);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenCollectionViewAppears_thatWillDisplayEventsAreSent {
|
||||
|
|
@ -910,7 +910,7 @@
|
|||
XCTAssertEqual([ic2.didEndDisplayCellIndexes countForObject:@1], 1);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenAdapterUpdates_withItemRemoved_thatdidEndDisplayEventsAreSent {
|
||||
|
|
@ -940,7 +940,7 @@
|
|||
XCTAssertEqual([ic2.didEndDisplayCellIndexes countForObject:@1], 1);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenAdapterUpdates_withEmptyItems_thatdidEndDisplayEventsAreSent {
|
||||
|
|
@ -963,7 +963,7 @@
|
|||
XCTAssertEqual([ic2.didEndDisplayCellIndexes countForObject:@1], 1);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenBatchUpdating_withCellQuery_thatCellIsNil {
|
||||
|
|
@ -993,7 +993,7 @@
|
|||
[self.adapter performUpdatesAnimated:YES completion:^(BOOL finished) {
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenBatchUpdating_withDuplicateIdentifiers_thatHaveDifferentValues_thatCollectionViewWorks {
|
||||
|
|
@ -1020,7 +1020,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenPerformingUpdates_withWorkingRange_thatAccessingCellDoesntCrash {
|
||||
|
|
@ -1053,7 +1053,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReloadingItems_withDeleteAndInsertCollision_thatUpdateCanBeApplied {
|
||||
|
|
@ -1074,7 +1074,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReloadingItems_withSectionInsertedInFront_thatUpdateCanBeApplied {
|
||||
|
|
@ -1105,7 +1105,7 @@
|
|||
[expectation2 fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReloadingItems_withSectionDeletedInFront_thatUpdateCanBeApplied {
|
||||
|
|
@ -1134,7 +1134,7 @@
|
|||
[expectation2 fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenDataSourceDeallocatedAfterUpdateQueued_thatUpdateSuccesfullyCompletes {
|
||||
|
|
@ -1157,7 +1157,7 @@
|
|||
|
||||
dataSource = nil;
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenQueuingUpdate_withSectionControllerBatchUpdate_thatSectionControllerNotRetained {
|
||||
|
|
@ -1216,7 +1216,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenMovingItems_withObjectReloaded_thatCollectionViewWorks {
|
||||
|
|
@ -1241,7 +1241,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenMovingItems_withObjectDeleted_thatCollectionViewWorks {
|
||||
|
|
@ -1264,7 +1264,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenMovingItems_withObjectInsertedBefore_thatCollectionViewWorks {
|
||||
|
|
@ -1290,7 +1290,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenMovingItems_thatCollectionViewWorks {
|
||||
|
|
@ -1316,7 +1316,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenInvalidatingSectionController_withSizeChange_thatCellsAreSameInstance_thatCellsFrameChanged {
|
||||
|
|
@ -1344,7 +1344,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenAdaptersSwapCollectionViews_thatOldAdapterDoesntUpdateOldCollectionView {
|
||||
|
|
@ -1378,7 +1378,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenAdaptersSwapCollectionViews_ {
|
||||
|
|
@ -1415,16 +1415,16 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenDidUpdateAsyncReloads_withBatchUpdatesInProgress_thatReloadIsExecuted {
|
||||
[self setupWithObjects:@[
|
||||
genTestObject(@1, @1)
|
||||
]];
|
||||
|
||||
|
||||
IGTestDelegateController *section = [self.adapter sectionControllerForObject:self.dataSource.objects[0]];
|
||||
|
||||
|
||||
XCTestExpectation *expectation1 = genExpectation;
|
||||
__weak __typeof__(section) weakSection = section;
|
||||
section.itemUpdateBlock = ^{
|
||||
|
|
@ -1439,21 +1439,21 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 2);
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
// add an object so that a batch update is triggered (diff result has changes)
|
||||
self.dataSource.objects = @[
|
||||
genTestObject(@1, @1),
|
||||
genTestObject(@2, @1)
|
||||
];
|
||||
|
||||
|
||||
XCTestExpectation *expectation2 = genExpectation;
|
||||
[self.adapter performUpdatesAnimated:YES completion:^(BOOL finished) {
|
||||
// verify that the section still has 2 items since this completion executes AFTER the reload block above
|
||||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 2);
|
||||
[expectation2 fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenInsertingItemsTwice_withDataUpdatedTwice_thatAllUpdatesAppliedWithoutException {
|
||||
|
|
@ -1474,7 +1474,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 4);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenDeletingItemsTwice_withDataUpdatedTwice_thatAllUpdatesAppliedWithoutException {
|
||||
|
|
@ -1495,7 +1495,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ XCTAssertEqual(CGSizeEqualToSize(size, s), YES); \
|
|||
XCTAssertFalse(self.collectionView.backgroundView.hidden);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenScrollViewDelegateSet_thatDelegateReceivesEvents {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#define genTestObject(k, v) [[IGSectionObject alloc] initWithKey:k value:v]
|
||||
|
||||
#define genExpectation [self expectationWithDescription:NSStringFromSelector(_cmd)]
|
||||
#define waitExpectation [self waitForExpectationsWithTimeout:15 handler:nil]
|
||||
#define waitExpectation [self waitForExpectationsWithTimeout:30 handler:nil]
|
||||
|
||||
@interface IGListAdapterUpdaterTests : XCTestCase
|
||||
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfSections], 2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenDeletingSection_thatCollectionViewUpdates {
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfSections], 1);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenInsertingSection_withItemChanges_thatCollectionViewUpdates {
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:1], 2);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenInsertingSection_withDeletedSection_thatCollectionViewUpdates {
|
||||
|
|
@ -183,7 +183,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenReloadingSections_thatCollectionViewUpdates {
|
||||
|
|
@ -229,7 +229,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfSections], 1);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenUpdatesAreReentrant_thatUpdatesExecuteSerially {
|
||||
|
|
@ -275,7 +275,7 @@
|
|||
XCTAssertEqual(completionCounter, 1);
|
||||
[expectation2 fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenQueuingItemUpdates_thatUpdaterHasChanges {
|
||||
|
|
@ -289,7 +289,7 @@
|
|||
// expectation should be triggered. test failure is a timeout
|
||||
[expectation fulfill];
|
||||
} completion:nil];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenQueueingItemUpdates_withBatchUpdate_thatItemUpdateBlockExecutes {
|
||||
|
|
@ -316,7 +316,7 @@
|
|||
XCTAssertTrue(sectionUpdateBlockExecuted);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenItemsMoveAndUpdate_thatCollectionViewWorks {
|
||||
|
|
@ -353,7 +353,7 @@
|
|||
XCTAssertEqual([self.collectionView numberOfItemsInSection:2], 3);
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenConvertingReloads_withoutChanges_thatOriginalIndexUsed {
|
||||
|
|
@ -535,7 +535,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_2 {
|
||||
|
|
@ -576,7 +576,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSelectingCell_thatCorrectViewModelSelected {
|
||||
|
|
@ -145,15 +145,15 @@
|
|||
[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@7, @"seven"]],
|
||||
]];
|
||||
[self.adapter reloadObjects:@[[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@"four", @4, @"seven", @7]]]];
|
||||
|
||||
|
||||
IGTestNumberBindableCell *cell00 = [self cellAtSection:0 item:0];
|
||||
IGTestStringBindableCell *cell01 = [self cellAtSection:0 item:1];
|
||||
|
||||
|
||||
XCTAssertEqualObjects(cell00.textField.text, @"7");
|
||||
XCTAssertEqualObjects(cell01.label.text, @"seven");
|
||||
XCTAssertNil([self cellAtSection:0 item:2]);
|
||||
XCTAssertNil([self cellAtSection:0 item:3]);
|
||||
|
||||
|
||||
// "fake" batch updates to make sure that calling reload triggers a diffed batch update
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
|
||||
[self.adapter performBatchAnimated:YES updates:^(id<IGListBatchContext> batchContext){} completion:^(BOOL finished) {
|
||||
|
|
@ -161,16 +161,16 @@
|
|||
IGTestNumberBindableCell *batchedCell01 = [self cellAtSection:0 item:1];
|
||||
IGTestStringBindableCell *batchedCell02 = [self cellAtSection:0 item:2];
|
||||
IGTestNumberBindableCell *batchedCell03 = [self cellAtSection:0 item:3];
|
||||
|
||||
|
||||
XCTAssertEqualObjects(batchedCell00.label.text, @"four");
|
||||
XCTAssertEqualObjects(batchedCell01.textField.text, @"4");
|
||||
XCTAssertEqualObjects(batchedCell02.label.text, @"seven");
|
||||
XCTAssertEqualObjects(batchedCell03.textField.text, @"7");
|
||||
|
||||
|
||||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:16 handler:nil];
|
||||
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenUpdating_withViewModelMovesAndReloads_thatCellUpdatedAndInstanceSame {
|
||||
|
|
@ -182,13 +182,13 @@
|
|||
[self setupWithObjects:@[
|
||||
[[IGTestDiffingObject alloc] initWithKey:@1 objects:initObjects]
|
||||
]];
|
||||
|
||||
|
||||
XCTAssertEqual([self.collectionView numberOfItemsInSection:0], 3);
|
||||
|
||||
|
||||
IGTestStringBindableCell *cell00 = [self cellAtSection:0 item:0];
|
||||
IGTestStringBindableCell *cell01 = [self cellAtSection:0 item:1];
|
||||
IGTestCell *cell02 = [self cellAtSection:0 item:2];
|
||||
|
||||
|
||||
XCTAssertEqualObjects(cell00.label.text, @"foo");
|
||||
XCTAssertEqualObjects(cell01.label.text, @"bar");
|
||||
XCTAssertEqualObjects(cell02.label.text, @"baz");
|
||||
|
|
@ -201,25 +201,25 @@
|
|||
self.dataSource.objects = @[
|
||||
[[IGTestDiffingObject alloc] initWithKey:@1 objects:newObjects]
|
||||
];
|
||||
|
||||
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
|
||||
[self.adapter performUpdatesAnimated:YES completion:^(BOOL finished) {
|
||||
IGTestCell *batchedCell00 = [self cellAtSection:0 item:0];
|
||||
IGTestStringBindableCell *batchedCell01 = [self cellAtSection:0 item:1];
|
||||
IGTestStringBindableCell *batchedCell02 = [self cellAtSection:0 item:2];
|
||||
|
||||
|
||||
XCTAssertEqualObjects(batchedCell00.label.text, @"bang");
|
||||
XCTAssertEqualObjects(batchedCell01.label.text, @"foo");
|
||||
XCTAssertEqualObjects(batchedCell02.label.text, @"bar");
|
||||
|
||||
|
||||
XCTAssertEqual(cell00, batchedCell01);
|
||||
XCTAssertEqual(cell01, batchedCell02);
|
||||
XCTAssertEqual(cell02, batchedCell00);
|
||||
|
||||
|
||||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:16 handler:nil];
|
||||
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenUpdatingManually_with2Updates_thatBothCompletionBlocksCalled {
|
||||
|
|
@ -227,21 +227,21 @@
|
|||
[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@7, @"seven"]],
|
||||
]];
|
||||
IGTestDiffingSectionController *section = [self.adapter sectionControllerForObject:self.dataSource.objects[0]];
|
||||
|
||||
|
||||
XCTestExpectation *expectation1 = [self expectationWithDescription:NSStringFromSelector(_cmd)];
|
||||
[section updateAnimated:YES completion:^(BOOL updated) {
|
||||
XCTAssertTrue(updated);
|
||||
[expectation1 fulfill];
|
||||
}];
|
||||
|
||||
|
||||
XCTestExpectation *expectation2 = [self expectationWithDescription:NSStringFromSelector(_cmd)];
|
||||
[section updateAnimated:YES completion:^(BOOL updated) {
|
||||
// queued second, shouldn't execute update block
|
||||
XCTAssertFalse(updated);
|
||||
[expectation2 fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -492,20 +492,20 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
|
|||
|
||||
IGAssertEqualFrame([self headerForSection:0].frame, 10, 10, 85, 10);
|
||||
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 10, 20, 85, 30);
|
||||
|
||||
|
||||
IGAssertEqualFrame([self headerForSection:1].frame, 10, 65, 85, 10);
|
||||
IGAssertEqualFrame([self cellForSection:1 item:0].frame, 10, 75, 85, 40);
|
||||
|
||||
|
||||
IGAssertEqualFrame([self headerForSection:2].frame, 10, 130, 85, 10);
|
||||
IGAssertEqualFrame([self cellForSection:2 item:0].frame, 10, 140, 85, 30);
|
||||
IGAssertEqualFrame([self cellForSection:2 item:1].frame, 10, 180, 85, 10);
|
||||
|
||||
|
||||
IGAssertEqualFrame([self headerForSection:3].frame, 10, 205, 85, 10);
|
||||
IGAssertEqualFrame([self cellForSection:3 item:0].frame, 10, 215, 85, 10);
|
||||
IGAssertEqualFrame([self cellForSection:3 item:1].frame, 10, 235, 85, 20);
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:10 handler:^(NSError * _Nullable error) {
|
||||
|
||||
[self waitForExpectationsWithTimeout:30 handler:^(NSError * _Nullable error) {
|
||||
XCTAssertNil(error);
|
||||
}];
|
||||
}
|
||||
|
|
@ -609,7 +609,7 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
|
|||
[[IGLayoutTestItem alloc] initWithSize:size],
|
||||
]],
|
||||
]];
|
||||
|
||||
|
||||
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 33, 33);
|
||||
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 33, 0, 33, 33);
|
||||
IGAssertEqualFrame([self cellForSection:0 item:2].frame, 66, 0, 34, 33);
|
||||
|
|
@ -628,7 +628,7 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
|
|||
[[IGLayoutTestItem alloc] initWithSize:CGSizeMake(65, 33)],
|
||||
]],
|
||||
]];
|
||||
|
||||
|
||||
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 33, 33);
|
||||
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 33, 0, 65, 33);
|
||||
}
|
||||
|
|
@ -646,7 +646,7 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
|
|||
[[IGLayoutTestItem alloc] initWithSize:CGSizeMake(51, 50)],
|
||||
]],
|
||||
]];
|
||||
|
||||
|
||||
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 50, 50);
|
||||
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 50, 0, 51, 50);
|
||||
}
|
||||
|
|
@ -664,7 +664,7 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
|
|||
[[IGLayoutTestItem alloc] initWithSize:CGSizeMake(52, 50)],
|
||||
]],
|
||||
]];
|
||||
|
||||
|
||||
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 0, 50, 50);
|
||||
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 0, 50, 52, 50);
|
||||
}
|
||||
|
|
@ -672,7 +672,7 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
|
|||
- (void)test_ {
|
||||
[self setUpWithStickyHeaders:NO topInset:0];
|
||||
self.collectionView.frame = CGRectMake(0, 0, 414, 736);
|
||||
|
||||
|
||||
NSMutableArray *data = [NSMutableArray new];
|
||||
for (NSInteger i = 0; i < 6; i++) {
|
||||
[data addObject:[[IGLayoutTestSection alloc] initWithInsets:UIEdgeInsetsMake(1, 1, 1, 1)
|
||||
|
|
@ -684,7 +684,7 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
|
|||
]]];
|
||||
}
|
||||
[self prepareWithData:data];
|
||||
|
||||
|
||||
XCTAssertEqual(self.collectionView.contentSize.height, 276);
|
||||
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 1, 1, 136, 136);
|
||||
IGAssertEqualFrame([self cellForSection:1 item:0].frame, 139, 1, 136, 136);
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@
|
|||
XCTAssertEqualObjects(cell2.label.text, @"Qux");
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@
|
|||
XCTAssertEqualObjects(cell2.label.text, @"Qux");
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSelected_thatDelegateReceivesEvent {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
XCTAssertEqualObjects(cell2.label.text, @"Qux");
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ static const CGRect kStackTestFrame = (CGRect){{0.0, 0.0}, {100.0, 100.0}};
|
|||
[mockDelegate verify];
|
||||
[expectation fulfill];
|
||||
}];
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenQueryingVisibleSectionControllers_withCellsOffscreen_thatOnlyVisibleReturned {
|
||||
|
|
@ -544,7 +544,7 @@ static const CGRect kStackTestFrame = (CGRect){{0.0, 0.0}, {100.0, 100.0}};
|
|||
[batchContext deleteInSectionController:section2 atIndexes:[NSIndexSet indexSetWithIndex:0]];
|
||||
} completion:nil];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenSelectingItems_thatChildSectionControllersSelected {
|
||||
|
|
@ -831,7 +831,7 @@ static const CGRect kStackTestFrame = (CGRect){{0.0, 0.0}, {100.0, 100.0}};
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenScrolling_withWorkingRange_thatChildSectionControllersReceiveEvents {
|
||||
|
|
@ -877,7 +877,7 @@ static const CGRect kStackTestFrame = (CGRect){{0.0, 0.0}, {100.0, 100.0}};
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
- (void)test_whenMovingItemsInChild_thatCorrectCellsAreMoved {
|
||||
|
|
@ -904,7 +904,7 @@ static const CGRect kStackTestFrame = (CGRect){{0.0, 0.0}, {100.0, 100.0}};
|
|||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
[self waitForExpectationsWithTimeout:15 handler:nil];
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Reference in a new issue