mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-26 12:28:31 +00:00
+ 2 more mimic tests
+ Fix for an issue with Children() where duplicate children were being added on structures with 3+ OSCADObjects
This commit is contained in:
parent
becb6af003
commit
3d31d10912
@ -53,5 +53,31 @@ namespace OSCADSharp.UnitTests
|
|||||||
Assert.IsTrue(cube.ToString().StartsWith("translate("));
|
Assert.IsTrue(cube.ToString().StartsWith("translate("));
|
||||||
Assert.IsTrue(sphere.ToString().StartsWith("translate("));
|
Assert.IsTrue(sphere.ToString().StartsWith("translate("));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void OSCADObject_MimicTakesMultipleTransformsFromObject()
|
||||||
|
{
|
||||||
|
var cube = new Cube(null, true)
|
||||||
|
.Translate(10, 0, 5).Rotate(0, 30, 0).Scale(1, 1.5, 1);
|
||||||
|
var sphere = new Sphere().Mimic(cube);
|
||||||
|
|
||||||
|
|
||||||
|
Assert.IsTrue(sphere.GetType() == cube.GetType());
|
||||||
|
var mimicedChildren = sphere.Children();
|
||||||
|
|
||||||
|
Assert.IsTrue(mimicedChildren.ElementAt(0).ToString().StartsWith("rotate("));
|
||||||
|
Assert.IsTrue(mimicedChildren.ElementAt(1).ToString().StartsWith("translate("));
|
||||||
|
Assert.IsTrue(mimicedChildren.ElementAt(2).ToString().StartsWith("sphere("));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void OSCADObject_MimicDoesNothingOnObjectWithNoTransforms()
|
||||||
|
{
|
||||||
|
var cube = new Cube(null, true);
|
||||||
|
var sphere = new Sphere().Mimic(cube);
|
||||||
|
|
||||||
|
Assert.IsFalse(sphere.GetType() == cube.GetType());
|
||||||
|
Assert.AreEqual(0, sphere.Children().Count());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -221,7 +221,7 @@ namespace OSCADSharp
|
|||||||
child = toTraverse.Pop();
|
child = toTraverse.Pop();
|
||||||
allChildren.Add(child);
|
allChildren.Add(child);
|
||||||
|
|
||||||
foreach (var subChild in child.Children())
|
foreach (var subChild in child.children)
|
||||||
{
|
{
|
||||||
toTraverse.Push(subChild);
|
toTraverse.Push(subChild);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user