diff --git a/.gitignore b/.gitignore index a190a85ba..a63e5ded8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Tests/**/*.suo Source/TestResults/ Source/.vs /Source/Svg.sln.DotSettings.user +/Source/Svg.XML diff --git a/Source/DataTypes/SvgUnitConverter.cs b/Source/DataTypes/SvgUnitConverter.cs index a383cf5a4..6e3b600f4 100644 --- a/Source/DataTypes/SvgUnitConverter.cs +++ b/Source/DataTypes/SvgUnitConverter.cs @@ -1,11 +1,6 @@ using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Globalization; -using System.Text; -using System.Text.RegularExpressions; -using System.Web.UI.WebControls; namespace Svg { diff --git a/Source/Document Structure/SvgGroup.cs b/Source/Document Structure/SvgGroup.cs index 32e72bd95..20a9927ff 100644 --- a/Source/Document Structure/SvgGroup.cs +++ b/Source/Document Structure/SvgGroup.cs @@ -56,7 +56,7 @@ protected override void Render(ISvgRenderer renderer) } /// - /// Gets the for this element. + /// Gets the for this element. /// /// public override GraphicsPath Path(ISvgRenderer renderer) diff --git a/Source/Painting/EnumConverters.cs b/Source/Painting/EnumConverters.cs index ebb6e55cb..87a8f34d6 100644 --- a/Source/Painting/EnumConverters.cs +++ b/Source/Painting/EnumConverters.cs @@ -84,7 +84,7 @@ public EnumBaseConverter() { } /// Creates a new instance. /// Specified the default value of the enum. - /// Specified the case. + /// Defines if the value shall be converted to lower camel case or lower case public EnumBaseConverter(T defaultValue, CaseHandling caseHandling = CaseHandling.CamelCase) { this.DefaultValue = defaultValue; diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index a80d3998a..315266f61 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -1,4 +1,5 @@ using System; +#if NETFULL using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -34,7 +35,7 @@ // by using the '*' as shown below: [assembly: AssemblyVersion("2.4.3.*")] //[assembly: AssemblyFileVersion("1.0.1.*")] - +#endif [assembly: CLSCompliant(true)] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Svg.UnitTests,PublicKey=" + diff --git a/Source/Svg.csproj b/Source/Svg.csproj index 8a18cf869..f93b1a6b9 100644 --- a/Source/Svg.csproj +++ b/Source/Svg.csproj @@ -1,393 +1,145 @@ - - + - Debug - AnyCPU - 9.0.30729 - 2.0 - {886A98C5-37C0-4E8B-885E-30C1D2F98B47} - Library - Properties + net40;netcoreapp2.2;net35;net452;net472 + MIT Svg Svg - OnOutputUpdated - - - 3.5 - - - v3.5 - false - - - - - - - - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - False - False - False - False - False - File - obj\$(Configuration)\ - - - Full - false - ..\..\vvvv\public\common\src\thirdparty\ - TRACE;DEBUG;REFLECTION - prompt - 4 - AllRules.ruleset - true - - - false - 1591 - - - PdbOnly - True - bin\Release\ - TRACE - prompt - 4 - - - AllRules.ruleset - false - bin\Release\Svg.XML + true + + davescriven,jvenema,owaits,ddpruitt,Ralf1108,Tebjan Halm,and others + Svg + SVG Rendering Library + SVG Rendering Library + + Public fork of the C# SVG rendering library on codeplex: https://svg.codeplex.com/ + This started out as a minor modification to enable the writing of proper SVG strings. But now after almost two years we have so many fixes and improvements that we decided to share our current codebase to the public in order to improve it even further. + So please feel free to fork it and open pull requests for any fix, improvement or feature you add. + License: Microsoft Public License: https://svg.codeplex.com/license + + Copyright © vvvv.org + svg, vector graphics, rendering + {886A98C5-37C0-4E8B-885E-30C1D2F98B47} + $(OutputPath)Svg.XML + Debug;Release 1591 - - true - - svgkey.snk + 2.4.5.0 + 2.4.5.0 + 2.4.5 + svg, vector graphics, rendering + true + false + true + +Supports multiple targets v3.5 thru to dotnetcore2.2. +NetStandard does not fully support the Drawing2D package - so has been left out. + + https://github.com/vvvv/SVG - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - + - - - - - - - + + + $(DefineConstants);TRACE;DEBUG + + + $(DefineConstants);TRACE;RELEASE + + + + Svg for .Net Framework 3.5 + $(DefineConstants);NETFULL;NET35 + true + + + + Svg for .Net Framework 4.0 + $(DefineConstants);NETFULL;NET40 + true + + + + Svg for .Net Framework 4.5.2 + $(DefineConstants);NETFULL;NET452 + true + + + + Svg for .Net Framework 4.7.2 + $(DefineConstants);NETFULL;NET472 + true + + + + Svg for .Net Core 2.2 + $(DefineConstants);NETCORE;NETCORE22 + + + + + + + + + + - - + $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client - - False - Auto - 4194304 - AnyCPU - 4096 + + $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 - - False + + $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2 - - False - obj\ + + $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4.5.1 + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Svg.sln b/Source/Svg.sln index 5348237dd..248b73438 100644 --- a/Source/Svg.sln +++ b/Source/Svg.sln @@ -1,13 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.168 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Svg", "Svg.csproj", "{886A98C5-37C0-4E8B-885E-30C1D2F98B47}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Svg", "Svg.csproj", "{886A98C5-37C0-4E8B-885E-30C1D2F98B47}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVGViewer", "..\Samples\SVGViewer\SVGViewer.csproj", "{1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Svg.UnitTests", "..\Tests\Svg.UnitTests\Svg.UnitTests.csproj", "{E702EB7D-D01D-438A-BADD-E72D4E49109F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Svg.UnitTests", "..\Tests\Svg.UnitTests\Svg.UnitTests.csproj", "{E702EB7D-D01D-438A-BADD-E72D4E49109F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A417AF1E-BEDB-4715-B4FD-D795579217F9}" ProjectSection(SolutionItems) = preProject @@ -16,10 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SvgW3CTestRunner", "..\Tests\SvgW3CTestRunner\SvgW3CTestRunner.csproj", "{8ED74C39-6CFF-421E-952A-30F9E6957108}" -EndProject -Project("{FF286327-C783-4F7A-AB73-9BCBAD0D4460}") = "Svg.Package", "SvgNuget\Svg.Package.nuproj", "{AEEFC0CC-6D17-439D-B8E0-53B713485E3B}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,18 +34,6 @@ Global {886A98C5-37C0-4E8B-885E-30C1D2F98B47}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {886A98C5-37C0-4E8B-885E-30C1D2F98B47}.Release|Mixed Platforms.Build.0 = Release|Any CPU {886A98C5-37C0-4E8B-885E-30C1D2F98B47}.Release|x86.ActiveCfg = Release|Any CPU - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Any CPU.ActiveCfg = Release|Any CPU - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Any CPU.Build.0 = Release|Any CPU - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|x86.ActiveCfg = Debug|x86 - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|x86.Build.0 = Debug|Any CPU - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Any CPU.Build.0 = Release|Any CPU - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|Mixed Platforms.Build.0 = Release|x86 - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|x86.ActiveCfg = Release|Any CPU - {1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|x86.Build.0 = Release|Any CPU {E702EB7D-D01D-438A-BADD-E72D4E49109F}.Debug|Any CPU.ActiveCfg = Release|Any CPU {E702EB7D-D01D-438A-BADD-E72D4E49109F}.Debug|Any CPU.Build.0 = Release|Any CPU {E702EB7D-D01D-438A-BADD-E72D4E49109F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -62,34 +44,13 @@ Global {E702EB7D-D01D-438A-BADD-E72D4E49109F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {E702EB7D-D01D-438A-BADD-E72D4E49109F}.Release|Mixed Platforms.Build.0 = Release|Any CPU {E702EB7D-D01D-438A-BADD-E72D4E49109F}.Release|x86.ActiveCfg = Release|Any CPU - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Any CPU.ActiveCfg = Release|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Any CPU.Build.0 = Release|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|x86.ActiveCfg = Debug|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Debug|x86.Build.0 = Debug|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Any CPU.ActiveCfg = Release|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Any CPU.Build.0 = Release|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|Mixed Platforms.Build.0 = Release|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|x86.ActiveCfg = Release|x86 - {8ED74C39-6CFF-421E-952A-30F9E6957108}.Release|x86.Build.0 = Release|x86 - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|x86.ActiveCfg = Debug|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Debug|x86.Build.0 = Debug|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Any CPU.Build.0 = Release|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|x86.ActiveCfg = Release|Any CPU - {AEEFC0CC-6D17-439D-B8E0-53B713485E3B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5096EEB3-8F41-44B5-BCF9-58743A59AB21} + EndGlobalSection GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = Svg.vsmdi EndGlobalSection diff --git a/Source/SvgDocument.cs b/Source/SvgDocument.cs index fc4c46db7..b563cdde0 100644 --- a/Source/SvgDocument.cs +++ b/Source/SvgDocument.cs @@ -230,9 +230,10 @@ public static SvgDocument Open(string path) using (var strReader = new System.IO.StringReader(svg)) { - var reader = new SvgTextReader(strReader, null); - reader.XmlResolver = new SvgDtdResolver(); - reader.WhitespaceHandling = WhitespaceHandling.None; + var reader = new SvgTextReader(strReader, null) + { + XmlResolver = new SvgDtdResolver(), WhitespaceHandling = WhitespaceHandling.None + }; return Open(reader); } } @@ -251,9 +252,10 @@ public static SvgDocument Open(string path) } // Don't close the stream via a dispose: that is the client's job. - var reader = new SvgTextReader(stream, entities); - reader.XmlResolver = new SvgDtdResolver(); - reader.WhitespaceHandling = WhitespaceHandling.None; + var reader = new SvgTextReader(stream, entities) + { + XmlResolver = new SvgDtdResolver(), WhitespaceHandling = WhitespaceHandling.None + }; return Open(reader); } @@ -621,8 +623,10 @@ public override void Write(XmlTextWriter writer) public void Write(Stream stream, bool useBom = true) { - var xmlWriter = new XmlTextWriter(stream, useBom ? Encoding.UTF8 : new System.Text.UTF8Encoding(false)); - xmlWriter.Formatting = Formatting.Indented; + var xmlWriter = new XmlTextWriter(stream, useBom ? Encoding.UTF8 : new System.Text.UTF8Encoding(false)) + { + Formatting = Formatting.Indented + }; xmlWriter.WriteStartDocument(); xmlWriter.WriteDocType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null); diff --git a/Source/SvgElement.cs b/Source/SvgElement.cs index 1220ebfd2..414001037 100644 --- a/Source/SvgElement.cs +++ b/Source/SvgElement.cs @@ -652,7 +652,13 @@ private Dictionary WritePropertyAttributes(XmlTextWriter writer) } } +#if NETFULL var value = (string)attr.Property.Converter.ConvertTo(propertyValue, typeof(string)); +#else + // dotnetcore throws exception if input is null + string value = propertyValue==null?null:(string)attr.Property.Converter.ConvertTo(propertyValue, typeof(string)); +#endif + if (propertyValue != null) { var type = propertyValue.GetType(); diff --git a/Source/Web/SvgHandler.cs b/Source/Web/SvgHandler.cs index 832e511aa..e172baded 100644 --- a/Source/Web/SvgHandler.cs +++ b/Source/Web/SvgHandler.cs @@ -1,3 +1,4 @@ +#if NETFULL using System; using System.Collections; using System.Collections.Generic; @@ -230,4 +231,5 @@ public WaitHandle AsyncWaitHandle } } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Tests/Svg.UnitTests/ImageComparisonTest.cs b/Tests/Svg.UnitTests/ImageComparisonTest.cs index af6c36c71..2debf703d 100644 --- a/Tests/Svg.UnitTests/ImageComparisonTest.cs +++ b/Tests/Svg.UnitTests/ImageComparisonTest.cs @@ -1,9 +1,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; +using System.Linq; namespace Svg.UnitTests { @@ -13,6 +15,32 @@ namespace Svg.UnitTests public class ImageComparisonTest { public TestContext TestContext { get; set; } +#if NETCORE + private static string _basePath = null; + private static string GetSuiteTestsFolder + { + get + { + if (_basePath != null) return _basePath; + var basePath = Environment.CurrentDirectory; + while (!basePath.ToLower().EndsWith("svg")) + { + basePath = Path.GetDirectoryName(basePath); + } + + _basePath = Path.Combine(basePath, "Tests"); + return _basePath; + } + } + + private static IEnumerable GetData() + { + var basePath = GetSuiteTestsFolder; + var testSuite = Path.Combine(basePath, "W3CTestSuite"); + var rows = File.ReadAllLines(Path.Combine(basePath, "Svg.UnitTests", "PassingTests.csv")).Skip(1); + foreach (var row in rows) + yield return new[] { (object)testSuite, (object) row,}; + } /// /// Compares SVG images against reference PNG images from the W3C SVG 1.1 test suite. @@ -21,9 +49,26 @@ public class ImageComparisonTest /// Note that with the current test there are still a lot of false positives, /// so this is not a definitive test for image equality yet. /// + [TestMethod] + [DynamicData(nameof(GetData), DynamicDataSourceType.Method)] + // [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV",@"|DataDirectory|\..\..\PassingTests.csv","PassingTests#csv", DataAccessMethod.Sequential)] + //public void CompareSvgImageWithReference() + public void CompareSvgImageWithReference(string basePath, string baseName) + { + var svgPath = Path.Combine(basePath, "svg", baseName + ".svg"); + var pngPath = Path.Combine(basePath, "png", baseName + ".png"); + var pngImage = Image.FromFile(pngPath); + var svgImage = LoadSvgImage(baseName, svgPath); + Assert.AreNotEqual(null, pngImage, "Failed to load " + pngPath); + Assert.AreNotEqual(null, svgImage, "Failed to load " + svgPath); + var difference = svgImage.PercentageDifference(pngImage); + Assert.IsTrue(difference < 0.05, + baseName + ": Difference is " + (difference * 100.0).ToString() + "%"); + } +#else [TestMethod] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", - @"|DataDirectory|\..\..\PassingTests.csv", + @"|DataDirectory|\..\..\..\PassingTests.csv", "PassingTests#csv", DataAccessMethod.Sequential)] public void CompareSvgImageWithReference() { @@ -32,7 +77,7 @@ public void CompareSvgImageWithReference() { basePath = Path.GetDirectoryName(basePath); } - basePath = Path.Combine(basePath, "Tests", "W3CTestSuite"); + basePath = Path.Combine(Path.Combine(basePath, "Tests"), "W3CTestSuite"); var svgBasePath = Path.Combine(basePath, "svg"); var baseName = TestContext.DataRow[0] as string; bool testSaveLoad = !baseName.StartsWith("#"); @@ -40,8 +85,8 @@ public void CompareSvgImageWithReference() { baseName = baseName.Substring(1); } - var svgPath = Path.Combine(basePath, "svg", baseName + ".svg"); - var pngPath = Path.Combine(basePath, "png", baseName + ".png"); + var svgPath = Path.Combine(Path.Combine(basePath, "svg"), baseName + ".svg"); + var pngPath = Path.Combine(Path.Combine(basePath, "png"), baseName + ".png"); var pngImage = Image.FromFile(pngPath); var svgDoc = LoadSvgDocument(svgPath); Assert.IsNotNull(svgDoc); @@ -50,7 +95,7 @@ public void CompareSvgImageWithReference() Assert.AreNotEqual(null, pngImage, "Failed to load " + pngPath); Assert.AreNotEqual(null, svgImage, "Failed to load " + svgPath); var difference = svgImage.PercentageDifference(pngImage); - Assert.IsTrue(difference < 0.05, + Assert.IsTrue(difference < 0.05, baseName + ": Difference is " + (difference * 100.0).ToString() + "%"); if (!testSaveLoad) { @@ -76,6 +121,7 @@ public void CompareSvgImageWithReference() baseName + ": Difference is " + (difference * 100.0).ToString() + "%"); } } +#endif /// /// Enable this test to output the calculate percentage difference @@ -85,15 +131,18 @@ public void CompareSvgImageWithReference() // [TestClass] public void RecordDiffForAllSvgImagesWithReference() { - var basePath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName( - TestContext.TestRunDirectory))); - basePath = Path.Combine(basePath, "Tests", "W3CTestSuite"); - var svgBasePath = Path.Combine(basePath, "svg"); +#if NETCORE + var basePath = Path.Combine(GetSuiteTestsFolder, "W3CTestSuite"); +#else + var basePath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(TestContext.TestRunDirectory))); + basePath = Path.Combine(Path.Combine(basePath, "Tests"), "W3CTestSuite"); +#endif + // var svgBasePath = Path.Combine(basePath, "svg"); string[] lines = File.ReadAllLines(@"..\..\..\..\Tests\Svg.UnitTests\all.csv"); foreach (var baseName in lines) { - var svgPath = Path.Combine(basePath, "svg", baseName + ".svg"); - var pngPath = Path.Combine(basePath, "png", baseName + ".png"); + var svgPath = Path.Combine(Path.Combine(basePath, "svg"), baseName + ".svg"); + var pngPath = Path.Combine(Path.Combine(basePath, "png"), baseName + ".png"); if (File.Exists(pngPath) && File.Exists(svgPath)) { var pngImage = Image.FromFile(pngPath); diff --git a/Tests/Svg.UnitTests/MultiThreadingTest.cs b/Tests/Svg.UnitTests/MultiThreadingTest.cs index e76afbb53..b700774d2 100644 --- a/Tests/Svg.UnitTests/MultiThreadingTest.cs +++ b/Tests/Svg.UnitTests/MultiThreadingTest.cs @@ -1,3 +1,5 @@ +#if NET35 +#else using Microsoft.VisualStudio.TestTools.UnitTesting; using Svg.Exceptions; using System; @@ -37,3 +39,4 @@ public void LoadSVGThreading_MultiThread_YieldsNoErrorWhileInBounds() } } } +#endif \ No newline at end of file diff --git a/Tests/Svg.UnitTests/Properties/AssemblyInfo.cs b/Tests/Svg.UnitTests/Properties/AssemblyInfo.cs index d55fff5b2..ebf32f9dd 100644 --- a/Tests/Svg.UnitTests/Properties/AssemblyInfo.cs +++ b/Tests/Svg.UnitTests/Properties/AssemblyInfo.cs @@ -1,35 +1,4 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Svg.UnitTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Svg.UnitTests")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6ab1d266-f201-46c0-9d14-523768eb18db")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/Svg.UnitTests/Svg.UnitTests.csproj b/Tests/Svg.UnitTests/Svg.UnitTests.csproj index aa5a1d0be..a78599753 100644 --- a/Tests/Svg.UnitTests/Svg.UnitTests.csproj +++ b/Tests/Svg.UnitTests/Svg.UnitTests.csproj @@ -1,85 +1,50 @@ - - + - Debug - AnyCPU - - - 2.0 - {E702EB7D-D01D-438A-BADD-E72D4E49109F} - Library - Properties - Svg.UnitTests - Svg.UnitTests - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + true + netcoreapp2.2;net40;net452;net472 + false + true + svgkey.snk + false + Debug;Release + 1591 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + + + TRACE;DEBUG;NETFULL;NET35 - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + TRACE;RELEASE;NETFULL;NET35 - - true + + TRACE;DEBUG;NETFULL;NET40 - - svgkey.snk + + TRACE;RELEASE;NETFULL;NET40 - - - - - 3.5 - - - - - - - - - False - - - - - - - - - - - - - - - - - - - - - - - {886A98C5-37C0-4E8B-885E-30C1D2F98B47} - Svg - - + + TRACE;DEBUG;NETFULL;NET452 + + + TRACE;RELEASE;NETFULL;NET452 + + + TRACE;DEBUG;NETFULL;NET472 + + + TRACE;RELEASE;NETFULL;NET472 + + + TRACE;RELEASE;NETCORE + + + TRACE;DEBUG;NETCORE + + + + @@ -108,16 +73,51 @@ - - - + + + + + + + + + + + + + + - - - \ No newline at end of file + + + + + + + + diff --git a/appveyor.yml b/appveyor.yml index 786dad47d..fee8a57ac 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,10 @@ +version: '{build}' + +image: Visual Studio 2017 configuration: - - Release - +- Release +before_build: +- ps: nuget restore Source\Svg.csproj +- ps: nuget restore Tests\Svg.UnitTests\Svg.UnitTests.csproj build: - project: Tests\Svg.UnitTests\Svg.UnitTests.csproj + project: Source\Svg.sln