diff options
author | Justin Clark-Casey (justincc) | 2012-06-26 22:31:25 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-26 22:31:25 +0100 |
commit | 2b82c421adf23cc47e1dc4f6da941b7cd2a407b6 (patch) | |
tree | a53228a5f6d8b246f9eb92d18da876fcb22093d9 /OpenSim/Region | |
parent | refactor: make m_presence a local variable in all AttachmentsModuleTests sinc... (diff) | |
download | opensim-SC-2b82c421adf23cc47e1dc4f6da941b7cd2a407b6.zip opensim-SC-2b82c421adf23cc47e1dc4f6da941b7cd2a407b6.tar.gz opensim-SC-2b82c421adf23cc47e1dc4f6da941b7cd2a407b6.tar.bz2 opensim-SC-2b82c421adf23cc47e1dc4f6da941b7cd2a407b6.tar.xz |
refactor: Use local attachment module variables instead of global m_attMod.
This also avoids confusion between tests where one sets up m_attMod and another accidentally uses it after failing to set one up itself.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 4c750bc..d233faf 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -56,8 +56,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
56 | [TestFixture] | 56 | [TestFixture] |
57 | public class AttachmentsModuleTests | 57 | public class AttachmentsModuleTests |
58 | { | 58 | { |
59 | private AttachmentsModule m_attMod; | ||
60 | |||
61 | /// <summary> | 59 | /// <summary> |
62 | /// Standard user ID | 60 | /// Standard user ID |
63 | /// </summary> | 61 | /// </summary> |
@@ -95,8 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
95 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 93 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
96 | 94 | ||
97 | Scene scene = new SceneHelpers().SetupScene(); | 95 | Scene scene = new SceneHelpers().SetupScene(); |
98 | m_attMod = new AttachmentsModule(); | 96 | SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); |
99 | SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule()); | ||
100 | 97 | ||
101 | return scene; | 98 | return scene; |
102 | } | 99 | } |
@@ -141,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
141 | 138 | ||
142 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID).ParentGroup; | 139 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID).ParentGroup; |
143 | 140 | ||
144 | m_attMod.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false); | 141 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false); |
145 | 142 | ||
146 | // Check status on scene presence | 143 | // Check status on scene presence |
147 | Assert.That(sp.HasAttachments(), Is.True); | 144 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -181,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
181 | 178 | ||
182 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 179 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); |
183 | 180 | ||
184 | m_attMod.RezSingleAttachmentFromInventory( | 181 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
185 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 182 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
186 | 183 | ||
187 | // Check scene presence status | 184 | // Check scene presence status |
@@ -213,9 +210,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
213 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 210 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); |
214 | 211 | ||
215 | ISceneEntity so | 212 | ISceneEntity so |
216 | = m_attMod.RezSingleAttachmentFromInventory( | 213 | = scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
217 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 214 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
218 | m_attMod.DetachSingleAttachmentToGround(sp, so.LocalId); | 215 | scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId); |
219 | 216 | ||
220 | // Check scene presence status | 217 | // Check scene presence status |
221 | Assert.That(sp.HasAttachments(), Is.False); | 218 | Assert.That(sp.HasAttachments(), Is.False); |
@@ -244,9 +241,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
244 | 241 | ||
245 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 242 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); |
246 | 243 | ||
247 | m_attMod.RezSingleAttachmentFromInventory( | 244 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
248 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 245 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
249 | m_attMod.DetachSingleAttachmentToInv(sp, attItem.ID); | 246 | scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, attItem.ID); |
250 | 247 | ||
251 | // Check status on scene presence | 248 | // Check status on scene presence |
252 | Assert.That(sp.HasAttachments(), Is.False); | 249 | Assert.That(sp.HasAttachments(), Is.False); |
@@ -364,6 +361,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
364 | // for a callback from the destination scene before removing its avatar data. | 361 | // for a callback from the destination scene before removing its avatar data. |
365 | entityTransferConfig.Set("wait_for_callback", false); | 362 | entityTransferConfig.Set("wait_for_callback", false); |
366 | 363 | ||
364 | modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule"); | ||
365 | |||
367 | SceneHelpers sh = new SceneHelpers(); | 366 | SceneHelpers sh = new SceneHelpers(); |
368 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | 367 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
369 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); | 368 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); |
@@ -380,7 +379,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
380 | 379 | ||
381 | InventoryItemBase attItem = CreateAttachmentItem(sceneA, m_userId, "att", 0x10, 0x20); | 380 | InventoryItemBase attItem = CreateAttachmentItem(sceneA, m_userId, "att", 0x10, 0x20); |
382 | 381 | ||
383 | m_attMod.RezSingleAttachmentFromInventory( | 382 | sceneA.AttachmentsModule.RezSingleAttachmentFromInventory( |
384 | beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest); | 383 | beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest); |
385 | 384 | ||
386 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 385 | Vector3 teleportPosition = new Vector3(10, 11, 12); |