Skip to content

Commit

Permalink
Fixed merge problems in image comparison test
Browse files Browse the repository at this point in the history
- removed / replaced EXCLUDE defines
- added back System.Web
- added back projects for SVG viewer and test runner
- added back AssemblyInfo, no not generate it in .NETCore
- removed FrameworkPathOverride - seems not to work correctly with current version
  • Loading branch information
mrbean-bremen committed May 8, 2019
1 parent feb3961 commit d45ddb0
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 46 deletions.
7 changes: 2 additions & 5 deletions Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
#if NETFULL
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down Expand Up @@ -33,9 +31,8 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.4.3.*")]
//[assembly: AssemblyFileVersion("1.0.1.*")]
#endif
[assembly: AssemblyVersion("2.5.0.0")]

[assembly: CLSCompliant(true)]

[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Svg.UnitTests,PublicKey=" +
Expand Down
18 changes: 5 additions & 13 deletions Source/Svg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PackageTags>svg, vector graphics, rendering</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>
Supports multiple targets v3.5 thru to dotnetcore2.2.
Expand Down Expand Up @@ -86,27 +87,16 @@ NetStandard does not fully support the Drawing2D package - so has been left out.
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web"/>
<Reference Include="System.Xml"/>
</ItemGroup>

<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net40'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0</FrameworkPathOverride>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net452'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2</FrameworkPathOverride>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net472'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2</FrameworkPathOverride>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net40'">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web"/>
<Reference Include="System.Xml"/>
</ItemGroup>

Expand All @@ -115,6 +105,7 @@ NetStandard does not fully support the Drawing2D package - so has been left out.
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web"/>
<Reference Include="System.Xml"/>
</ItemGroup>

Expand All @@ -123,6 +114,7 @@ NetStandard does not fully support the Drawing2D package - so has been left out.
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web"/>
<Reference Include="System.Xml"/>
</ItemGroup>

Expand Down
26 changes: 26 additions & 0 deletions Source/Svg.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ 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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVGViewer", "..\Samples\SVGViewer\SVGViewer.csproj", "{1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -44,6 +48,28 @@ 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 = Debug|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|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
{1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Debug|Any CPU.Build.0 = Debug|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|x86
{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|x86
{1B8F3C8A-CCAC-474E-B09D-522FBA93DCFD}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions Source/Web/SvgHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETFULL
#if NET35 || NET40 || NET452 || NET472
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -232,4 +232,4 @@ public WaitHandle AsyncWaitHandle
}
}
}
#endif
#endif
21 changes: 13 additions & 8 deletions Tests/Svg.UnitTests/ImageComparisonTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ private static IEnumerable<object[]> GetData()
//public void CompareSvgImageWithReference()
public void CompareSvgImageWithReference(string basePath, string baseName)
{
bool testSaveLoad = !baseName.StartsWith("#");
if (!testSaveLoad)
{
baseName = baseName.Substring(1);
}
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() + "%");
CompareSvgImageWithReferenceImpl(baseName, svgPath, pngPath, testSaveLoad);
}
#else
[TestMethod]
Expand All @@ -87,6 +86,13 @@ public void CompareSvgImageWithReference()
}
var svgPath = Path.Combine(Path.Combine(basePath, "svg"), baseName + ".svg");
var pngPath = Path.Combine(Path.Combine(basePath, "png"), baseName + ".png");
CompareSvgImageWithReferenceImpl(baseName, svgPath, pngPath, testSaveLoad);
}
#endif

private void CompareSvgImageWithReferenceImpl(string baseName,
string svgPath, string pngPath, bool testSaveLoad)
{
var pngImage = Image.FromFile(pngPath);
var svgDoc = LoadSvgDocument(svgPath);
Assert.IsNotNull(svgDoc);
Expand Down Expand Up @@ -121,7 +127,6 @@ public void CompareSvgImageWithReference()
baseName + ": Difference is " + (difference * 100.0).ToString() + "%");
}
}
#endif

/// <summary>
/// Enable this test to output the calculate percentage difference
Expand Down
32 changes: 31 additions & 1 deletion Tests/Svg.UnitTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
using System.Runtime.InteropServices;
using System.Reflection;
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("2.5.0.0")]
[assembly: AssemblyFileVersion("2.5.0.0")]
22 changes: 5 additions & 17 deletions Tests/Svg.UnitTests/Svg.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>svgkey.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
<NoWarn>1591</NoWarn>
</PropertyGroup>
Expand Down Expand Up @@ -44,7 +45,6 @@

<ItemGroup>
<EmbeddedResource Include="Resources\Issue204_PrivateFont\BrushScriptMT2.ttf" />
<None Include="packages.config" />
<None Include="AllTests.csv" />
<None Include="PassingTests.csv" />
<None Include="svgkey.snk" />
Expand Down Expand Up @@ -73,6 +73,10 @@
<ItemGroup>
<EmbeddedResource Include="Resources\Issue_Threading\TestFile.svg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Issue399_LexerIssue\LexerTestTemplate.svg" />
<EmbeddedResource Include="Resources\Issue399_LexerIssue\EmptyDTag.svg" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
Expand All @@ -99,22 +103,6 @@
</Reference>
</ItemGroup>

<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
</PropertyGroup>
<!--
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net40'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0</FrameworkPathOverride>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net452'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2</FrameworkPathOverride>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net472'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2</FrameworkPathOverride>
</PropertyGroup>
-->


<ItemGroup>
<ProjectReference Include="..\..\Source\SVG.csproj" />
</ItemGroup>
Expand Down

0 comments on commit d45ddb0

Please sign in to comment.