diff options
author | Justin Clark-Casey (justincc) | 2012-06-26 22:21:54 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-26 22:21:54 +0100 |
commit | 4329cc7b8a698acc6154f3e195c6261c61014916 (patch) | |
tree | 85263b83df4105e988e6786be56c73f1f740d4ca | |
parent | Add regression test to check that attachments in source region are deleting w... (diff) | |
download | opensim-SC-4329cc7b8a698acc6154f3e195c6261c61014916.zip opensim-SC-4329cc7b8a698acc6154f3e195c6261c61014916.tar.gz opensim-SC-4329cc7b8a698acc6154f3e195c6261c61014916.tar.bz2 opensim-SC-4329cc7b8a698acc6154f3e195c6261c61014916.tar.xz |
refactor: make m_presence a local variable in all AttachmentsModuleTests since it doesn't need to be global and some tests set up more than one sp
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 695994f..4c750bc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -57,7 +57,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
57 | public class AttachmentsModuleTests | 57 | public class AttachmentsModuleTests |
58 | { | 58 | { |
59 | private AttachmentsModule m_attMod; | 59 | private AttachmentsModule m_attMod; |
60 | private ScenePresence m_presence; | ||
61 | 60 | ||
62 | /// <summary> | 61 | /// <summary> |
63 | /// Standard user ID | 62 | /// Standard user ID |
@@ -136,17 +135,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
136 | 135 | ||
137 | Scene scene = CreateDefaultTestScene(); | 136 | Scene scene = CreateDefaultTestScene(); |
138 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 137 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
139 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | 138 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); |
140 | 139 | ||
141 | string attName = "att"; | 140 | string attName = "att"; |
142 | 141 | ||
143 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; | 142 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID).ParentGroup; |
144 | 143 | ||
145 | m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); | 144 | m_attMod.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false); |
146 | 145 | ||
147 | // Check status on scene presence | 146 | // Check status on scene presence |
148 | Assert.That(m_presence.HasAttachments(), Is.True); | 147 | Assert.That(sp.HasAttachments(), Is.True); |
149 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); | 148 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
150 | Assert.That(attachments.Count, Is.EqualTo(1)); | 149 | Assert.That(attachments.Count, Is.EqualTo(1)); |
151 | SceneObjectGroup attSo = attachments[0]; | 150 | SceneObjectGroup attSo = attachments[0]; |
152 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 151 | Assert.That(attSo.Name, Is.EqualTo(attName)); |
@@ -157,14 +156,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
157 | 156 | ||
158 | // Check item status | 157 | // Check item status |
159 | Assert.That( | 158 | Assert.That( |
160 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), | 159 | sp.Appearance.GetAttachpoint(attSo.FromItemID), |
161 | Is.EqualTo((int)AttachmentPoint.Chest)); | 160 | Is.EqualTo((int)AttachmentPoint.Chest)); |
162 | 161 | ||
163 | InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); | 162 | InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); |
164 | Assert.That(attachmentItem, Is.Not.Null); | 163 | Assert.That(attachmentItem, Is.Not.Null); |
165 | Assert.That(attachmentItem.Name, Is.EqualTo(attName)); | 164 | Assert.That(attachmentItem.Name, Is.EqualTo(attName)); |
166 | 165 | ||
167 | InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(m_presence.UUID, AssetType.Object); | 166 | InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); |
168 | Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); | 167 | Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); |
169 | 168 | ||
170 | // TestHelpers.DisableLogging(); | 169 | // TestHelpers.DisableLogging(); |
@@ -178,16 +177,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
178 | 177 | ||
179 | Scene scene = CreateDefaultTestScene(); | 178 | Scene scene = CreateDefaultTestScene(); |
180 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 179 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
181 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | 180 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); |
182 | 181 | ||
183 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 182 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); |
184 | 183 | ||
185 | m_attMod.RezSingleAttachmentFromInventory( | 184 | m_attMod.RezSingleAttachmentFromInventory( |
186 | m_presence, attItem.ID, (uint)AttachmentPoint.Chest); | 185 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
187 | 186 | ||
188 | // Check scene presence status | 187 | // Check scene presence status |
189 | Assert.That(m_presence.HasAttachments(), Is.True); | 188 | Assert.That(sp.HasAttachments(), Is.True); |
190 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); | 189 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
191 | Assert.That(attachments.Count, Is.EqualTo(1)); | 190 | Assert.That(attachments.Count, Is.EqualTo(1)); |
192 | SceneObjectGroup attSo = attachments[0]; | 191 | SceneObjectGroup attSo = attachments[0]; |
193 | Assert.That(attSo.Name, Is.EqualTo(attItem.Name)); | 192 | Assert.That(attSo.Name, Is.EqualTo(attItem.Name)); |
@@ -197,8 +196,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
197 | Assert.That(attSo.IsTemporary, Is.False); | 196 | Assert.That(attSo.IsTemporary, Is.False); |
198 | 197 | ||
199 | // Check appearance status | 198 | // Check appearance status |
200 | Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1)); | 199 | Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1)); |
201 | Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); | 200 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); |
202 | } | 201 | } |
203 | 202 | ||
204 | [Test] | 203 | [Test] |
@@ -209,22 +208,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
209 | 208 | ||
210 | Scene scene = CreateDefaultTestScene(); | 209 | Scene scene = CreateDefaultTestScene(); |
211 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 210 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
212 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | 211 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); |
213 | 212 | ||
214 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 213 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); |
215 | 214 | ||
216 | ISceneEntity so | 215 | ISceneEntity so |
217 | = m_attMod.RezSingleAttachmentFromInventory( | 216 | = m_attMod.RezSingleAttachmentFromInventory( |
218 | m_presence, attItem.ID, (uint)AttachmentPoint.Chest); | 217 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
219 | m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId); | 218 | m_attMod.DetachSingleAttachmentToGround(sp, so.LocalId); |
220 | 219 | ||
221 | // Check scene presence status | 220 | // Check scene presence status |
222 | Assert.That(m_presence.HasAttachments(), Is.False); | 221 | Assert.That(sp.HasAttachments(), Is.False); |
223 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); | 222 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
224 | Assert.That(attachments.Count, Is.EqualTo(0)); | 223 | Assert.That(attachments.Count, Is.EqualTo(0)); |
225 | 224 | ||
226 | // Check appearance status | 225 | // Check appearance status |
227 | Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0)); | 226 | Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(0)); |
228 | 227 | ||
229 | // Check item status | 228 | // Check item status |
230 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null); | 229 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null); |
@@ -241,21 +240,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
241 | 240 | ||
242 | Scene scene = CreateDefaultTestScene(); | 241 | Scene scene = CreateDefaultTestScene(); |
243 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 242 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); |
244 | m_presence = SceneHelpers.AddScenePresence(scene, m_userId); | 243 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); |
245 | 244 | ||
246 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 245 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); |
247 | 246 | ||
248 | m_attMod.RezSingleAttachmentFromInventory( | 247 | m_attMod.RezSingleAttachmentFromInventory( |
249 | m_presence, attItem.ID, (uint)AttachmentPoint.Chest); | 248 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
250 | m_attMod.DetachSingleAttachmentToInv(m_presence, attItem.ID); | 249 | m_attMod.DetachSingleAttachmentToInv(sp, attItem.ID); |
251 | 250 | ||
252 | // Check status on scene presence | 251 | // Check status on scene presence |
253 | Assert.That(m_presence.HasAttachments(), Is.False); | 252 | Assert.That(sp.HasAttachments(), Is.False); |
254 | List<SceneObjectGroup> attachments = m_presence.GetAttachments(); | 253 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
255 | Assert.That(attachments.Count, Is.EqualTo(0)); | 254 | Assert.That(attachments.Count, Is.EqualTo(0)); |
256 | 255 | ||
257 | // Check item status | 256 | // Check item status |
258 | Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); | 257 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); |
259 | } | 258 | } |
260 | 259 | ||
261 | /// <summary> | 260 | /// <summary> |