diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs index 537b8aa..5ed1f3d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | |||
@@ -158,7 +158,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
158 | { | 158 | { |
159 | osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); | 159 | osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); |
160 | } | 160 | } |
161 | catch (Exception e) | 161 | catch (Exception) |
162 | { | 162 | { |
163 | exceptionCaught = true; | 163 | exceptionCaught = true; |
164 | } | 164 | } |
@@ -174,5 +174,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
174 | List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments(); | 174 | List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments(); |
175 | Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0)); | 175 | Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0)); |
176 | } | 176 | } |
177 | |||
178 | [Test] | ||
179 | public void TestOsForceAttachToOtherAvatarFromInventory() | ||
180 | { | ||
181 | TestHelpers.InMethod(); | ||
182 | // TestHelpers.EnableLogging(); | ||
183 | |||
184 | string taskInvObjItemName = "sphere"; | ||
185 | UUID taskInvObjItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); | ||
186 | AttachmentPoint attachPoint = AttachmentPoint.Chin; | ||
187 | |||
188 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "one", 0x1, "pass"); | ||
189 | UserAccount ua2 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "two", 0x2, "pass"); | ||
190 | |||
191 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); | ||
192 | SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); | ||
193 | TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); | ||
194 | |||
195 | new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); | ||
196 | OSSL_Api osslApi = new OSSL_Api(); | ||
197 | osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); | ||
198 | |||
199 | // Create an object embedded inside the first | ||
200 | TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); | ||
201 | |||
202 | ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); | ||
203 | |||
204 | osslApi.osForceAttachToOtherAvatarFromInventory(sp2.UUID.ToString(), taskInvObjItemName, (int)attachPoint); | ||
205 | |||
206 | // Check scene presence status | ||
207 | Assert.That(sp.HasAttachments(), Is.False); | ||
208 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | ||
209 | Assert.That(attachments.Count, Is.EqualTo(0)); | ||
210 | |||
211 | Assert.That(sp2.HasAttachments(), Is.True); | ||
212 | List<SceneObjectGroup> attachments2 = sp2.GetAttachments(); | ||
213 | Assert.That(attachments2.Count, Is.EqualTo(1)); | ||
214 | SceneObjectGroup attSo = attachments2[0]; | ||
215 | Assert.That(attSo.Name, Is.EqualTo(taskInvObjItemName)); | ||
216 | Assert.That(attSo.OwnerID, Is.EqualTo(ua2.PrincipalID)); | ||
217 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((uint)attachPoint)); | ||
218 | Assert.That(attSo.IsAttachment); | ||
219 | Assert.That(attSo.UsesPhysics, Is.False); | ||
220 | Assert.That(attSo.IsTemporary, Is.False); | ||
221 | |||
222 | // Check appearance status | ||
223 | List<AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments(); | ||
224 | Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0)); | ||
225 | |||
226 | List<AvatarAttachment> attachmentsInAppearance2 = sp2.Appearance.GetAttachments(); | ||
227 | Assert.That(attachmentsInAppearance2.Count, Is.EqualTo(1)); | ||
228 | Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint)); | ||
229 | } | ||
177 | } | 230 | } |
178 | } \ No newline at end of file | 231 | } \ No newline at end of file |