From beab155434b1ea4338004496fd35df2a22170960 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 12 Jan 2012 22:35:11 +0000
Subject: Add api level test for removing an owned npc
---
.../ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | 57 +++++++++++++++++++++-
1 file changed, 55 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index c4832c9..f0b28b2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -77,10 +77,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
}
///
- /// Test creation of an NPC where the appearance data comes from an avatar already in the region.
+ /// Test removal of an owned NPC.
///
[Test]
- public void TestOsNpcRemove()
+ public void TestOsNpcRemoveOwned()
+ {
+ TestHelpers.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ // Store an avatar with a different height from default in a notecard.
+ UUID userId = TestHelpers.ParseTail(0x1);
+ UUID otherUserId = TestHelpers.ParseTail(0x2);
+ float newHeight = 1.9f;
+
+ SceneHelpers.AddScenePresence(m_scene, otherUserId);
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
+ sp.Appearance.AvatarHeight = newHeight;
+
+ SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
+ SceneObjectPart part = so.RootPart;
+ m_scene.AddSceneObject(so);
+
+ SceneObjectGroup otherSo = SceneHelpers.CreateSceneObject(1, otherUserId);
+ SceneObjectPart otherPart = otherSo.RootPart;
+ m_scene.AddSceneObject(otherSo);
+
+ OSSL_Api osslApi = new OSSL_Api();
+ osslApi.Initialize(m_engine, part, part.LocalId, part.UUID);
+
+ OSSL_Api otherOsslApi = new OSSL_Api();
+ otherOsslApi.Initialize(m_engine, otherPart, otherPart.LocalId, otherPart.UUID);
+
+ string notecardName = "appearanceNc";
+ osslApi.osOwnerSaveAppearance(notecardName);
+
+ string npcRaw
+ = osslApi.osNpcCreate(
+ "Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName, ScriptBaseClass.OS_NPC_CREATOR_OWNED);
+
+ otherOsslApi.osNpcRemove(npcRaw);
+
+ // Should still be around
+ UUID npcId = new UUID(npcRaw);
+ ScenePresence npc = m_scene.GetScenePresence(npcId);
+ Assert.That(npc, Is.Not.Null);
+
+ osslApi.osNpcRemove(npcRaw);
+
+ npc = m_scene.GetScenePresence(npcId);
+
+ }
+
+ ///
+ /// Test removal of an unowned NPC.
+ ///
+ [Test]
+ public void TestOsNpcRemoveUnowned()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
--
cgit v1.1