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] Custom font icon is not rendered in a shell tabbar tab #24721

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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.
44 changes: 44 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue8244.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue8244"
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
Shell.FlyoutBehavior="Disabled">

<TabBar>
<Tab Route="main" Title="Home">
<Tab.Icon>
<FontImageSource Size="20" FontFamily ="FA" Glyph="{x:Static local:IconFont.Laptop}"/>
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate local:MainTabPage}" />
</Tab>

<Tab Route="plans" Title="Meal Plans">
<Tab.Icon>
<FontImageSource Size="20" FontFamily = "FA" Glyph="{x:Static local:IconFont.LaptopMedical}"/>
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate local:SecondTabPage}" />
</Tab>

<Tab Route="create">
<Tab.Icon>
<FontImageSource Size="20" FontFamily = "FA" Glyph="{x:Static local:IconFont.Plus}"/>
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate local:SecondTabPage}" />
</Tab>

<Tab Route="library" Title="Library">
<Tab.Icon>
<FontImageSource Size="20" FontFamily = "FA" Glyph="{x:Static local:IconFont.LaptopFile}"/>
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate local:SecondTabPage}" />
</Tab>

<Tab Route="todo" Title="To Do">
<Tab.Icon>
<FontImageSource Size="20" FontFamily = "FA" Glyph="{x:Static local:IconFont.LaptopCode}"/>
</Tab.Icon>
<ShellContent ContentTemplate="{DataTemplate local:SecondTabPage}" />
</Tab>
</TabBar>
</Shell>
78 changes: 78 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue8244.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 8244, "[iOS]Custom font icon is not rendered in a shell tabbar tab",
PlatformAffected.iOS)]
public partial class Issue8244 : Shell
{
public Issue8244()
{
InitializeComponent();
}
}
public partial class MainTabPage : ContentPage
{
public MainTabPage()
{
Content = new VerticalStackLayout()
{
new Label(){
Text = "Page Loaded in first Tab",
AutomationId="TabBarIcon",
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
TextDecorations = TextDecorations.Underline,

},
};
}
}

public partial class SecondTabPage : ContentPage
{
public SecondTabPage()
{
Content = new VerticalStackLayout()
{
new Label(){
Text = "Page Loaded in Second Tab",
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
TextDecorations = TextDecorations.Underline,

},
};
}
}
public partial class ThirdTabPage : ContentPage
{
public ThirdTabPage()
{
Content = new VerticalStackLayout()
{
new Label(){
Text = "Page Loaded in Third Tab",
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
TextDecorations = TextDecorations.Underline,

},
};
}
}

static class IconFont
{
public const string Laptop = "\uf109";
public const string LaptopFile = "\ue51d";
public const string LaptopCode = "\uf5fc";
public const string LaptopMedical = "\uf812";
public const string Plus = "\u002b";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#if !MACCATALYST
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework.Legacy;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
internal class Issue8244 : _IssuesUITest
{
public override string Issue => "[iOS]Custom font icon is not rendered in a shell tabbar tab";

public Issue8244(TestDevice device) : base(device)
{
}

[Test]
[Category(UITestCategories.Shell)]
public void CustomFontImageIconShouldDisplay()
{
// Is a iOS issue; see https://github.com/dotnet/maui/issues/8244
App.WaitForElement("TabBarIcon");
VerifyScreenshot();
}
}
}
#endif
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);
}

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