diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index ddd4525..e82351e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -199,6 +199,59 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
199 | } | 199 | } |
200 | 200 | ||
201 | [Test] | 201 | [Test] |
202 | public void TestCreateWithMultiAttachments() | ||
203 | { | ||
204 | TestHelpers.InMethod(); | ||
205 | // TestHelpers.EnableLogging(); | ||
206 | |||
207 | SetUpScene(); | ||
208 | // m_attMod.DebugLevel = 1; | ||
209 | |||
210 | UUID userId = TestHelpers.ParseTail(0x1); | ||
211 | UserAccountHelpers.CreateUserWithInventory(m_scene, userId); | ||
212 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); | ||
213 | |||
214 | InventoryItemBase att1Item | ||
215 | = UserInventoryHelpers.CreateInventoryItem( | ||
216 | m_scene, "att1", TestHelpers.ParseTail(0x2), TestHelpers.ParseTail(0x3), sp.UUID, InventoryType.Object); | ||
217 | InventoryItemBase att2Item | ||
218 | = UserInventoryHelpers.CreateInventoryItem( | ||
219 | m_scene, "att2", TestHelpers.ParseTail(0x12), TestHelpers.ParseTail(0x13), sp.UUID, InventoryType.Object); | ||
220 | |||
221 | m_attMod.RezSingleAttachmentFromInventory(sp, att1Item.ID, (uint)AttachmentPoint.Chest); | ||
222 | m_attMod.RezSingleAttachmentFromInventory(sp, att2Item.ID, (uint)AttachmentPoint.Chest | 0x80); | ||
223 | |||
224 | UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); | ||
225 | |||
226 | ScenePresence npc = m_scene.GetScenePresence(npcId); | ||
227 | |||
228 | // Check scene presence status | ||
229 | Assert.That(npc.HasAttachments(), Is.True); | ||
230 | List<SceneObjectGroup> attachments = npc.GetAttachments(); | ||
231 | Assert.That(attachments.Count, Is.EqualTo(2)); | ||
232 | |||
233 | // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item | ||
234 | // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC. | ||
235 | // Assert.That(attSo.Name, Is.EqualTo(attName)); | ||
236 | |||
237 | TestAttachedObject(attachments[0], AttachmentPoint.Chest, npc.UUID); | ||
238 | TestAttachedObject(attachments[1], AttachmentPoint.Chest, npc.UUID); | ||
239 | |||
240 | // Attached objects on the same point must have different FromItemIDs to be shown to other avatars, at least | ||
241 | // on Singularity 1.8.5. Otherwise, only one (the first ObjectUpdate sent) appears. | ||
242 | Assert.AreNotEqual(attachments[0].FromItemID, attachments[1].FromItemID); | ||
243 | } | ||
244 | |||
245 | private void TestAttachedObject(SceneObjectGroup attSo, AttachmentPoint attPoint, UUID ownerId) | ||
246 | { | ||
247 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)attPoint)); | ||
248 | Assert.That(attSo.IsAttachment); | ||
249 | Assert.That(attSo.UsesPhysics, Is.False); | ||
250 | Assert.That(attSo.IsTemporary, Is.False); | ||
251 | Assert.That(attSo.OwnerID, Is.EqualTo(ownerId)); | ||
252 | } | ||
253 | |||
254 | [Test] | ||
202 | public void TestLoadAppearance() | 255 | public void TestLoadAppearance() |
203 | { | 256 | { |
204 | TestHelpers.InMethod(); | 257 | TestHelpers.InMethod(); |