diff options
author | Justin Clark-Casey (justincc) | 2012-03-06 01:27:30 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-06 01:32:44 +0000 |
commit | 824318a0c1c879111b2af67947f0f03aa577f99c (patch) | |
tree | b57e59c60aaf85903f8f7c668d43c58c5d579b4b /OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |
parent | Merge branch '0.7.3-post-fixes' of ssh://opensimulator.org/var/git/opensim in... (diff) | |
download | opensim-SC_OLD-824318a0c1c879111b2af67947f0f03aa577f99c.zip opensim-SC_OLD-824318a0c1c879111b2af67947f0f03aa577f99c.tar.gz opensim-SC_OLD-824318a0c1c879111b2af67947f0f03aa577f99c.tar.bz2 opensim-SC_OLD-824318a0c1c879111b2af67947f0f03aa577f99c.tar.xz |
Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914
The part reverted is from commit 2ebb421.
Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments.
I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :)
Regression test added for this case.
Mantis ref: http://opensimulator.org/mantis/view.php?id=5914
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 46 |
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(); |