-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5679 from unoplatform/dev/cdb/wasm/text-ellipsis
Fix TextTrimming="CharacterEllipsis" were not working on Wasm
- Loading branch information
Showing
7 changed files
with
173 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...sApp/UITests.Shared/Windows_UI_Xaml_Controls/TextBlockControl/TextBlock_TextTrimming.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<Page | ||
x:Class="UITests.Windows_UI_Xaml_Controls.TextBlockControl.TextBlock_TextTrimming" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:wasm="http://uno.ui/xamarin" | ||
mc:Ignorable="d wasm" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<Slider Minimum="10" Maximum="1600" Value="300" x:Name="slider" Header="Width"/> | ||
|
||
<StackPanel Grid.Row="1" Spacing="5"> | ||
|
||
<TextBlock>TextTrimming=None</TextBlock> | ||
<Border MaxWidth="{Binding Value, ElementName=slider}" Background="Cyan" x:Name="border1"> | ||
<TextBlock | ||
Text="This is a very very very very long text that should not wrap even though it goes out of the screen" | ||
FontSize="20" | ||
TextTrimming="None" /> | ||
</Border> | ||
|
||
<TextBlock>TextTrimming=Clip</TextBlock> | ||
<Border MaxWidth="{Binding Value, ElementName=slider}" Background="Yellow" x:Name="border2"> | ||
<TextBlock | ||
Text="This is a very very very very long text that should not wrap even though it goes out of the screen" | ||
FontSize="20" | ||
TextTrimming="Clip" /> | ||
</Border> | ||
|
||
<TextBlock>TextTrimming=CharacterEllipsis</TextBlock> | ||
<Border MaxWidth="{Binding Value, ElementName=slider}" Background="Cyan" x:Name="border3"> | ||
<TextBlock | ||
Text="This is a very very very very long text that should not wrap even though it goes out of the screen" | ||
FontSize="20" | ||
TextTrimming="CharacterEllipsis" /> | ||
</Border> | ||
|
||
<TextBlock>TextTrimming=WordEllipsis</TextBlock> | ||
<Border MaxWidth="{Binding Value, ElementName=slider}" Background="Yellow" x:Name="border4"> | ||
<TextBlock | ||
Text="This is a very very very very long text that should not wrap even though it goes out of the screen" | ||
FontSize="20" | ||
TextTrimming="WordEllipsis" /> | ||
</Border> | ||
|
||
</StackPanel> | ||
<wasm:TextBlock Grid.Row="2"> | ||
(WASM ONLY) Cache: Hits= | ||
<Run x:Name="hits">0</Run> , Misses= | ||
<Run x:Name="misses">0</Run> . | ||
</wasm:TextBlock> | ||
</Grid> | ||
</Page> |
26 changes: 26 additions & 0 deletions
26
...p/UITests.Shared/Windows_UI_Xaml_Controls/TextBlockControl/TextBlock_TextTrimming.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Windows.UI.Xaml.Controls; | ||
using Uno.UI; | ||
using Uno.UI.Samples.Controls; | ||
|
||
namespace UITests.Windows_UI_Xaml_Controls.TextBlockControl | ||
{ | ||
[Sample] | ||
public sealed partial class TextBlock_TextTrimming : Page | ||
{ | ||
public TextBlock_TextTrimming() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
#if __WASM__ | ||
var initialHits = UnoMetrics.TextBlock.MeasureCacheHits; | ||
var initialMisses = UnoMetrics.TextBlock.MeasureCacheMisses; | ||
|
||
border1.SizeChanged += (sender, e) => | ||
{ | ||
hits.Text = (UnoMetrics.TextBlock.MeasureCacheHits - initialHits).ToString(); | ||
misses.Text = (UnoMetrics.TextBlock.MeasureCacheMisses - initialMisses).ToString(); | ||
}; | ||
#endif | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters