diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 5dcbd28..3e06900 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
118 | 118 | ||
119 | Scene scene = CreateDefaultTestScene(); | 119 | Scene scene = CreateDefaultTestScene(); |
120 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 120 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
121 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); | 121 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); |
122 | 122 | ||
123 | string attName = "att"; | 123 | string attName = "att"; |
124 | 124 | ||
@@ -154,6 +154,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
154 | // TestHelpers.DisableLogging(); | 154 | // TestHelpers.DisableLogging(); |
155 | } | 155 | } |
156 | 156 | ||
157 | /// <summary> | ||
158 | /// Test that we do not attempt to attach an in-world object that someone else is sitting on. | ||
159 | /// </summary> | ||
160 | [Test] | ||
161 | public void TestAddSatOnAttachmentFromGround() | ||
162 | { | ||
163 | TestHelpers.InMethod(); | ||
164 | // TestHelpers.EnableLogging(); | ||
165 | |||
166 | Scene scene = CreateDefaultTestScene(); | ||
167 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | ||
168 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); | ||
169 | |||
170 | string attName = "att"; | ||
171 | |||
172 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); | ||
173 | |||
174 | UserAccount ua2 = UserAccountHelpers.CreateUserWithInventory(scene, 0x2); | ||
175 | ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, ua2); | ||
176 | |||
177 | // Put avatar within 10m of the prim so that sit doesn't fail. | ||
178 | sp2.AbsolutePosition = new Vector3(0, 0, 0); | ||
179 | sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); | ||
180 | |||
181 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false); | ||
182 | |||
183 | Assert.That(sp.HasAttachments(), Is.False); | ||
184 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | ||
185 | } | ||
186 | |||
157 | [Test] | 187 | [Test] |
158 | public void TestAddAttachmentFromInventory() | 188 | public void TestAddAttachmentFromInventory() |
159 | { | 189 | { |