diff options
author | Justin Clark-Casey (justincc) | 2012-10-25 00:59:27 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-25 00:59:27 +0100 |
commit | 5d4ac5a90fea758e18c8a9e97b06e799186b5a14 (patch) | |
tree | 99be7b2b3b476cc033495792e39eb12d4ef0d8c2 | |
parent | Move npc creation tests involving appearance from OSSL_ApiAppearanceTest to O... (diff) | |
download | opensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.zip opensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.tar.gz opensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.tar.bz2 opensim-SC_OLD-5d4ac5a90fea758e18c8a9e97b06e799186b5a14.tar.xz |
Add TestOsNpcLoadAppearance()
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | 43 |
3 files changed, 48 insertions, 4 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 4f598b0..95e9667 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -330,6 +330,9 @@ namespace OpenSim.Framework | |||
330 | SetVisualParams(visualParams); | 330 | SetVisualParams(visualParams); |
331 | } | 331 | } |
332 | 332 | ||
333 | /// <summary> | ||
334 | /// Set avatar height by a calculation based on their visual parameters. | ||
335 | /// </summary> | ||
333 | public virtual void SetHeight() | 336 | public virtual void SetHeight() |
334 | { | 337 | { |
335 | // Start with shortest possible female avatar height | 338 | // Start with shortest possible female avatar height |
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; | |||
36 | using OpenMetaverse.Assets; | 36 | using OpenMetaverse.Assets; |
37 | using OpenMetaverse.StructuredData; | 37 | using OpenMetaverse.StructuredData; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Region.CoreModules.Avatar.Attachments; | ||
39 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; | 40 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; |
40 | using OpenSim.Region.OptionalModules.World.NPC; | ||
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.ScriptEngine.Shared; | 42 | using OpenSim.Region.ScriptEngine.Shared; |
43 | using OpenSim.Region.ScriptEngine.Shared.Api; | 43 | using OpenSim.Region.ScriptEngine.Shared.Api; |
44 | using OpenSim.Region.OptionalModules.World.NPC; | ||
44 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using 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; | |||
36 | using OpenMetaverse.Assets; | 36 | using OpenMetaverse.Assets; |
37 | using OpenMetaverse.StructuredData; | 37 | using OpenMetaverse.StructuredData; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Region.CoreModules.Avatar.Attachments; | ||
39 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; | 40 | using OpenSim.Region.CoreModules.Avatar.AvatarFactory; |
40 | using OpenSim.Region.OptionalModules.World.NPC; | 41 | using OpenSim.Region.OptionalModules.World.NPC; |
41 | using OpenSim.Region.Framework.Scenes; | 42 | using 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); |