aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs43
1 files changed, 25 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index bf13607..aa2f53f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
45 /// <summary> 45 /// <summary>
46 /// Linking tests 46 /// Linking tests
47 /// </summary> 47 /// </summary>
48 [TestFixture] 48 [TestFixture]
49 public class SceneObjectLinkingTests 49 public class SceneObjectLinkingTests
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -94,10 +94,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
94 } 94 }
95 95
96 // root part should have no offset position or rotation 96 // root part should have no offset position or rotation
97 Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity); 97 Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity,
98 "root part should have no offset position or rotation");
98 99
99 // offset position should be root part position - part2.absolute position. 100 // offset position should be root part position - part2.absolute position.
100 Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10)); 101 Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10),
102 "offset position should be root part position - part2.absolute position.");
101 103
102 float roll = 0; 104 float roll = 0;
103 float pitch = 0; 105 float pitch = 0;
@@ -116,7 +118,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
116 if (debugtest) 118 if (debugtest)
117 m_log.Debug(rotEuler2); 119 m_log.Debug(rotEuler2);
118 120
119 Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f)); 121 Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f),
122 "Not exactly sure what this is asserting...");
120 123
121 // Delink part 2 124 // Delink part 2
122 grp1.DelinkFromGroup(part2.LocalId); 125 grp1.DelinkFromGroup(part2.LocalId);
@@ -125,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
125 m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset); 128 m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
126 129
127 Assert.That(grp1.Children.Count, Is.EqualTo(1), "Group 1 still contained part2 after delink."); 130 Assert.That(grp1.Children.Count, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
128 Assert.That(part2.AbsolutePosition == Vector3.Zero); 131 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
129 } 132 }
130 133
131 [Test] 134 [Test]
@@ -174,13 +177,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
174 // Link grp4 to grp3. 177 // Link grp4 to grp3.
175 grp3.LinkToGroup(grp4); 178 grp3.LinkToGroup(grp4);
176 179
177 // At this point we should have 4 parts total in two groups. 180 // At this point we should have 4 parts total in two groups.
178 Assert.That(grp1.Children.Count == 2); 181 Assert.That(grp1.Children.Count == 2, "Group1 children count should be 2");
179 Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link."); 182 Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link.");
180 Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink."); 183 Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink.");
181 Assert.That(grp3.Children.Count == 2); 184 Assert.That(grp3.Children.Count == 2, "Group3 children count should be 2");
182 Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link."); 185 Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link.");
183 Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink."); 186 Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink.");
184 187
185 if (debugtest) 188 if (debugtest)
186 { 189 {
@@ -194,17 +197,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
194 m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation); 197 m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation);
195 m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset); 198 m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset);
196 m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset); 199 m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset);
197 } 200 }
198 201
199 // Required for linking 202 // Required for linking
200 grp1.RootPart.UpdateFlag = 0; 203 grp1.RootPart.UpdateFlag = 0;
201 grp3.RootPart.UpdateFlag = 0; 204 grp3.RootPart.UpdateFlag = 0;
202 205
203 // root part should have no offset position or rotation 206 // root part should have no offset position or rotation
204 Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity); 207 Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity,
208 "root part should have no offset position or rotation (again)");
205 209
206 // offset position should be root part position - part2.absolute position. 210 // offset position should be root part position - part2.absolute position.
207 Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10)); 211 Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10),
212 "offset position should be root part position - part2.absolute position (again)");
208 213
209 float roll = 0; 214 float roll = 0;
210 float pitch = 0; 215 float pitch = 0;
@@ -223,7 +228,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
223 if (debugtest) 228 if (debugtest)
224 m_log.Debug(rotEuler2); 229 m_log.Debug(rotEuler2);
225 230
226 Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f)); 231 Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f),
232 "Not sure what this assertion is all about...");
227 233
228 // Now we're linking the first group to the third group. This will make the first group child parts of the third one. 234 // Now we're linking the first group to the third group. This will make the first group child parts of the third one.
229 grp3.LinkToGroup(grp1); 235 grp3.LinkToGroup(grp1);
@@ -246,13 +252,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
246 m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset); 252 m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset);
247 } 253 }
248 254
249 Assert.That(part2.AbsolutePosition == Vector3.Zero); 255 Assert.That(part2.AbsolutePosition == Vector3.Zero, "Badness 1");
250 Assert.That(part4.OffsetPosition == new Vector3(20, 20, 20)); 256 Assert.That(part4.OffsetPosition == new Vector3(20, 20, 20), "Badness 2");
251 Quaternion compareQuaternion = new Quaternion(0, 0.7071068f, 0, 0.7071068f); 257 Quaternion compareQuaternion = new Quaternion(0, 0.7071068f, 0, 0.7071068f);
252 Assert.That((part4.RotationOffset.X - compareQuaternion.X < 0.00003) 258 Assert.That((part4.RotationOffset.X - compareQuaternion.X < 0.00003)
253 && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) 259 && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003)
254 && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) 260 && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003)
255 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003)); 261 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003),
256 } 262 "Badness 3");
263 }
257 } 264 }
258} 265}