diff --git a/src/Controls/src/Core/Label/Label.Mapper.cs b/src/Controls/src/Core/Label/Label.Mapper.cs index fdc6a046daea..ca9167f07a1a 100644 --- a/src/Controls/src/Core/Label/Label.Mapper.cs +++ b/src/Controls/src/Core/Label/Label.Mapper.cs @@ -111,7 +111,7 @@ public static void MapTextColor(LabelHandler handler, Label label) => static void MapLineHeight(ILabelHandler handler, Label label, Action baseMethod) { - if (!IsPlainText(label)) + if (label.HasFormattedTextSpans) return; baseMethod?.Invoke(handler, label); @@ -119,7 +119,7 @@ static void MapLineHeight(ILabelHandler handler, Label label, Action baseMethod) { - if (!IsPlainText(label)) + if (label.HasFormattedTextSpans) return; baseMethod?.Invoke(handler, label); @@ -127,7 +127,7 @@ static void MapTextDecorations(ILabelHandler handler, Label label, Action baseMethod) { - if (!IsPlainText(label)) + if (label.HasFormattedTextSpans) return; baseMethod?.Invoke(handler, label); diff --git a/src/Controls/src/Core/Label/Label.iOS.cs b/src/Controls/src/Core/Label/Label.iOS.cs index acecf544543f..1ad5c69abed3 100644 --- a/src/Controls/src/Core/Label/Label.iOS.cs +++ b/src/Controls/src/Core/Label/Label.iOS.cs @@ -46,6 +46,9 @@ internal static void MapFormatting(ILabelHandler handler, Label label) { handler.UpdateValue(nameof(ILabel.TextColor)); handler.UpdateValue(nameof(ILabel.Font)); + handler.UpdateValue(nameof(ILabel.LineHeight)); + handler.UpdateValue(nameof(ILabel.TextDecorations)); + handler.UpdateValue(nameof(ILabel.CharacterSpacing)); } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22197.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue22197.xaml new file mode 100644 index 000000000000..28106d1246f3 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22197.xaml @@ -0,0 +1,27 @@ + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22197.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22197.xaml.cs new file mode 100644 index 000000000000..884ed3ff446f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22197.xaml.cs @@ -0,0 +1,10 @@ +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 22197, "LineHeight with HTML Label not working")] +public partial class Issue22197 : ContentPage +{ + public Issue22197() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22197.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22197.cs new file mode 100644 index 000000000000..4221fa7a5fbd --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22197.cs @@ -0,0 +1,20 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue22197 : _IssuesUITest +{ + public Issue22197(TestDevice testDevice) : base(testDevice) { } + + public override string Issue => "LineHeight with HTML Label not working"; + + [Test] + [Category(UITestCategories.Label)] + public void LineHeightWithHTMLLabelShouldWork() + { + App.WaitForElement("label"); + VerifyScreenshot(); + } +} \ No newline at end of file