diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index b7b8db4..493ab70 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using Nini.Config; | 31 | using Nini.Config; |
31 | using NUnit.Framework; | 32 | using NUnit.Framework; |
@@ -50,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
50 | [SetUp] | 51 | [SetUp] |
51 | public void Init() | 52 | public void Init() |
52 | { | 53 | { |
53 | m_scene = SceneHelpers.SetupScene(); | 54 | m_scene = new SceneHelpers().SetupScene(); |
54 | m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); | 55 | m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); |
55 | } | 56 | } |
56 | 57 | ||
@@ -64,11 +65,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
64 | Vector3 startPos = new Vector3(10.1f, 0, 0); | 65 | Vector3 startPos = new Vector3(10.1f, 0, 0); |
65 | m_sp.AbsolutePosition = startPos; | 66 | m_sp.AbsolutePosition = startPos; |
66 | 67 | ||
67 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 68 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
68 | 69 | ||
69 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 70 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
70 | 71 | ||
71 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 72 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
73 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); | ||
74 | Assert.That(part.GetSittingAvatars(), Is.Null); | ||
72 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); | 75 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); |
73 | } | 76 | } |
74 | 77 | ||
@@ -82,11 +85,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
82 | Vector3 startPos = new Vector3(9.9f, 0, 0); | 85 | Vector3 startPos = new Vector3(9.9f, 0, 0); |
83 | m_sp.AbsolutePosition = startPos; | 86 | m_sp.AbsolutePosition = startPos; |
84 | 87 | ||
85 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 88 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
86 | 89 | ||
87 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 90 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
88 | 91 | ||
92 | Assert.That(m_sp.PhysicsActor, Is.Null); | ||
93 | |||
89 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 94 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
95 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); | ||
96 | HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); | ||
97 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); | ||
98 | Assert.That(sittingAvatars.Contains(m_sp.UUID)); | ||
90 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); | 99 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); |
91 | } | 100 | } |
92 | 101 | ||
@@ -100,14 +109,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
100 | Vector3 startPos = new Vector3(1, 1, 1); | 109 | Vector3 startPos = new Vector3(1, 1, 1); |
101 | m_sp.AbsolutePosition = startPos; | 110 | m_sp.AbsolutePosition = startPos; |
102 | 111 | ||
103 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 112 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
104 | 113 | ||
105 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 114 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
106 | 115 | ||
107 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | ||
108 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); | ||
109 | Assert.That(m_sp.PhysicsActor, Is.Null); | ||
110 | |||
111 | // FIXME: This is different for live avatars - z position is adjusted. This is half the height of the | 116 | // FIXME: This is different for live avatars - z position is adjusted. This is half the height of the |
112 | // default avatar. | 117 | // default avatar. |
113 | // Curiously, Vector3.ToString() will not display the last two places of the float. For example, | 118 | // Curiously, Vector3.ToString() will not display the last two places of the float. For example, |
@@ -119,6 +124,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
119 | m_sp.StandUp(); | 124 | m_sp.StandUp(); |
120 | 125 | ||
121 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 126 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
127 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); | ||
128 | Assert.That(part.GetSittingAvatars(), Is.Null); | ||
122 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); | 129 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); |
123 | Assert.That(m_sp.PhysicsActor, Is.Not.Null); | 130 | Assert.That(m_sp.PhysicsActor, Is.Not.Null); |
124 | } | 131 | } |
@@ -133,7 +140,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
133 | Vector3 startPos = new Vector3(128, 128, 30); | 140 | Vector3 startPos = new Vector3(128, 128, 30); |
134 | m_sp.AbsolutePosition = startPos; | 141 | m_sp.AbsolutePosition = startPos; |
135 | 142 | ||
136 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); | 143 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
137 | part.SitTargetPosition = new Vector3(0, 0, 1); | 144 | part.SitTargetPosition = new Vector3(0, 0, 1); |
138 | 145 | ||
139 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); | 146 | m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); |
@@ -145,11 +152,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
145 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); | 152 | Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); |
146 | Assert.That(m_sp.PhysicsActor, Is.Null); | 153 | Assert.That(m_sp.PhysicsActor, Is.Null); |
147 | 154 | ||
155 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); | ||
156 | HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); | ||
157 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); | ||
158 | Assert.That(sittingAvatars.Contains(m_sp.UUID)); | ||
159 | |||
148 | m_sp.StandUp(); | 160 | m_sp.StandUp(); |
149 | 161 | ||
150 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 162 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
151 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); | 163 | Assert.That(m_sp.ParentID, Is.EqualTo(0)); |
152 | Assert.That(m_sp.PhysicsActor, Is.Not.Null); | 164 | Assert.That(m_sp.PhysicsActor, Is.Not.Null); |
165 | |||
166 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | ||
167 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); | ||
168 | Assert.That(part.GetSittingAvatars(), Is.Null); | ||
153 | } | 169 | } |
154 | 170 | ||
155 | [Test] | 171 | [Test] |