This commit is contained in:
Matthew Leibowitz 2017-01-22 00:27:08 +02:00
Родитель 030363e0f8
Коммит c29c395049
6 изменённых файлов: 74 добавлений и 5 удалений

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

@ -161,8 +161,11 @@ Task ("libs")
Task ("tests")
.IsDependentOn ("libs")
.IsDependentOn ("nuget")
.Does (() =>
{
ClearSkiaSharpNuGetCache ();
RunNuGetRestore ("./tests/SkiaSharp.Desktop.Tests/SkiaSharp.Desktop.Tests.sln");
// Windows (x86 and x64)
@ -185,6 +188,11 @@ Task ("tests")
});
RunTests("./tests/SkiaSharp.Desktop.Tests/bin/AnyCPU/Release/SkiaSharp.Desktop.Tests.dll", false);
}
// .NET Core
RunDotNetCoreRestore ("./tests/SkiaSharp.NetCore.Tests");
DotNetCoreTest ("./tests/SkiaSharp.NetCore.Tests", new DotNetCoreTestSettings {
Configuration = "Release"
});
});
////////////////////////////////////////////////////////////////////////////////////////////////////

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

@ -9,6 +9,14 @@ var RunNuGetRestore = new Action<FilePath> ((solution) =>
});
});
var RunDotNetCoreRestore = new Action<string> ((solution) =>
{
DotNetCoreRestore (solution, new DotNetCoreRestoreSettings {
Sources = NuGetSources,
Verbosity = DotNetCoreRestoreVerbosity.Verbose
});
});
var PackageNuGet = new Action<FilePath, DirectoryPath> ((nuspecPath, outputPath) =>
{
if (!DirectoryExists (outputPath)) {

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

@ -0,0 +1,47 @@
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"define": [
"NET_STANDARD"
],
"allowUnsafe": true,
"compile": {
"include": "../Tests/*.cs",
"excludeFiles":[
"../Tests/SKSurfaceTest.cs"
]
},
"copyToOutput": {
"mappings": {
"fonts/": { "include": "../Content/fonts/" },
"images/": { "include": "../Content/images/" }
}
}
},
"dependencies": {
"xunit": "2.2.0-beta5-build3474",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"SkiaSharp": "1.56.0",
"SkiaSharp.Svg": "1.56.0-beta1"
},
"testRunner": "xunit",
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
},
"imports": [
"portable-net451+win8"
]
}
},
"runtimes": {
"win7-x64": { },
"win7-x86": { },
"osx.10.10-x64": { }
}
}

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

@ -9,7 +9,7 @@ namespace SkiaSharp.Tests
[Fact]
public void StringIsMarshaledCorrectly ()
{
using (var typeface = SKTypeface.FromFile (Path.Combine ("fonts", "SpiderSymbol.ttf")))
using (var typeface = SKTypeface.FromFile (Path.Combine (PathToFonts, "SpiderSymbol.ttf")))
{
Assert.Equal ("SpiderSymbol", typeface.FamilyName);
}

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

@ -1,4 +1,6 @@
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Xunit;
@ -6,13 +8,17 @@ namespace SkiaSharp.Tests
{
public abstract class SKTest
{
protected const string PathToFonts = "fonts";
protected const string PathToImages = "images";
#if NET_STANDARD
protected static readonly string PathToAssembly = Path.GetDirectoryName(typeof(SKTest).GetTypeInfo().Assembly.Location);
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 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 IsWindows => !IsUnix;
#endif

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.11.0" />
<package id="Cake" version="0.17.0" />
<package id="XUnit.Runner.Console" version="2.1.0" />
<package id="Microsoft.DotNet.BuildTools.GenAPI" version="1.0.0-beta-00081" />
</packages>