Fixed the tests for linux. related to #225

This commit is contained in:
Matthew Leibowitz 2017-01-29 16:58:38 +02:00
Родитель 9ef45356e0
Коммит db3a3029ef
3 изменённых файлов: 22 добавлений и 6 удалений

Просмотреть файл

@ -11,6 +11,9 @@ namespace SkiaSharp.Tests
{
using (var typeface = SKTypeface.FromFile (Path.Combine (PathToFonts, "SpiderSymbol.ttf")))
{
if (IsLinux) // see issue #225
Assert.Equal("", typeface.FamilyName);
else
Assert.Equal ("SpiderSymbol", typeface.FamilyName);
}
}

Просмотреть файл

@ -13,13 +13,17 @@ namespace SkiaSharp.Tests
protected static readonly string PathToFonts = Path.Combine(PathToAssembly, "fonts");
protected static readonly string PathToImages = Path.Combine(PathToAssembly, "images");
protected static bool IsUnix => RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
protected static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
protected static bool IsMac => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
protected static bool IsUnix => IsLinux || IsMac;
protected static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
#else
protected const string PathToFonts = "fonts";
protected const string PathToImages = "images";
protected static bool IsUnix => Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix;
protected static bool IsMac => Environment.OSVersion.Platform == PlatformID.MacOSX;
protected static bool IsUnix => Environment.OSVersion.Platform == PlatformID.Unix || IsMac;
protected static bool IsLinux => IsUnix && !IsMac;
protected static bool IsWindows => !IsUnix;
#endif
}

Просмотреть файл

@ -33,6 +33,9 @@ namespace SkiaSharp.Tests
{
using (var typeface = SKTypeface.FromFile(Path.Combine(PathToFonts, "Roboto2-Regular_NoEmbed.ttf")))
{
if (IsLinux) // see issue #225
Assert.Equal("", typeface.FamilyName);
else
Assert.Equal("Roboto2", typeface.FamilyName);
}
}
@ -60,6 +63,9 @@ namespace SkiaSharp.Tests
{
using (var typeface = SKTypeface.FromFile(Path.Combine(PathToFonts, "SpiderSymbol.ttf")))
{
if (IsLinux) // see issue #225
Assert.Equal("", typeface.FamilyName);
else
Assert.Equal("SpiderSymbol", typeface.FamilyName);
var tables = typeface.GetTableTags();
Assert.Equal(ExpectedTablesSpiderFont.Length, tables.Length);
@ -75,6 +81,9 @@ namespace SkiaSharp.Tests
{
using (var typeface = SKTypeface.FromFile(Path.Combine(PathToFonts, "ReallyBigA.ttf")))
{
if (IsLinux) // see issue #225
Assert.Equal("", typeface.FamilyName);
else
Assert.Equal("ReallyBigA", typeface.FamilyName);
var tables = typeface.GetTableTags();