зеркало из https://github.com/wieslawsoltes/SVG.git
Do not copy None, Inherit and NotSet at DeepCopy (#565)
* Do not copy None, Inherit and NotSet at DeepCopy. * Add test.
This commit is contained in:
Родитель
b5a0ce7c2e
Коммит
dc35216f41
|
@ -73,6 +73,9 @@ namespace Svg
|
|||
|
||||
public override SvgElement DeepCopy<T>()
|
||||
{
|
||||
if (this == None || this == Inherit || this == NotSet)
|
||||
return this;
|
||||
|
||||
var newObj = base.DeepCopy<T>() as SvgColourServer;
|
||||
newObj.Colour = this.Colour;
|
||||
return newObj;
|
||||
|
|
|
@ -71,6 +71,14 @@ namespace Svg.UnitTests
|
|||
Assert.IsInstanceOf<T>(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());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests that the deep copy of a <see cref="SvgText"/> is done correctly where the
|
||||
/// text element has contains only text and now other elements like <see cref="SvgTextSpan"/>.
|
||||
|
|
Загрузка…
Ссылка в новой задаче