Skip to content

Commit b86c307

Browse files
Merge pull request #21661 from ramezgerges/unicode_text
Unicode text
2 parents 2e22d41 + 6830be6 commit b86c307

File tree

35 files changed

+3352
-1746
lines changed

35 files changed

+3352
-1746
lines changed

src/Directory.Build.targets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<MicrosoftTestingPlatformVersion>1.9.0</MicrosoftTestingPlatformVersion>
6666
<SkiaSharpVersion>3.119.0</SkiaSharpVersion>
6767
<HarfbuzzSharpVersion>8.3.1.1</HarfbuzzSharpVersion>
68+
<UnoICUVersion>77.1.0-dev.45</UnoICUVersion>
6869
</PropertyGroup>
6970

7071
<ItemGroup>
@@ -162,6 +163,12 @@
162163
<PackageReference Update="Xamarin.AndroidX.SwipeRefreshLayout" Version="1.1.0.28" />
163164
</ItemGroup>
164165

166+
<ItemGroup>
167+
<PackageReference Update="Uno.icu-macos" Version="$(UnoICUVersion)" />
168+
<PackageReference Update="Uno.icu-wasm" Version="$(UnoICUVersion)" />
169+
<PackageReference Update="Uno.icu-ios" Version="$(UnoICUVersion)" />
170+
</ItemGroup>
171+
165172
<Target Name="ValidateSolutionPath" BeforeTargets="Build">
166173
<Error Condition="$(MSBuildThisFileDirectory.Contains(' '))"
167174
Text="The Uno.UI Solution cannot build with a space in the path. Consider changing to a path without spaces."/>

src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UnitTest/UnitTestsControl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,13 +590,13 @@ private string GetTestResultIcon(TestResult testResult)
590590
default:
591591
case TestResult.Error:
592592
case TestResult.Failed:
593-
return " (F)";
593+
return "\uE711 (F)";
594594

595595
case TestResult.Skipped:
596-
return "🚫 (I)";
596+
return "\uEE35 (I)";
597597

598598
case TestResult.Passed:
599-
return "✔️ (S)";
599+
return "\uE73E (S)";
600600
}
601601
}
602602

src/Uno.UI.Runtime.Skia.AppleUIKit/Uno.UI.Runtime.Skia.AppleUIKit.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<PackageReference Include="SkiaSharp" />
4848
<PackageReference Include="HarfBuzzSharp" />
4949
<PackageReference Include="SkiaSharp.Views" />
50+
<PackageReference Include="Uno.icu-ios" />
5051
</ItemGroup>
5152

5253
<ItemGroup>

src/Uno.UI.Runtime.Skia.MacOS/Uno.UI.Runtime.Skia.MacOS.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<PackageReference Include="HarfBuzzSharp.NativeAssets.macOS" />
3030
<PackageReference Include="HarfBuzzSharp" />
3131
<PackageReference Include="SkiaSharp" />
32+
<PackageReference Include="Uno.icu-macos" />
3233
</ItemGroup>
3334

3435
<PropertyGroup>

src/Uno.UI.Runtime.Skia.WebAssembly.Browser/Uno.UI.Runtime.Skia.WebAssembly.Browser.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<PackageReference Include="SkiaSharp" />
3838
<PackageReference Include="HarfBuzzSharp" />
3939
<PackageReference Include="Microsoft.TypeScript.MSBuild" PrivateAssets="all" />
40+
<PackageReference Include="Uno.icu-wasm" />
4041
</ItemGroup>
4142

4243
<ItemGroup>

src/Uno.UI.Runtime.Skia.Win32/Uno.UI.Runtime.Skia.Win32.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106" />
3131
<PackageReference Include="HarfBuzzSharp" />
32+
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
3233
</ItemGroup>
3334

3435
<ItemGroup>

src/Uno.UI.Runtime.Skia.Wpf/Uno.UI.Runtime.Skia.Wpf.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
<ItemGroup>
3131
<PackageReference Include="Microsoft.Web.WebView2" Aliases="WpfWebView" PrivateAssets="all" />
32+
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
3233

