aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-04 00:25:51 +0100
committerJustin Clark-Casey (justincc)2011-08-04 00:25:51 +0100
commitba0c65e028ecd3c19a11e6e5557fb004f9dc6c01 (patch)
tree03ac65f28fcaaddb02c504f5473a81d52f162c7b /OpenSim/Region/OptionalModules
parenteliminate pre-existing unused SP.StopMovement() (diff)
downloadopensim-SC-ba0c65e028ecd3c19a11e6e5557fb004f9dc6c01.zip
opensim-SC-ba0c65e028ecd3c19a11e6e5557fb004f9dc6c01.tar.gz
opensim-SC-ba0c65e028ecd3c19a11e6e5557fb004f9dc6c01.tar.bz2
opensim-SC-ba0c65e028ecd3c19a11e6e5557fb004f9dc6c01.tar.xz
extend npc move test to check a second movement
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs23
1 files changed, 21 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 57847f7..545819f 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
112 scene.Update(); 112 scene.Update();
113 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 113 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
114 114
115 Vector3 targetPos = new Vector3(128, 128, 40); 115 Vector3 targetPos = startPos + new Vector3(0, 0, 10);
116 npcModule.MoveToTarget(npc.UUID, scene, targetPos); 116 npcModule.MoveToTarget(npc.UUID, scene, targetPos);
117 117
118 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 118 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
@@ -129,7 +129,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
129 scene.Update(); 129 scene.Update();
130 130
131 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); 131 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
132 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position"); 132 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
133
134 // Try a second movement
135 startPos = npc.AbsolutePosition;
136 targetPos = startPos + new Vector3(10, 0, 0);
137 npcModule.MoveToTarget(npc.UUID, scene, targetPos);
138
139 scene.Update();
140
141 // We should really check the exact figure.
142 Assert.That(npc.AbsolutePosition.X, Is.GreaterThan(startPos.X));
143 Assert.That(npc.AbsolutePosition.X, Is.LessThan(targetPos.X));
144 Assert.That(npc.AbsolutePosition.Y, Is.EqualTo(startPos.Y));
145 Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
146
147 for (int i = 0; i < 10; i++)
148 scene.Update();
149
150 distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
151 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on second move");
133 } 152 }
134 } 153 }
135} \ No newline at end of file 154} \ No newline at end of file