Skip to content

Commit

Permalink
Fix SKTypefaceCollection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillibald committed Apr 25, 2022
1 parent c877c1b commit ede918e
Showing 1 changed file with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,37 @@ public void Should_Get_Near_Matching_Typeface(string familyName, FontWeight font
Assert.Equal("Noto Mono", actual);
}
}

[Fact]
public void Should_Get_Null_For_Invalid_FamilyName()
public void Should_Get_Typeface_For_Invalid_FamilyName()
{
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
{
var notoMono =
new FontFamily("resm:Avalonia.Skia.UnitTests.Assets?assembly=Avalonia.Skia.UnitTests#Noto Mono");

var notoMonoCollection = SKTypefaceCollectionCache.GetOrAddTypefaceCollection(notoMono);

var typeface = notoMonoCollection.Get(new Typeface("ABC"));

Assert.Null(typeface);

Assert.NotNull(typeface);
}
}

[Fact]
public void Should_Get_Typeface_For_Partial_FamilyName()
{
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
{
var fontFamily = new FontFamily("resm:Avalonia.Skia.UnitTests.Assets?assembly=Avalonia.Skia.UnitTests#T");

var fontCollection = SKTypefaceCollectionCache.GetOrAddTypefaceCollection(fontFamily);

var typeface = fontCollection.Get(new Typeface(fontFamily));

Assert.NotNull(typeface);

Assert.Equal("Twitter Color Emoji", typeface.FamilyName);
}
}
}
Expand Down

0 comments on commit ede918e

Please sign in to comment.