diff --git a/Source/Painting/SvgColourServer.cs b/Source/Painting/SvgColourServer.cs index eabb462..d38f734 100644 --- a/Source/Painting/SvgColourServer.cs +++ b/Source/Painting/SvgColourServer.cs @@ -73,6 +73,9 @@ namespace Svg public override SvgElement DeepCopy() { + if (this == None || this == Inherit || this == NotSet) + return this; + var newObj = base.DeepCopy() as SvgColourServer; newObj.Colour = this.Colour; return newObj; diff --git a/Tests/Svg.UnitTests/SvgElementDeepCopyTest.cs b/Tests/Svg.UnitTests/SvgElementDeepCopyTest.cs index 9a9f350..6ab3540 100644 --- a/Tests/Svg.UnitTests/SvgElementDeepCopyTest.cs +++ b/Tests/Svg.UnitTests/SvgElementDeepCopyTest.cs @@ -71,6 +71,14 @@ namespace Svg.UnitTests Assert.IsInstanceOf(dest); } + [Test] + public void TestDoNotDeepCopy() + { + Assert.AreSame(SvgPaintServer.None, SvgPaintServer.None.DeepCopy()); + Assert.AreSame(SvgColourServer.Inherit, SvgColourServer.Inherit.DeepCopy()); + Assert.AreSame(SvgColourServer.NotSet, SvgColourServer.NotSet.DeepCopy()); + } + /// /// Tests that the deep copy of a is done correctly where the /// text element has contains only text and now other elements like .