3334
<!--
3435
Required to ensure that this reference is latest and not

src/Uno.UI.RuntimeTests/Tests/HotReload/Frame/HRApp/Uno.UI.RuntimeTests.HRApp.Skia.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<PackageReference Include="Uno.UI.RuntimeTests.Engine" Version="0.36.0-dev.124" />
4646
<PackageReference Include="Uno.Fonts.Fluent" />
4747
<PackageReference Include="Uno.Fonts.OpenSans" Version="2.7.1" />
48+
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
4849

4950
<!--
5051
<PackageReference Include="Uno.Resizetizer" Version="1.0.4" />

src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBlock.cs

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,9 @@ public async Task Check_FontFallback()
155155
await ImageAssert.AreSimilarAsync(screenshot1, screenshot2, imperceptibilityThreshold: 0.15);
156156
}
157157

158-
// Reason for failure on X11 is not very known, but it's likely the AdvanceX of space character
159-
// is different between the fallback font and OpenSans
160158
[TestMethod]
161-
[PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.SkiaX11 | RuntimeTestPlatforms.SkiaWasm)]
159+
// Different platforms will resolve SKFontManager.Default.MatchCharacter to different fonts
160+
[PlatformCondition(ConditionMode.Include, RuntimeTestPlatforms.SkiaWin32)]
162161
public async Task Check_FontFallback_Shaping()
163162
{
164163
var SUT = new TextBlock
@@ -169,7 +168,6 @@ public async Task Check_FontFallback_Shaping()
169168
};
170169

171170
var skFont = FontDetailsCache.GetFont(SUT.FontFamily?.Source, (float)SUT.FontSize, SUT.FontWeight, SUT.FontStretch, SUT.FontStyle).details.SKFont;
172-
var familyName = skFont.Typeface.FamilyName;
173171
Assert.IsFalse(skFont.ContainsGlyph(SUT.Text[0]));
174172

175173
var fallbackFont = SKFontManager.Default.MatchCharacter(SUT.Text[0]);
@@ -656,40 +654,12 @@ public async Task When_Changing_Text_Through_Inlines()
656654
#endif
657655

