aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs70
1 files changed, 31 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index fa308b4..b7b8db4 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -45,11 +45,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
45 public class ScenePresenceSitTests 45 public class ScenePresenceSitTests
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48 private ScenePresence m_sp;
48 49
49 [SetUp] 50 [SetUp]
50 public void Init() 51 public void Init()
51 { 52 {
52 m_scene = SceneHelpers.SetupScene(); 53 m_scene = SceneHelpers.SetupScene();
54 m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
53 } 55 }
54 56
55 [Test] 57 [Test]
@@ -58,18 +60,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
58 TestHelpers.InMethod(); 60 TestHelpers.InMethod();
59// log4net.Config.XmlConfigurator.Configure(); 61// log4net.Config.XmlConfigurator.Configure();
60 62
61 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
62
63 // More than 10 meters away from 0, 0, 0 (default part position) 63 // More than 10 meters away from 0, 0, 0 (default part position)
64 Vector3 startPos = new Vector3(10.1f, 0, 0); 64 Vector3 startPos = new Vector3(10.1f, 0, 0);
65 sp.AbsolutePosition = startPos; 65 m_sp.AbsolutePosition = startPos;
66 66
67 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); 67 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
68 68
69 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); 69 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
70 70
71 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 71 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
72 Assert.That(sp.ParentID, Is.EqualTo(0)); 72 Assert.That(m_sp.ParentID, Is.EqualTo(0));
73 } 73 }
74 74
75 [Test] 75 [Test]
@@ -78,18 +78,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
78 TestHelpers.InMethod(); 78 TestHelpers.InMethod();
79// log4net.Config.XmlConfigurator.Configure(); 79// log4net.Config.XmlConfigurator.Configure();
80 80
81 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
82
83 // Less than 10 meters away from 0, 0, 0 (default part position) 81 // Less than 10 meters away from 0, 0, 0 (default part position)
84 Vector3 startPos = new Vector3(9.9f, 0, 0); 82 Vector3 startPos = new Vector3(9.9f, 0, 0);
85 sp.AbsolutePosition = startPos; 83 m_sp.AbsolutePosition = startPos;
86 84
87 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); 85 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
88 86
89 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); 87 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
90 88
91 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 89 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
92 Assert.That(sp.ParentID, Is.EqualTo(part.LocalId)); 90 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
93 } 91 }
94 92
95 [Test] 93 [Test]
@@ -98,33 +96,31 @@ namespace OpenSim.Region.Framework.Scenes.Tests
98 TestHelpers.InMethod(); 96 TestHelpers.InMethod();
99// log4net.Config.XmlConfigurator.Configure(); 97// log4net.Config.XmlConfigurator.Configure();
100 98
101 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
102
103 // Make sure we're within range to sit 99 // Make sure we're within range to sit
104 Vector3 startPos = new Vector3(1, 1, 1); 100 Vector3 startPos = new Vector3(1, 1, 1);
105 sp.AbsolutePosition = startPos; 101 m_sp.AbsolutePosition = startPos;
106 102
107 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); 103 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
108 104
109 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); 105 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
110 106
111 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 107 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
112 Assert.That(sp.ParentID, Is.EqualTo(part.LocalId)); 108 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
113 Assert.That(sp.PhysicsActor, Is.Null); 109 Assert.That(m_sp.PhysicsActor, Is.Null);
114 110
115 // FIXME: This is different for live avatars - z position is adjusted. This is half the height of the 111 // FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
116 // default avatar. 112 // default avatar.
117 // Curiously, Vector3.ToString() will not display the last two places of the float. For example, 113 // Curiously, Vector3.ToString() will not display the last two places of the float. For example,
118 // printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337> 114 // printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
119 Assert.That( 115 Assert.That(
120 sp.AbsolutePosition, 116 m_sp.AbsolutePosition,
121 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f))); 117 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
122 118
123 sp.StandUp(); 119 m_sp.StandUp();
124 120
125 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 121 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
126 Assert.That(sp.ParentID, Is.EqualTo(0)); 122 Assert.That(m_sp.ParentID, Is.EqualTo(0));
127 Assert.That(sp.PhysicsActor, Is.Not.Null); 123 Assert.That(m_sp.PhysicsActor, Is.Not.Null);
128 } 124 }
129 125
130 [Test] 126 [Test]
@@ -133,29 +129,27 @@ namespace OpenSim.Region.Framework.Scenes.Tests
133 TestHelpers.InMethod(); 129 TestHelpers.InMethod();
134// log4net.Config.XmlConfigurator.Configure(); 130// log4net.Config.XmlConfigurator.Configure();
135 131
136 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
137
138 // If a prim has a sit target then we can sit from any distance away 132 // If a prim has a sit target then we can sit from any distance away
139 Vector3 startPos = new Vector3(128, 128, 30); 133 Vector3 startPos = new Vector3(128, 128, 30);
140 sp.AbsolutePosition = startPos; 134 m_sp.AbsolutePosition = startPos;
141 135
142 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); 136 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
143 part.SitTargetPosition = new Vector3(0, 0, 1); 137 part.SitTargetPosition = new Vector3(0, 0, 1);
144 138
145 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); 139 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
146 140
147 Assert.That(part.SitTargetAvatar, Is.EqualTo(sp.UUID)); 141 Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID));
148 Assert.That(sp.ParentID, Is.EqualTo(part.LocalId)); 142 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
149 Assert.That( 143 Assert.That(
150 sp.AbsolutePosition, 144 m_sp.AbsolutePosition,
151 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); 145 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
152 Assert.That(sp.PhysicsActor, Is.Null); 146 Assert.That(m_sp.PhysicsActor, Is.Null);
153 147
154 sp.StandUp(); 148 m_sp.StandUp();
155 149
156 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 150 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
157 Assert.That(sp.ParentID, Is.EqualTo(0)); 151 Assert.That(m_sp.ParentID, Is.EqualTo(0));
158 Assert.That(sp.PhysicsActor, Is.Not.Null); 152 Assert.That(m_sp.PhysicsActor, Is.Not.Null);
159 } 153 }
160 154
161 [Test] 155 [Test]
@@ -164,21 +158,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
164 TestHelpers.InMethod(); 158 TestHelpers.InMethod();
165// log4net.Config.XmlConfigurator.Configure(); 159// log4net.Config.XmlConfigurator.Configure();
166 160
167 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
168
169 // If a prim has a sit target then we can sit from any distance away 161 // If a prim has a sit target then we can sit from any distance away
170// Vector3 startPos = new Vector3(128, 128, 30); 162// Vector3 startPos = new Vector3(128, 128, 30);
171// sp.AbsolutePosition = startPos; 163// sp.AbsolutePosition = startPos;
172 164
173 sp.HandleAgentSitOnGround(); 165 m_sp.HandleAgentSitOnGround();
174 166
175 Assert.That(sp.SitGround, Is.True); 167 Assert.That(m_sp.SitGround, Is.True);
176 Assert.That(sp.PhysicsActor, Is.Null); 168 Assert.That(m_sp.PhysicsActor, Is.Null);
177 169
178 sp.StandUp(); 170 m_sp.StandUp();
179 171
180 Assert.That(sp.SitGround, Is.False); 172 Assert.That(m_sp.SitGround, Is.False);
181 Assert.That(sp.PhysicsActor, Is.Not.Null); 173 Assert.That(m_sp.PhysicsActor, Is.Not.Null);
182 } 174 }
183 } 175 }
184} \ No newline at end of file 176} \ No newline at end of file