aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs54
1 files changed, 54 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index 0a3a75d..4e58315 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -114,6 +114,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
114 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); 114 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
115 } 115 }
116 116
117 [Test]
118 public void TestOsNpcCreateNotExistingNotecard()
119 {
120 TestHelpers.InMethod();
121
122 UUID userId = TestHelpers.ParseTail(0x1);
123
124 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
125 m_scene.AddSceneObject(so);
126
127 OSSL_Api osslApi = new OSSL_Api();
128 osslApi.Initialize(m_engine, so.RootPart, null);
129
130 string npcRaw
131 = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name");
132
133 UUID npcId = new UUID(npcRaw);
134 Assert.That(npcId, Is.EqualTo(UUID.Zero));
135 }
136
117 /// <summary> 137 /// <summary>
118 /// Test creation of an NPC where the appearance data comes from an avatar already in the region. 138 /// Test creation of an NPC where the appearance data comes from an avatar already in the region.
119 /// </summary> 139 /// </summary>
@@ -187,6 +207,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
187 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(secondHeight)); 207 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(secondHeight));
188 } 208 }
189 209
210 [Test]
211 public void TestOsNpcLoadAppearanceNotExistingNotecard()
212 {
213 TestHelpers.InMethod();
214
215 // Store an avatar with a different height from default in a notecard.
216 UUID userId = TestHelpers.ParseTail(0x1);
217 float firstHeight = 1.9f;
218 float secondHeight = 2.1f;
219 string firstAppearanceNcName = "appearanceNc1";
220 string secondAppearanceNcName = "appearanceNc2";
221
222 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
223 sp.Appearance.AvatarHeight = firstHeight;
224 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
225 SceneObjectPart part = so.RootPart;
226 m_scene.AddSceneObject(so);
227
228 OSSL_Api osslApi = new OSSL_Api();
229 osslApi.Initialize(m_engine, part, null);
230
231 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
232
233 string npcRaw
234 = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName);
235
236 osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName);
237
238 UUID npcId = new UUID(npcRaw);
239 ScenePresence npc = m_scene.GetScenePresence(npcId);
240 Assert.That(npc, Is.Not.Null);
241 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(firstHeight));
242 }
243
190 /// <summary> 244 /// <summary>
191 /// Test removal of an owned NPC. 245 /// Test removal of an owned NPC.
192 /// </summary> 246 /// </summary>