658656
[TestMethod]
659-
public async Task When_FontFamily_In_Separate_Assembly()
657+
[PlatformCondition(ConditionMode.Include, RuntimeTestPlatforms.Skia)]
658+
[DataRow("ms-appx:///Assets/Fonts/CascadiaCode-Regular.ttf")]
659+
[DataRow("ms-appx:///Uno.UI.RuntimeTests/Assets/Fonts/Roboto-Regular.ttf")]
660+
public async Task When_FontFamily_Changed(string font)
660661
{
661-
var SUT = new TextBlock { Text = "\xE102\xE102\xE102\xE102\xE102" };
662-
WindowHelper.WindowContent = SUT;
663-
await WindowHelper.WaitForIdle();
664-
665-
var size = new Size(1000, 1000);
666-
SUT.Measure(size);
667-
668-
var originalSize = SUT.DesiredSize;
669-
670-
Assert.AreNotEqual(0, SUT.DesiredSize.Width);
671-
Assert.AreNotEqual(0, SUT.DesiredSize.Height);
672-
673-
SUT.FontFamily = new Microsoft.UI.Xaml.Media.FontFamily("ms-appx:///Uno.UI.RuntimeTests/Assets/Fonts/uno-fluentui-assets-runtimetest01.ttf");
674-
675-
int counter = 3;
676-
677-
do
678-
{
679-
await WindowHelper.WaitForIdle();
680-
await Task.Delay(100);
681-
682-
SUT.InvalidateMeasure();
683-
}
684-
while (SUT.DesiredSize == originalSize && counter-- > 0);
685-
686-
Assert.AreNotEqual(originalSize, SUT.DesiredSize);
687-
}
688-
689-
[TestMethod]
690-
public async Task When_FontFamily_Default()
691-
{
692-
var SUT = new TextBlock { Text = "\xE102\xE102\xE102\xE102\xE102" };
662+
var SUT = new TextBlock { Text = "abcd" };
693663
WindowHelper.WindowContent = SUT;
694664
await WindowHelper.WaitForIdle();
695665

@@ -701,7 +671,7 @@ public async Task When_FontFamily_Default()
701671
Assert.AreNotEqual(0, SUT.DesiredSize.Width);
702672
Assert.AreNotEqual(0, SUT.DesiredSize.Height);
703673

704-
SUT.FontFamily = Application.Current.Resources["SymbolThemeFontFamily"] as FontFamily;
674+
SUT.FontFamily = new FontFamily(font);
705675

706676
int counter = 3;
707677

src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_TextBox.skia.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using Windows.System;
2323
using Windows.UI;
2424
using Windows.UI.Input.Preview.Injection;
25+
using Uno.UI.Xaml.Media;
2526
using static Private.Infrastructure.TestServices;
2627
using Color = Windows.UI.Color;
2728
using Point = Windows.Foundation.Point;
@@ -2058,6 +2059,7 @@ public async Task When_Paste_History_Remains_Intact()
20582059
var text = "copied content";
20592060
dp.SetText(text);
20602061
Clipboard.SetContent(dp);
2062+
await Task.Delay(500);
20612063

20622064
// This actually matches WinUI. text comes before "initial" and text2 comes after text
20632065

@@ -2069,6 +2071,7 @@ public async Task When_Paste_History_Remains_Intact()
20692071
var text2 = "copied content 2";
20702072
dp2.SetText(text2);
20712073
Clipboard.SetContent(dp2);
2074+
await Task.Delay(500);
20722075

20732076
SUT.PasteFromClipboard();
20742077
await WindowHelper.WaitForIdle();
@@ -2738,7 +2741,7 @@ public async Task When_Multiline_Pointer_Tap()
27382741
using var mouse = injector.GetMouse();
27392742

27402743
var bounds = SUT.GetAbsoluteBounds();
2741-
mouse.MoveTo(bounds.GetCenter());
2744+
mouse.MoveTo(bounds.Location.Offset(145, 50));
27422745
await WindowHelper.WaitForIdle();
27432746

27442747
mouse.Press();
@@ -2956,8 +2959,8 @@ public async Task When_Multiline_Pointer_TripleTap()
29562959
mouse.Release();
29572960
await WindowHelper.WaitForIdle();
29582961

2959-
Assert.AreEqual(13, SUT.SelectionStart);
2960-
Assert.AreEqual(26, SUT.SelectionLength);
2962+
Assert.AreEqual(25, SUT.SelectionStart);
2963+
Assert.AreEqual(14, SUT.SelectionLength);
29612964
}
29622965

29632966
[TestMethod]
@@ -4214,10 +4217,10 @@ public async Task When_Caret_Color_DarkMode()
42144217
{
42154218
await Task.Delay(random.Next(75, 126));
42164219
var screenshot = await UITestHelper.ScreenShot(SUT);
4217-
// For some reason, the caret sometimes appears black, and sometimes as very dark grey (#FF030303), so we check for both
4218-
Color[] blacks = [Colors.Black, Colors.FromARGB(0xFF, 0x03, 0x03, 0x03)];
4219-
if (blacks.Any(b => HasColorInRectangle(screenshot, new Rectangle(0, 0, screenshot.Width / 2, screenshot.Height), b)) &&
4220-
blacks.All(b => !HasColorInRectangle(screenshot, new Rectangle(screenshot.Width / 2, 0, screenshot.Width / 2, screenshot.Height), Colors.Black)))
4220+
// this color is the result of alpha blending 0xE4000000 (the default caret color) on top of 0xFFFFFFFF
4221+
var black = Colors.White.AlphaBlend(((SolidColorBrush)DefaultBrushes.TextForegroundBrush).Color);
4222+
if (HasColorInRectangle(screenshot, new Rectangle(0, 0, screenshot.Width / 2, screenshot.Height), black) &&
4223+
!HasColorInRectangle(screenshot, new Rectangle(screenshot.Width / 2, 0, screenshot.Width / 2, screenshot.Height), black))
42214224
{
42224225
break;
42234226
}

0 commit comments

Comments
 (0)