Skip to content
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
155 changes: 155 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue24520.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?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.Issue24520">

<VerticalStackLayout>
<Label Text="Labels without spans" FontAttributes="Bold" />

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>

<Label Grid.Row="0" Grid.Column="0" BackgroundColor="Gray" Text="1. No LineHeight Specified" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="0" Grid.Column="1" BackgroundColor="Green" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="2" Grid.Column="0" BackgroundColor="Gray" Text="2. LineHeight=0.8" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="2" Grid.Column="1" BackgroundColor="Red" LineHeight="0.8" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="4" Grid.Column="0" BackgroundColor="Gray" Text="3. LineHeight=0.2" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="4" Grid.Column="1" BackgroundColor="Green" LineHeight="0.2" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="6" Grid.Column="0" BackgroundColor="Gray" Text="4. LineHeight=0.4" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="6" Grid.Column="1" BackgroundColor="Red" LineHeight="0.4" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="8" Grid.Column="0" BackgroundColor="Gray" Text="5. LineHeight=1.0" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="8" Grid.Column="1" BackgroundColor="Green" LineHeight="1.0" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="10" Grid.Column="0" BackgroundColor="Gray" Text="6. LineHeight=1.2" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="10" Grid.Column="1" BackgroundColor="Red" LineHeight="1.2" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="12" Grid.Column="0" BackgroundColor="Gray" Text="7. LineHeight=1.4" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="12" Grid.Column="1" BackgroundColor="Green" LineHeight="1.4" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="14" Grid.Column="0" BackgroundColor="Gray" Text="8. LineHeight=1.6" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="14" Grid.Column="1" BackgroundColor="Red" LineHeight="1.6" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="16" Grid.Column="0" BackgroundColor="Gray" Text="9. LineHeight=2.0" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="16" Grid.Column="1" BackgroundColor="Green" LineHeight="2.0" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>

<Label Grid.Row="18" Grid.Column="0" BackgroundColor="Gray" Text="10. LineHeight=4.6" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="18" Grid.Column="1" BackgroundColor="Red" LineHeight="4.6" FontSize="20" Text="ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ"/>
</Grid>

<Label Text="Labels with span" FontAttributes="Bold" Margin="0,5,0,0" />

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="30"/>
<RowDefinition Height="5"/>
<RowDefinition Height="150"/>
</Grid.RowDefinitions>

<Label Grid.Row="0" Grid.Column="0" BackgroundColor="Gray" Text="1. No LineHeight Specified" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="0" Grid.Column="1" BackgroundColor="Green" LineHeight="0.8" FontSize="20">
<Label.FormattedText>
<FormattedString>
<Span Text="Normal" FontFamily="Arial"/>
<Span Text="Special" FontFamily="OpenSansRegular"/>
</FormattedString>
</Label.FormattedText>
</Label>

<Label Grid.Row="2" Grid.Column="0" BackgroundColor="Gray" Text="2. LineHeight=0.4" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="2" Grid.Column="1" BackgroundColor="Red" LineHeight="0.4" FontSize="20">
<Label.FormattedText>
<FormattedString>
<Span Text="Normal" FontFamily="Arial"/>
<Span Text="Special" FontFamily="OpenSansRegular"/>
</FormattedString>
</Label.FormattedText>
</Label>

<Label Grid.Row="4" Grid.Column="0" BackgroundColor="Gray" Text="3. LineHeight=1.2" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="4" Grid.Column="1" BackgroundColor="Green" LineHeight="1.2" FontSize="20">
<Label.FormattedText>
<FormattedString>
<Span Text="Normal" FontFamily="Arial"/>
<Span Text="Special" FontFamily="OpenSansRegular"/>
</FormattedString>
</Label.FormattedText>
</Label>

<Label Grid.Row="6" Grid.Column="0" BackgroundColor="Gray" Text="3. LineHeight=1.6" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="6" Grid.Column="1" BackgroundColor="Red" LineHeight="1.6" FontSize="20">
<Label.FormattedText>
<FormattedString>
<Span Text="Normal" FontFamily="Arial"/>
<Span Text="Special" FontFamily="OpenSansRegular"/>
</FormattedString>
</Label.FormattedText>
</Label>

<Label Grid.Row="8" Grid.Column="0" BackgroundColor="Gray" Text="3. LineHeight=2.0" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="8" Grid.Column="1" BackgroundColor="Green" LineHeight="2.0" FontSize="20">
<Label.FormattedText>
<FormattedString>
<Span Text="Normal" FontFamily="Arial"/>
<Span Text="Special" FontFamily="OpenSansRegular"/>
</FormattedString>
</Label.FormattedText>
</Label>

<Label Grid.Row="10" Grid.Column="0" BackgroundColor="Gray" Text="3. LineHeight=2.0" FontSize="10" VerticalTextAlignment="Center" />
<Label Grid.Row="10" Grid.Column="1" LineHeight="2" LineBreakMode="WordWrap" Background="Blue">
<Label.FormattedText>
<FormattedString>
<Span>Lorem ipsum </Span>
<Span FontSize="30">dolor sit</Span>
<Span> amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. Iaculis massa nisl malesuada lacinia integer nunc </Span>
<Span FontSize="20">posuere</Span>
<Span>. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos.</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</Grid>
</VerticalStackLayout>
</ContentPage>
10 changes: 10 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue24520.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 24520, "Change the LineStackingStrategy to BlockLineHeight for Labels on Windows", PlatformAffected.UWP)]
public partial class Issue24520 : ContentPage
{
public Issue24520()
{
InitializeComponent();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#if TEST_FAILS_ON_ANDROID // https://github.com/dotnet/maui/issues/24504
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this comment: #24504 (comment)

using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue24520 : _IssuesUITest
{
public Issue24520(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "Change the LineStackingStrategy to BlockLineHeight for Labels on Windows";

[Test]
[Category(UITestCategories.Label)]
public void VerifyLineHeightRendering()
{
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Core/src/Platform/Windows/Styles/Resources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
<Setter Property="MaxWidth" Value="300"/>
</Style>

<Style TargetType="TextBlock">
<Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
</Style>
</ResourceDictionary>
Loading