diff --git a/EquinoxLabs.SVGSharpie.sln b/EquinoxLabs.SVGSharpie.sln index fe052d2..6b4a683 100644 --- a/EquinoxLabs.SVGSharpie.sln +++ b/EquinoxLabs.SVGSharpie.sln @@ -6,6 +6,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EquinoxLabs.SVGSharpie", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EquinoxLabs.SVGSharpie.ImageSharp", "src\EquinoxLabs.SVGSharpie.ImageSharp\EquinoxLabs.SVGSharpie.ImageSharp.csproj", "{E4E9C756-3BDE-46B4-AEAD-9837A7316746}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EquinoxLabs.SVGSharpie.ImageSharp.Tests", "tests\EquinoxLabs.SVGSharpie.ImageSharp.Tests\EquinoxLabs.SVGSharpie.ImageSharp.Tests.csproj", "{46F9A6AA-1E92-4ADE-9C2B-536EFBEFAA3C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,6 +22,10 @@ Global {E4E9C756-3BDE-46B4-AEAD-9837A7316746}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4E9C756-3BDE-46B4-AEAD-9837A7316746}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4E9C756-3BDE-46B4-AEAD-9837A7316746}.Release|Any CPU.Build.0 = Release|Any CPU + {46F9A6AA-1E92-4ADE-9C2B-536EFBEFAA3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {46F9A6AA-1E92-4ADE-9C2B-536EFBEFAA3C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46F9A6AA-1E92-4ADE-9C2B-536EFBEFAA3C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {46F9A6AA-1E92-4ADE-9C2B-536EFBEFAA3C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/appveyor.yml b/appveyor.yml index ae33612..a0f9739 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,15 +24,6 @@ environment: - target_framework: net462 is_32bit: True - #- target_framework: mono - # is_32bit: False - #- target_framework: mono - # is_32bit: True - #- target_framework: net47 - # is_32bit: False - #- target_framework: net47 - # is_32bit: True - install: - ps: | if ($env:target_framework -eq "mono") { @@ -51,7 +42,7 @@ build_script: - cmd: build.cmd # test_script: -# - ps: .\run-tests.ps1 $env:target_framework $env:is_32bit + - ps: .\run-tests.ps1 $env:target_framework $env:is_32bit after_test: - cmd: appveyor PushArtifact "artifacts\EquinoxLabs.SVGSharpie.%APPVEYOR_BUILD_VERSION%.nupkg" diff --git a/run-tests.ps1 b/run-tests.ps1 index fcca6b4..fc21da4 100644 --- a/run-tests.ps1 +++ b/run-tests.ps1 @@ -46,7 +46,7 @@ if ( ($targetFramework -eq "netcoreapp2.1") -and ($env:CI -eq "True") -and ($is3 $testRunnerCmd = ".\tests\CodeCoverage\CodeCoverage.cmd" } elseif ($targetFramework -eq "mono") { - $testDllPath = "$PSScriptRoot\tests\SVGSharpie.Tests\bin\Release\net462\SixLabors.ImageSharp.Tests.dll" + $testDllPath = "$PSScriptRoot\tests\EquinoxLabs.SVGSharpie.ImageSharp.Tests\bin\Release\net462\EquinoxLabs.SVGSharpie.ImageSharp.Tests.dll" VerifyPath($testDllPath, "test dll missing:") $xunitRunnerPath = "${env:HOMEPATH}\.nuget\packages\xunit.runner.console\2.3.1\tools\net452\" diff --git a/src/EquinoxLabs.SVGSharpie.ImageSharp/SvgImageRenderer.cs b/src/EquinoxLabs.SVGSharpie.ImageSharp/SvgImageRenderer.cs index a5fc35b..2ec7954 100644 --- a/src/EquinoxLabs.SVGSharpie.ImageSharp/SvgImageRenderer.cs +++ b/src/EquinoxLabs.SVGSharpie.ImageSharp/SvgImageRenderer.cs @@ -6,26 +6,56 @@ using SixLabors.ImageSharp.Processing; namespace EquinoxLabs.SVGSharpie.ImageSharp { + /// + /// SVG image renderer + /// public static class SvgImageRenderer { - + /// + /// Render SVG from xml string + /// + /// + /// + /// public static Image RenderFromString(string content) where TPixel : struct, IPixel { var document = SvgDocument.Parse(content); return RenderInner(document, null, null); } + /// + /// Render SVG from xml string + /// + /// + /// + /// + /// + /// public static Image RenderFromString(string content, int width, int height) where TPixel : struct, IPixel { var document = SvgDocument.Parse(content); return RenderInner(document, width, height); } + /// + /// Render SVG from SvgDocument + /// + /// + /// + /// public static Image RenderFromDocument(SvgDocument document) where TPixel : struct, IPixel { return RenderInner(document, null, null); } + /// + /// Render SVG from SvgDocument + /// + /// + /// + /// + /// + /// public static Image RenderFromDocument(SvgDocument document, int width, int height) where TPixel : struct, IPixel { return RenderInner(document, width, height); diff --git a/tests/CodeCoverage/CodeCoverage.cmd b/tests/CodeCoverage/CodeCoverage.cmd new file mode 100644 index 0000000..720feb3 --- /dev/null +++ b/tests/CodeCoverage/CodeCoverage.cmd @@ -0,0 +1,21 @@ +@echo off + + +cd tests\CodeCoverage + +nuget restore packages.config -PackagesDirectory . + +cd .. +cd .. + +dotnet restore EquinoxLabs.SVGSharpie.sln +rem Clean the solution to force a rebuild with /p:codecov=true +dotnet clean EquinoxLabs.SVGSharpie.sln -c Release +rem The -threshold options prevents this taking ages... +tests\CodeCoverage\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"dotnet.exe" -targetargs:"test tests\EquinoxLabs.SVGSharpie.ImageSharp.Tests\EquinoxLabs.SVGSharpie.ImageSharp.Tests.csproj -c Release -f netcoreapp2.1 /p:codecov=true" -register:user -threshold:10 -oldStyle -safemode:off -output:.\SVGSharpie.Coverage.xml -hideskipped:All -returntargetcode -filter:"+[EquinoxLabs.SVGSharpie*]*" + +if %errorlevel% neq 0 exit /b %errorlevel% + +SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH% +pip install codecov +codecov -f "SVGSharpie.Coverage.xml" \ No newline at end of file diff --git a/tests/CodeCoverage/packages.config b/tests/CodeCoverage/packages.config new file mode 100644 index 0000000..973b7f8 --- /dev/null +++ b/tests/CodeCoverage/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests.csproj b/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests.csproj new file mode 100644 index 0000000..6959462 --- /dev/null +++ b/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests.csproj @@ -0,0 +1,42 @@ + + + netcoreapp2.1;net462;net472 + True + latest + full + portable + True + EquinoxLabs.SVGSharpie.ImageSharp.Tests + EquinoxLabs.SVGSharpie.ImageSharp.Tests + AnyCPU;x64;x86 + + + false + + + + false + + + + false + + + + + + + + + + + + + + + + + + + + diff --git a/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/Tests.cs b/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/Tests.cs new file mode 100644 index 0000000..1afb338 --- /dev/null +++ b/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/Tests.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace EquinoxLabs.SVGSharpie.ImageSharp.Tests +{ + public class Tests + { + [Fact] + public void FileTest() + { + string path = Path.GetTempFileName(); + string testData = Guid.NewGuid().ToString(); + File.WriteAllText(path, testData); + string data = File.ReadAllText(path); + Assert.Equal(testData, data); + File.Delete(path); + } + } +} diff --git a/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/xunit.runner.json b/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/xunit.runner.json new file mode 100644 index 0000000..d46942c --- /dev/null +++ b/tests/EquinoxLabs.SVGSharpie.ImageSharp.Tests/xunit.runner.json @@ -0,0 +1,5 @@ +{ + "shadowCopy": false, + "methodDisplay": "method", + "diagnosticMessages": true +} \ No newline at end of file