aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs46
1 files changed, 45 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index d507822..36e2d4a 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
139 } 139 }
140 140
141 [Test] 141 [Test]
142 public void TestAttachments() 142 public void TestCreateWithAttachments()
143 { 143 {
144 TestHelpers.InMethod(); 144 TestHelpers.InMethod();
145// log4net.Config.XmlConfigurator.Configure(); 145// log4net.Config.XmlConfigurator.Configure();
@@ -179,6 +179,50 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
179 } 179 }
180 180
181 [Test] 181 [Test]
182 public void TestLoadAppearance()
183 {
184 TestHelpers.InMethod();
185// log4net.Config.XmlConfigurator.Configure();
186
187 UUID userId = TestHelpers.ParseTail(0x1);
188 UserAccountHelpers.CreateUserWithInventory(scene, userId);
189 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
190
191 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
192 UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance);
193
194 // Now add the attachment to the original avatar and use that to load a new appearance
195 // TODO: Could also run tests loading from a notecard though this isn't much different for our purposes here
196 UUID attItemId = TestHelpers.ParseTail(0x2);
197 UUID attAssetId = TestHelpers.ParseTail(0x3);
198 string attName = "att";
199
200 UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object);
201
202 am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest);
203
204 npcModule.SetNPCAppearance(npcId, sp.Appearance, scene);
205
206 ScenePresence npc = scene.GetScenePresence(npcId);
207
208 // Check scene presence status
209 Assert.That(npc.HasAttachments(), Is.True);
210 List<SceneObjectGroup> attachments = npc.GetAttachments();
211 Assert.That(attachments.Count, Is.EqualTo(1));
212 SceneObjectGroup attSo = attachments[0];
213
214 // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
215 // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
216// Assert.That(attSo.Name, Is.EqualTo(attName));
217
218 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
219 Assert.That(attSo.IsAttachment);
220 Assert.That(attSo.UsesPhysics, Is.False);
221 Assert.That(attSo.IsTemporary, Is.False);
222 Assert.That(attSo.OwnerID, Is.EqualTo(npc.UUID));
223 }
224
225 [Test]
182 public void TestMove() 226 public void TestMove()
183 { 227 {
184 TestHelpers.InMethod(); 228 TestHelpers.InMethod();