refactor: move common init code into SetUp() in SceneObjectSpatialTests

0.7.3-extended
Justin Clark-Casey (justincc) 2012-04-14 01:52:16 +01:00
parent f3eb366f24
commit 4c39a3fdbf
1 changed files with 13 additions and 8 deletions

View File

@ -44,19 +44,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests
[TestFixture] [TestFixture]
public class SceneObjectSpatialTests public class SceneObjectSpatialTests
{ {
TestScene m_scene;
UUID m_ownerId = TestHelpers.ParseTail(0x1);
[SetUp]
public void SetUp()
{
m_scene = SceneHelpers.SetupScene();
}
[Test] [Test]
public void TestSceneObjectGroupPosition() public void TestSceneObjectGroupPosition()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
Scene scene = SceneHelpers.SetupScene();
UUID ownerId = TestHelpers.ParseTail(0x1);
Vector3 position = new Vector3(10, 20, 30); Vector3 position = new Vector3(10, 20, 30);
SceneObjectGroup so SceneObjectGroup so
= SceneHelpers.CreateSceneObject(1, ownerId, "obj1", 0x10); = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10);
so.AbsolutePosition = position; so.AbsolutePosition = position;
scene.AddNewSceneObject(so, false); m_scene.AddNewSceneObject(so, false);
Assert.That(so.AbsolutePosition, Is.EqualTo(position)); Assert.That(so.AbsolutePosition, Is.EqualTo(position));
} }
@ -66,14 +73,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
Scene scene = SceneHelpers.SetupScene();
UUID ownerId = TestHelpers.ParseTail(0x1);
Vector3 partPosition = new Vector3(10, 20, 30); Vector3 partPosition = new Vector3(10, 20, 30);
SceneObjectGroup so SceneObjectGroup so
= SceneHelpers.CreateSceneObject(1, ownerId, "obj1", 0x10); = SceneHelpers.CreateSceneObject(1, m_ownerId, "obj1", 0x10);
so.AbsolutePosition = partPosition; so.AbsolutePosition = partPosition;
scene.AddNewSceneObject(so, false); m_scene.AddNewSceneObject(so, false);
Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition)); Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition));
Assert.That(so.RootPart.OffsetPosition, Is.EqualTo(Vector3.Zero)); Assert.That(so.RootPart.OffsetPosition, Is.EqualTo(Vector3.Zero));