|
|
|
@ -17,9 +17,13 @@ namespace Avalonia.Skia.UnitTests.Media |
|
|
|
[Theory] |
|
|
|
public void Should_Get_Near_Matching_Typeface(FontWeight fontWeight, FontStyle fontStyle) |
|
|
|
{ |
|
|
|
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface.With(fontManagerImpl: new CustomFontManagerImpl()))) |
|
|
|
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface)) |
|
|
|
{ |
|
|
|
var fontCollection = new EmbeddedFontCollection(FontManager.Current, new Uri(s_notoMono)); |
|
|
|
var source = new Uri(s_notoMono, UriKind.Absolute); |
|
|
|
|
|
|
|
var fontCollection = new EmbeddedFontCollection(source, source); |
|
|
|
|
|
|
|
fontCollection.Initialize(new CustomFontManagerImpl()); |
|
|
|
|
|
|
|
Assert.True(fontCollection.TryGetGlyphTypeface("Noto Mono", fontStyle, fontWeight, FontStretch.Normal, out var glyphTypeface)); |
|
|
|
|
|
|
|
@ -32,9 +36,13 @@ namespace Avalonia.Skia.UnitTests.Media |
|
|
|
[Fact] |
|
|
|
public void Should_Not_Get_Typeface_For_Invalid_FamilyName() |
|
|
|
{ |
|
|
|
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface.With(fontManagerImpl: new CustomFontManagerImpl()))) |
|
|
|
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface)) |
|
|
|
{ |
|
|
|
var fontCollection = new EmbeddedFontCollection(FontManager.Current, new Uri(s_notoMono)); |
|
|
|
var source = new Uri(s_notoMono, UriKind.Absolute); |
|
|
|
|
|
|
|
var fontCollection = new EmbeddedFontCollection(source, source); |
|
|
|
|
|
|
|
fontCollection.Initialize(new CustomFontManagerImpl()); |
|
|
|
|
|
|
|
Assert.False(fontCollection.TryGetGlyphTypeface("ABC", FontStyle.Normal, FontWeight.Normal, FontStretch.Normal, out var glyphTypeface)); |
|
|
|
} |
|
|
|
@ -43,11 +51,13 @@ namespace Avalonia.Skia.UnitTests.Media |
|
|
|
[Fact] |
|
|
|
public void Should_Get_Typeface_For_Partial_FamilyName() |
|
|
|
{ |
|
|
|
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface.With(fontManagerImpl: new CustomFontManagerImpl()))) |
|
|
|
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface)) |
|
|
|
{ |
|
|
|
var source = new Uri("resm:Avalonia.Skia.UnitTests.Assets?assembly=Avalonia.Skia.UnitTests#T", UriKind.Absolute); |
|
|
|
|
|
|
|
var fontCollection = new EmbeddedFontCollection(FontManager.Current, source); |
|
|
|
var fontCollection = new EmbeddedFontCollection(source, source); |
|
|
|
|
|
|
|
fontCollection.Initialize(new CustomFontManagerImpl()); |
|
|
|
|
|
|
|
Assert.True(fontCollection.TryGetGlyphTypeface("T", FontStyle.Normal, FontWeight.Normal, FontStretch.Normal, out var glyphTypeface)); |
|
|
|
|
|
|
|
|