diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/Tests')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 246bc34..49c06bc 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -132,11 +132,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
132 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 132 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
133 | string attName = "att"; | 133 | string attName = "att"; |
134 | 134 | ||
135 | UserInventoryHelpers.CreateInventoryItem( | 135 | UserInventoryHelpers.CreateInventoryItem(scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); |
136 | scene, attName, attItemId, attAssetId, sp.UUID, InventoryType.Object); | ||
137 | 136 | ||
138 | am.RezSingleAttachmentFromInventory( | 137 | am.RezSingleAttachmentFromInventory(sp, attItemId, (uint)AttachmentPoint.Chest); |
139 | sp.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | ||
140 | 138 | ||
141 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); | 139 | INPCModule npcModule = scene.RequestModuleInterface<INPCModule>(); |
142 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance); | 140 | UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance); |
@@ -182,18 +180,21 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
182 | scene.Update(); | 180 | scene.Update(); |
183 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 181 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
184 | 182 | ||
185 | Vector3 targetPos = startPos + new Vector3(0, 0, 10); | 183 | Vector3 targetPos = startPos + new Vector3(0, 10, 0); |
186 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); | 184 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); |
187 | 185 | ||
188 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | 186 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); |
187 | //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f))); | ||
188 | Assert.That( | ||
189 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001)); | ||
189 | 190 | ||
190 | scene.Update(); | 191 | scene.Update(); |
191 | 192 | ||
192 | // We should really check the exact figure. | 193 | // We should really check the exact figure. |
193 | Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); | 194 | Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X)); |
194 | Assert.That(npc.AbsolutePosition.Y, Is.EqualTo(startPos.Y)); | 195 | Assert.That(npc.AbsolutePosition.Y, Is.GreaterThan(startPos.Y)); |
195 | Assert.That(npc.AbsolutePosition.Z, Is.GreaterThan(startPos.Z)); | 196 | Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); |
196 | Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.Z)); | 197 | Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X)); |
197 | 198 | ||
198 | for (int i = 0; i < 10; i++) | 199 | for (int i = 0; i < 10; i++) |
199 | scene.Update(); | 200 | scene.Update(); |
@@ -208,6 +209,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests | |||
208 | targetPos = startPos + new Vector3(10, 0, 0); | 209 | targetPos = startPos + new Vector3(10, 0, 0); |
209 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); | 210 | npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); |
210 | 211 | ||
212 | Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); | ||
213 | // Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0, 1))); | ||
214 | Assert.That( | ||
215 | npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001)); | ||
216 | |||
211 | scene.Update(); | 217 | scene.Update(); |
212 | 218 | ||
213 | // We should really check the exact figure. | 219 | // We should really check the exact figure. |