Fixing the tests for Xunit
This commit is contained in:
Родитель
2f86d008f6
Коммит
9d2c14bc9d
|
@ -1,16 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{F0179CDB-9435-4FB4-8E52-DBF191079491}</ProjectGuid>
|
<ProjectGuid>{F0179CDB-9435-4FB4-8E52-DBF191079491}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>SkiaSharp.Tests</RootNamespace>
|
<RootNamespace>SkiaSharp.Tests</RootNamespace>
|
||||||
<AssemblyName>SkiaSharp.Tests</AssemblyName>
|
<AssemblyName>SkiaSharp.Tests</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<ShouldIncludeNativeSkiaSharp>True</ShouldIncludeNativeSkiaSharp>
|
<ShouldIncludeNativeSkiaSharp>True</ShouldIncludeNativeSkiaSharp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
@ -74,14 +71,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="xunit" Version="2.4.0-beta1-build3891" />
|
<PackageReference Include="xunit" Version="2.4.0-beta1-build3891" />
|
||||||
|
|
|
@ -6,10 +6,11 @@ using Xunit;
|
||||||
|
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using SkiaSharp.HarfBuzz;
|
using SkiaSharp.HarfBuzz;
|
||||||
|
using SkiaSharp.Tests;
|
||||||
|
|
||||||
namespace HarfBuzzSharp.Tests
|
namespace HarfBuzzSharp.Tests
|
||||||
{
|
{
|
||||||
public class SKShaperTest : TestBase
|
public class SKShaperTest : SKTest
|
||||||
{
|
{
|
||||||
[SkippableFact]
|
[SkippableFact]
|
||||||
public void DrawShapedTextExtensionMethodDraws()
|
public void DrawShapedTextExtensionMethodDraws()
|
||||||
|
@ -72,56 +73,4 @@ namespace HarfBuzzSharp.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class TestBase
|
|
||||||
{
|
|
||||||
protected static readonly string PathToAssembly = Path.GetDirectoryName(typeof(TestBase).GetTypeInfo().Assembly.Location);
|
|
||||||
protected static readonly string PathToFonts = Path.Combine(PathToAssembly, "fonts");
|
|
||||||
protected static readonly string PathToImages = Path.Combine(PathToAssembly, "images");
|
|
||||||
|
|
||||||
#if NET_STANDARD
|
|
||||||
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
|
|
||||||
private static class MacPlatformDetector
|
|
||||||
{
|
|
||||||
internal static readonly Lazy<bool> IsMac = new Lazy<bool>(IsRunningOnMac);
|
|
||||||
|
|
||||||
[DllImport("libc")]
|
|
||||||
static extern int uname(IntPtr buf);
|
|
||||||
|
|
||||||
static bool IsRunningOnMac()
|
|
||||||
{
|
|
||||||
IntPtr buf = IntPtr.Zero;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
buf = Marshal.AllocHGlobal(8192);
|
|
||||||
// This is a hacktastic way of getting sysname from uname ()
|
|
||||||
if (uname(buf) == 0)
|
|
||||||
{
|
|
||||||
string os = Marshal.PtrToStringAnsi(buf);
|
|
||||||
if (os == "Darwin")
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (buf != IntPtr.Zero)
|
|
||||||
Marshal.FreeHGlobal(buf);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static bool IsMac => MacPlatformDetector.IsMac.Value;
|
|
||||||
protected static bool IsUnix => Environment.OSVersion.Platform == PlatformID.Unix || IsMac;
|
|
||||||
protected static bool IsLinux => IsUnix && !IsMac;
|
|
||||||
protected static bool IsWindows => !IsUnix;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ namespace SkiaSharp.Tests
|
||||||
{
|
{
|
||||||
public abstract class SKTest
|
public abstract class SKTest
|
||||||
{
|
{
|
||||||
protected static readonly string PathToAssembly = Path.GetDirectoryName(typeof(SKTest).GetTypeInfo().Assembly.Location);
|
protected static readonly string PathToAssembly = Directory.GetCurrentDirectory();
|
||||||
protected static readonly string PathToFonts = Path.Combine(PathToAssembly, "fonts");
|
protected static readonly string PathToFonts = Path.Combine(PathToAssembly, "fonts");
|
||||||
protected static readonly string PathToImages = Path.Combine(PathToAssembly, "images");
|
protected static readonly string PathToImages = Path.Combine(PathToAssembly, "images");
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче