aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs126
1 files changed, 120 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 2a342d5..882031c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using NUnit.Framework; 31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
@@ -43,24 +44,137 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [TestFixture] 44 [TestFixture]
44 public class SceneObjectStatusTests 45 public class SceneObjectStatusTests
45 { 46 {
47 private TestScene m_scene;
48 private UUID m_ownerId = TestHelpers.ParseTail(0x1);
49 private SceneObjectGroup m_so1;
50 private SceneObjectGroup m_so2;
51
52 [SetUp]
53 public void Init()
54 {
55 m_scene = SceneHelpers.SetupScene();
56 m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10);
57 m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20);
58 }
59
46 [Test] 60 [Test]
47 public void TestSetPhantom() 61 public void TestSetPhantomSinglePrim()
48 { 62 {
49 TestHelpers.InMethod(); 63 TestHelpers.InMethod();
50 64
51// Scene scene = SceneSetupHelpers.SetupScene(); 65 SceneObjectPart rootPart = m_so1.RootPart;
52 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
53 SceneObjectPart rootPart = so.RootPart;
54 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 66 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
55 67
56 so.ScriptSetPhantomStatus(true); 68 m_so1.ScriptSetPhantomStatus(true);
57 69
58// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); 70// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
59 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); 71 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
60 72
61 so.ScriptSetPhantomStatus(false); 73 m_so1.ScriptSetPhantomStatus(false);
62 74
63 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 75 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
64 } 76 }
77
78 [Test]
79 public void TestSetPhysicsSinglePrim()
80 {
81 TestHelpers.InMethod();
82
83 SceneObjectPart rootPart = m_so1.RootPart;
84 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
85
86 m_so1.ScriptSetPhysicsStatus(true);
87
88// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
89 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
90
91 m_so1.ScriptSetPhysicsStatus(false);
92
93 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
94 }
95
96 [Test]
97 public void TestSetPhysicsLinkset()
98 {
99 TestHelpers.InMethod();
100
101 m_scene.AddSceneObject(m_so1);
102 m_scene.AddSceneObject(m_so2);
103
104 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
105
106 m_so1.ScriptSetPhysicsStatus(true);
107
108 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
109 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
110
111 m_so1.ScriptSetPhysicsStatus(false);
112
113 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
114 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
115
116 m_so1.ScriptSetPhysicsStatus(true);
117
118 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
119 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
120 }
121
122 /// <summary>
123 /// Test that linking results in the correct physical status for all linkees.
124 /// </summary>
125 [Test]
126 public void TestLinkPhysicsBothPhysical()
127 {
128 TestHelpers.InMethod();
129
130 m_scene.AddSceneObject(m_so1);
131 m_scene.AddSceneObject(m_so2);
132
133 m_so1.ScriptSetPhysicsStatus(true);
134 m_so2.ScriptSetPhysicsStatus(true);
135
136 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
137
138 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
139 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
140 }
141
142 /// <summary>
143 /// Test that linking results in the correct physical status for all linkees.
144 /// </summary>
145 [Test]
146 public void TestLinkPhysicsRootPhysicalOnly()
147 {
148 TestHelpers.InMethod();
149
150 m_scene.AddSceneObject(m_so1);
151 m_scene.AddSceneObject(m_so2);
152
153 m_so1.ScriptSetPhysicsStatus(true);
154
155 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
156
157 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
158 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
159 }
160
161 /// <summary>
162 /// Test that linking results in the correct physical status for all linkees.
163 /// </summary>
164 [Test]
165 public void TestLinkPhysicsChildPhysicalOnly()
166 {
167 TestHelpers.InMethod();
168
169 m_scene.AddSceneObject(m_so1);
170 m_scene.AddSceneObject(m_so2);
171
172 m_so2.ScriptSetPhysicsStatus(true);
173
174 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
175
176 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
177 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
178 }
65 } 179 }
66} \ No newline at end of file 180} \ No newline at end of file