-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 text toolbar item icon not removed when navigating on Android #16796
Conversation
Hey there @Adam--! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This is a much needed fix! Hopefully this gets reviewed and approved quickly! |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
This all looks great, but we probably should add some tests. @PureWeen is there a good example - or even possible - to have a test? I know we have device tests, but we also now have the image comparison tests. |
Adding tests sounds like a great idea. It seems that if we were to write a test similar (or just use the same test) to Such as: [Fact(DisplayName = "Toolbar Items Order Updates Correctly After Navigation")]
public async Task ToolbarItemsOrderUpdatesCorrectlyAfterNavigation()
{
SetupBuilder();
var firstPageToolbarItem = new ToolbarItem() { Text = "Toolbar Item First Page" };
var secondPagePrimaryToolbarItem = new ToolbarItem() { Text = "Toolbar Item Second Page", IconImageSource = "SecondPageIcon" };
var secondPageSecondaryToolbarItem = new ToolbarItem() { Text = "Secondary Toolbar Item Second Page", Order = ToolbarItemOrder.Secondary };
var navPage = new NavigationPage(new ContentPage()
{
ToolbarItems =
{
firstPageToolbarItem
}
});
await CreateHandlerAndAddToWindow<WindowHandlerStub>(new Window(navPage), async (handler) =>
{
await navPage.PushAsync(new ContentPage()
{
ToolbarItems =
{
secondPagePrimaryToolbarItem,
secondPageSecondaryToolbarItem
}
});
ToolbarItemsMatch(handler, GetExpectedToolbarItems(navPage));
ToolbarItemsMatch(handler, secondPagePrimaryToolbarItem, secondPageSecondaryToolbarItem);
await navPage.PopAsync();
ToolbarItemsMatch(handler, GetExpectedToolbarItems(navPage));
ToolbarItemsMatch(handler, firstPageToolbarItem);
});
}
Would you be able to help out? |
Hey, I'd like to get this merged. Can you review the code? |
We agree with @jfichtner, this is a much needed fix! |
Let me know if you want me to take this one over. I think for the device tests on this one, you could grab the handler from the toolbar which will be of type
And then retrieve the menu items from there to see if the icon has been removed. |
Added UI Test |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Thanks all, I appreciate the help on this! |
/azp run |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
3ce216f
to
0d356e9
Compare
0d356e9
to
5e9032e
Compare
5e9032e
to
3e5b814
Compare
Fixes an issue on Android when there are multiple pages with toolbar items and on one page the toolbar item has an icon and on another page it doesn't, the icon is not removed when navigating to the page without the icon. When updating the Android Menuitem icon and the base drawable is null, the icon is set to null. On Android, this clears out the previous icon. Fixes dotnet#7823
3e5b814
to
a64c23c
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
…6796) * Fix text toolbar item icon not removed when navigating on Android Fixes an issue on Android when there are multiple pages with toolbar items and on one page the toolbar item has an icon and on another page it doesn't, the icon is not removed when navigating to the page without the icon. When updating the Android Menuitem icon and the base drawable is null, the icon is set to null. On Android, this clears out the previous icon. Fixes #7823 * Added UITest * Improve test * - update screenshots * - add windows --------- Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Description of Change
Fixes an issue on Android when there are multiple pages with toolbar items and on one page the toolbar item has an icon and on another page it doesn't, the icon is not removed when navigating to the page without the icon.
When updating the Android MenuItem icon and the base drawable is null, the icon is set to null. On Android, this clears out the previous icon.
Issues Fixed
Fixes #7823