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

[iOS] Tab Selected Icon Color not changing if using Font icons - fix #22437

Merged
merged 8 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue22032.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue22032"
SelectedTabColor="Red"
UnselectedTabColor="Green">
<ContentPage Title="Tab1">
<ContentPage.IconImageSource>
<FontImageSource
FontFamily="OpenSansRegular"
Glyph="₪"
Size="15" />
</ContentPage.IconImageSource>
<Button Text="Switch page"
Clicked="Button_Clicked"
AutomationId="button"/>
</ContentPage>
<ContentPage x:Name="tab2" Title="Tab2">
<ContentPage.IconImageSource>
<FontImageSource
FontFamily="OpenSansRegular"
Glyph="¼"
Size="15" />
</ContentPage.IconImageSource>
<Label
Text="Hello, Maui!"
TextColor="White"
AutomationId="label"/>
</ContentPage>
</TabbedPage>
22 changes: 22 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue22032.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.ComponentModel;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 22032, "Shell FlyoutItem Tab Selected Icon Color not changing if using Font icons", PlatformAffected.iOS)]
public partial class Issue22032 : TabbedPage
{
public Issue22032()
{
InitializeComponent();
}

void Button_Clicked(object sender, EventArgs e)
{
CurrentPage = tab2;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue22032 : _IssuesUITest
{
public Issue22032(TestDevice device) : base(device) { }

public override string Issue => "Shell FlyoutItem Tab Selected Icon Color not changing if using Font icons";

[Test]
[Category(UITestCategories.TabbedPage)]
public void SelectedTabIconShouldChangeColor()
{
App.WaitForElement("button");
App.Click("button");
App.WaitForElement("label");

// The test passes if tab1 icon is green and tab2 red
VerifyScreenshot();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static partial class ImageSourceExtensions
var image = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();

return image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
return image.ImageWithRenderingMode(UIImageRenderingMode.Automatic);
PureWeen marked this conversation as resolved.
Show resolved Hide resolved
}

internal static UIImage? GetPlatformImage(this IFileImageSource imageSource)
Expand Down
Loading