-
Notifications
You must be signed in to change notification settings - Fork 526
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
Fix #1873: Fix OnboardingFragmentTest test cases on Robolectric #2482
Conversation
… fix-on_boarding_fragment_test
… fix-on_boarding_fragment_test
… fix-on_boarding_fragment_test
… fix-on_boarding_fragment_test
… fix-on_boarding_fragment_test
@BenHenning @anandwana001 @rt4914 PTAL, the PR is ready for full review. |
/** Adapter to control the slide details in onboarding flow. */ | ||
private const val VIEW_TYPE_TITLE_TEXT = 1 | ||
private const val VIEW_TYPE_STORY_ITEM = 2 | ||
|
||
class OnboardingPagerAdapter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to use the Bindale Adapter and remove this Adapter in this PR only or we are keeping this as a separate issue? @rt4914
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like a larger & unrelated change--I suggest splitting it off of this task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, given that so much of the adapter has changed anyway, maybe it is worth trying to migrate to BindableAdapter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenHenning So, should I replace it with a bindable Adapter in this PR only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I guess you are suggesting to track it via a new issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thank @prayutsu
@@ -529,7 +529,7 @@ class OnboardingFragmentTest { | |||
} | |||
|
|||
override fun perform(uiController: UiController?, view: View?) { | |||
(view as ViewPager2).setCurrentItem(position, false) | |||
(view as ViewPager2).setCurrentItem(position, /* smoothScroll= */false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(view as ViewPager2).setCurrentItem(position, /* smoothScroll= */false) | |
(view as ViewPager2).setCurrentItem(position, /* smoothScroll= */ false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think the new action is reasonable. I agree with @anandwana001's suggestion to move this to BindableAdapter.
Otherwise I have nothing else to add. Feel free to re-add me if you'd like my review, otherwise I'm happy to defer to codeowners for review.
… fix-on_boarding_fragment_test
@BenHenning Thanks for your review, if everything looks good, then can you please approve the changes? |
@rt4914 We Will also need your review, PTAL. |
Filed #2600 for Bindable Adapter Implementation |
@prayutsu I didn't actually review this in detail (and don't need to since I'm not a codeowner). In general, I don't fully review PRs that don't require my review unless the author specifically asks for it. If you want me to review, I'm happy to, but I might need to prioritize it lower than other reviews that require my approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prayutsu Overall this PR has turned out to be really good. Suggested few changes.
app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt
Outdated
Show resolved
Hide resolved
/** Adapter to control the slide details in onboarding flow. */ | ||
private const val VIEW_TYPE_TITLE_TEXT = 1 | ||
private const val VIEW_TYPE_STORY_ITEM = 2 | ||
|
||
class OnboardingPagerAdapter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… fix-on_boarding_fragment_test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
Explanation
FIxes #1873, fixes #2194, fixes part of #2417
Migrated from ViewPager to ViewPager2
Fixed test cases on robolectric
Testing Video to ensure that new implementation of ViewPager2 does not bring any new regressions -
Screenrecorder-2021-01-15-19-23-34-39.mp4
All test cases passing on Robolectric -
All test cases passing on Espresso -
Checklist