Skip to content

Commit

Permalink
[Windows] Fix Span Foreground property (#24063)
Browse files Browse the repository at this point in the history
* 23448 - Span text-decoration is incorrect whereas the Label behaves properly.

* added UITest - 23488

* AutomationId added.

* updated namespace properly.

* Output images added.
  • Loading branch information
Vignesh-SF3580 authored and Redth committed Aug 22, 2024
1 parent 04f4fea commit 0686741
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public static void UpdateInlines(
Foreground = textColor?.ToPlatform(),
};

run.Foreground = textColor?.ToPlatform();
textBlock.TextHighlighters.Add(textHighlighter);
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue23488.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue23488">

<StackLayout HorizontalOptions="Center"
VerticalOptions="Center">
<Label Text="hyperlink"
TextColor="Blue"
TextDecorations="Underline" />
<Label AutomationId="WaitForLabelControl">
<Label.FormattedText>
<FormattedString>
<Span Text="hyperlink"
TextColor="Blue"
TextDecorations="Underline" />
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>

</ContentPage>
12 changes: 12 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue23488.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 23488, "Span text-decoration is incorrect whereas the Label behaves properly", PlatformAffected.UWP)]
public partial class Issue23488 : ContentPage
{
public Issue23488()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#if !MACCATALYST
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

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

public override string Issue => "Span text-decoration is incorrect whereas the Label behaves properly";

[Test]
[Category(UITestCategories.Label)]
public void LabelHyperlinkUnderlineColor()
{
App.WaitForElement("WaitForLabelControl");
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.

0 comments on commit 0686741

Please sign in to comment.