add test for rezzing an object from a prim item

bulletsim
Justin Clark-Casey (justincc) 2011-05-20 23:22:27 +01:00
parent 9fc29e1595
commit 7ed419217f
4 changed files with 66 additions and 5 deletions

View File

@ -1971,8 +1971,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Add a newly created object to the scene. /// Add a newly created object to the scene.
/// </summary> /// </summary>
/// /// <remarks>
/// This method does not send updates to the client - callers need to handle this themselves. /// This method does not send updates to the client - callers need to handle this themselves.
/// </remarks>
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param> /// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object</param> /// <param name="pos">Position of the object</param>

View File

@ -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 /// 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. /// new object to all clients interested in the scene.
/// </summary> /// </summary>
/// <remarks>
/// The object's stored position, rotation and velocity are used.
/// </remarks>
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <param name="attachToBackup"> /// <param name="attachToBackup">
/// If true, the object is made persistent into the scene. /// If true, the object is made persistent into the scene.

View File

@ -90,11 +90,54 @@ namespace OpenSim.Region.Framework.Tests
return ncItem; 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));
}
/// <summary> /// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned. /// Test MoveTaskInventoryItem where the item has no parent folder assigned.
/// </summary> /// </summary>
/// <remarks>
/// This should place it in the most suitable user folder. /// This should place it in the most suitable user folder.
/// </remarks>
[Test] [Test]
public void TestMoveTaskInventoryItem() public void TestMoveTaskInventoryItem()
{ {

View File

@ -56,10 +56,24 @@ namespace OpenSim.Tests.Common
AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
scene.AssetService.Store(asset); scene.AssetService.Store(asset);
return asset; return asset;
} }
/// <summary>
/// Create an asset from the given object.
/// </summary>
/// <param name="assetUuidTail">
/// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
/// will be used.
/// </param>
/// <param name="sog"></param>
/// <returns></returns>
public static AssetBase CreateAsset(int assetUuidTail, SceneObjectGroup sog)
{
return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), sog);
}
/// <summary> /// <summary>
/// Create an asset from the given scene object. /// Create an asset from the given object.
/// </summary> /// </summary>
/// <param name="assetUuid"></param> /// <param name="assetUuid"></param>
/// <param name="sog"></param> /// <param name="sog"></param>
@ -76,7 +90,7 @@ namespace OpenSim.Tests.Common
/// <summary> /// <summary>
/// Create an asset from the given scene object. /// Create an asset from the given scene object.
/// </summary> /// </summary>
/// <param name="assetUuidTailZ"> /// <param name="assetUuidTail">
/// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
/// will be used. /// will be used.
/// </param> /// </param>