Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "atPosition:" variations to UICollectionView waitForCellAtIndexPa… #1109

Conversation

harleyjcooper
Copy link
Contributor

Taking over from @gaperlinski for #1061 :

Allows the consumers to specify custom UICollectionViewScrollPosition of the cell they want to scroll to. UICollectionViewScrollPositionCenteredHorizontally | UICollectionViewScrollPositionCenteredVertically remains to the default value.

@gaperlinski
Copy link

Thanks, @harleyjcooper ! I've been pretty lousy with finding find to add the test. Btw, I'm wondering why tests fail on iPad simulator. Doesn't seem to be connected to this change.

@@ -59,6 +59,27 @@ - (void)testTappingLastItemAndSectionWithoutAnimation
}


- (void)testTappingLastAndFirstRowAtPositionWithAccessiblityIdentifier

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename this and the other test to testScrolling since you're not really tapping anything

{
UICollectionViewCell *lastCell = [tester waitForCellAtIndexPath:[NSIndexPath indexPathForRow:-1 inSection:-1] inCollectionViewWithAccessibilityIdentifier:@"CollectionView Tests CollectionView" atPosition:UICollectionViewScrollPositionBottom];
CGPoint lastPosition = [lastCell.superview convertPoint:lastCell.frame.origin toView:nil];
XCTAssertEqual(lastCell.frame.origin.x, lastPosition.x);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a vertically scrolling collection view? If so, shouldn't you be checking here the y position (whether it aligns to the top/bottom of the collection view bounds)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I'm comparing the y now. I'm a bit fuzzy on UIView coordinate conversion, but this seems to work.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RoyalPineapple
Copy link
Contributor

This all looks totally reasonable to me. Thanks Harley!

@harleyjcooper harleyjcooper merged commit 84f1319 into kif-framework:master Jun 18, 2019
@harleyjcooper harleyjcooper deleted the harley/gaperlinski/collectionViewScrollAtPosition branch June 18, 2019 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants