aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-25 00:59:27 +0100
committerJustin Clark-Casey (justincc)2012-10-25 00:59:27 +0100
commit5d4ac5a90fea758e18c8a9e97b06e799186b5a14 (patch)
tree99be7b2b3b476cc033495792e39eb12d4ef0d8c2 /OpenSim/Region/ScriptEngine
parentMove npc creation tests involving appearance from OSSL_ApiAppearanceTest to O... (diff)
downloadopensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.zip
opensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.tar.gz
opensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.tar.bz2
opensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.tar.xz
Add TestOsNpcLoadAppearance()
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs43
2 files changed, 45 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
index c401794..eb51c4e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -36,11 +36,12 @@ using OpenMetaverse;
36using OpenMetaverse.Assets; 36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Avatar.Attachments;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory; 40using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared; 42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api; 43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.OptionalModules.World.NPC;
44using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock; 47using OpenSim.Tests.Common.Mock;
@@ -68,7 +69,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
68 config.Set("Enabled", "true"); 69 config.Set("Enabled", "true");
69 70
70 m_scene = new SceneHelpers().SetupScene(); 71 m_scene = new SceneHelpers().SetupScene();
71 SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); 72 SceneHelpers.SetupSceneModules(
73 m_scene, initConfigSource, new AvatarFactoryModule(), new AttachmentsModule(), new NPCModule());
72 74
73 m_engine = new XEngine.XEngine(); 75 m_engine = new XEngine.XEngine();
74 m_engine.Initialise(initConfigSource); 76 m_engine.Initialise(initConfigSource);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index b5a4d93..0a3a75d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -36,6 +36,7 @@ using OpenMetaverse;
36using OpenMetaverse.Assets; 36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Avatar.Attachments;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory; 40using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.OptionalModules.World.NPC; 41using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
@@ -71,7 +72,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
71 config.Set("Enabled", "true"); 72 config.Set("Enabled", "true");
72 73
73 m_scene = new SceneHelpers().SetupScene(); 74 m_scene = new SceneHelpers().SetupScene();
74 SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); 75 SceneHelpers.SetupSceneModules(
76 m_scene, initConfigSource, new AvatarFactoryModule(), new AttachmentsModule(), new NPCModule());
75 77
76 m_engine = new XEngine.XEngine(); 78 m_engine = new XEngine.XEngine();
77 m_engine.Initialise(initConfigSource); 79 m_engine.Initialise(initConfigSource);
@@ -147,6 +149,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
147 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); 149 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight));
148 } 150 }
149 151
152 [Test]
153 public void TestOsNpcLoadAppearance()
154 {
155 TestHelpers.InMethod();
156
157 // Store an avatar with a different height from default in a notecard.
158 UUID userId = TestHelpers.ParseTail(0x1);
159 float firstHeight = 1.9f;
160 float secondHeight = 2.1f;
161 string firstAppearanceNcName = "appearanceNc1";
162 string secondAppearanceNcName = "appearanceNc2";
163
164 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
165 sp.Appearance.AvatarHeight = firstHeight;
166 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
167 SceneObjectPart part = so.RootPart;
168 m_scene.AddSceneObject(so);
169
170 OSSL_Api osslApi = new OSSL_Api();
171 osslApi.Initialize(m_engine, part, null);
172
173 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
174
175 string npcRaw
176 = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), firstAppearanceNcName);
177
178 // Create a second appearance notecard with a different height
179 sp.Appearance.AvatarHeight = secondHeight;
180 osslApi.osOwnerSaveAppearance(secondAppearanceNcName);
181
182 osslApi.osNpcLoadAppearance(npcRaw, secondAppearanceNcName);
183
184 UUID npcId = new UUID(npcRaw);
185 ScenePresence npc = m_scene.GetScenePresence(npcId);
186 Assert.That(npc, Is.Not.Null);
187 Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(secondHeight));
188 }
189
150 /// <summary> 190 /// <summary>
151 /// Test removal of an owned NPC. 191 /// Test removal of an owned NPC.
152 /// </summary> 192 /// </summary>
@@ -154,7 +194,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
154 public void TestOsNpcRemoveOwned() 194 public void TestOsNpcRemoveOwned()
155 { 195 {
156 TestHelpers.InMethod(); 196 TestHelpers.InMethod();
157// log4net.Config.XmlConfigurator.Configure();
158 197
159 // Store an avatar with a different height from default in a notecard. 198 // Store an avatar with a different height from default in a notecard.
160 UUID userId = TestHelpers.ParseTail(0x1); 199 UUID userId = TestHelpers.ParseTail(0x1);