-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Fix exception removing item from CarouselView #11074
Conversation
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class Issue10865ViewModel |
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.
This test could be automated.
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.
In fact, since it's just a test of GetPosition, it could just be a platform test; no UI test necessary.
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.
Also, the test instructions do not match the instructions from the original 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.
Right, added unit 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.
Unit test looks good, can we just remove this screen entirely?
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.
Sure, I can remove it, but, why not leave the screen next to the 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.
Because it's one more screen that we have to maintain as things change, and one more class/screen to load every time we load the solution or 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.
Wondering if we can just remove the Issue10865 files entirely since we have the unit test.
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class Issue10865ViewModel |
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.
Unit test looks good, can we just remove this screen entirely?
Description of Change
Fix exception removing item from
CarouselView
on Android.Deleting items (or adding) sets the CarouselView
CurrentItem
. To update the current item, we use the IItemsViewSourceGetItem
method that gets the item based on the position. The error was that the position value was -1 (incorrect) because the comparison of items made in the IItemsViewSourceGetPosition
method was incorrect.NOTE: Tested the same on iOS and is working without problems.
Issues Resolved
API Changes
None
Platforms Affected
Behavioral/Visual Changes
None
Before/After Screenshots
Before
Crash! (Add Item, remove it and try to add again).
After
Testing Procedure
Launch Core Gallery and navigate to the issue10865. Click add until you have more than one item, then scroll to the last item and remove the last item. Without exception, the test has passed.
PR Checklist