From 7ed419217fc63f7a01c13a7c3320e97edd6bb1b6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 20 May 2011 23:22:27 +0100
Subject: add test for rezzing an object from a prim item
---
OpenSim/Region/Framework/Scenes/Scene.cs | 3 +-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 ++
.../Framework/Scenes/Tests/TaskInventoryTests.cs | 45 +++++++++++++++++++++-
3 files changed, 49 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9df7340..0722cee 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1971,8 +1971,9 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Add a newly created object to the scene.
///
- ///
+ ///
/// This method does not send updates to the client - callers need to handle this themselves.
+ ///
///
///
/// Position of the object
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index fc31b65..14b587f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -344,6 +344,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Add an object to the scene. This will both update the scene, and send information about the
/// new object to all clients interested in the scene.
///
+ ///
+ /// The object's stored position, rotation and velocity are used.
+ ///
///
///
/// If true, the object is made persistent into the scene.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 2aef4b0..73f66cb 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -90,11 +90,54 @@ namespace OpenSim.Region.Framework.Tests
return ncItem;
}
-
+
+ [Test]
+ public void TestRezObjectFromInventoryItem()
+ {
+ TestHelper.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ Scene scene = SceneSetupHelpers.SetupScene();
+ UserAccount user1 = CreateUser(scene);
+ SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
+ SceneObjectPart sop1 = sog1.RootPart;
+
+ // Create an object embedded inside the first
+ UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
+
+ SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero);
+ AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
+ scene.AssetService.Store(taskSceneObjectAsset);
+ TaskInventoryItem taskSceneObjectItem
+ = new TaskInventoryItem
+ { Name = "tso", AssetID = taskSceneObjectAsset.FullID, ItemID = taskSceneObjectItemId,
+ Type = (int)AssetType.Object, InvType = (int)InventoryType.Object };
+ sop1.Inventory.AddInventoryItem(taskSceneObjectItem, true);
+
+ scene.AddSceneObject(sog1);
+
+ Vector3 rezPos = new Vector3(10, 10, 10);
+ Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
+ Vector3 rezVel = new Vector3(2, 2, 2);
+
+ scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);
+
+ SceneObjectPart rezzedObjectPart = scene.GetSceneObjectPart("tso");
+
+ Assert.That(rezzedObjectPart, Is.Not.Null);
+ Assert.That(rezzedObjectPart.AbsolutePosition, Is.EqualTo(rezPos));
+ Assert.That(rezzedObjectPart.RotationOffset, Is.EqualTo(rezRot));
+
+ // Velocity isn't being set, possibly because we have no physics
+ //Assert.That(rezzedObjectPart.Velocity, Is.EqualTo(rezVel));
+ }
+
///
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
///
+ ///
/// This should place it in the most suitable user folder.
+ ///
[Test]
public void TestMoveTaskInventoryItem()
{
--
cgit v1.1