Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SKTypefaceCollection tests #8045

Merged
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
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