diff options
author | Justin Clark-Casey (justincc) | 2012-06-26 22:53:08 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-26 22:53:08 +0100 |
commit | 99954c14980817adae427ab8ac4cdf07cbad0d7d (patch) | |
tree | d0b7af197503015ba5729aa5c4e8269508ad9b17 /OpenSim/Region | |
parent | refactor: Use local attachment module variables instead of global m_attMod. (diff) | |
download | opensim-SC_OLD-99954c14980817adae427ab8ac4cdf07cbad0d7d.zip opensim-SC_OLD-99954c14980817adae427ab8ac4cdf07cbad0d7d.tar.gz opensim-SC_OLD-99954c14980817adae427ab8ac4cdf07cbad0d7d.tar.bz2 opensim-SC_OLD-99954c14980817adae427ab8ac4cdf07cbad0d7d.tar.xz |
refactor: Remove unnecessary AttachmentModuleTests.m_userId in favour of local variables
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index d233faf..ddfc6cb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.World.Serialiser; | |||
45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
46 | using OpenSim.Region.Framework.Scenes; | 46 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Framework.Interfaces; | 47 | using OpenSim.Region.Framework.Interfaces; |
48 | using OpenSim.Services.Interfaces; | ||
48 | using OpenSim.Tests.Common; | 49 | using OpenSim.Tests.Common; |
49 | using OpenSim.Tests.Common.Mock; | 50 | using OpenSim.Tests.Common.Mock; |
50 | 51 | ||
@@ -56,21 +57,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
56 | [TestFixture] | 57 | [TestFixture] |
57 | public class AttachmentsModuleTests | 58 | public class AttachmentsModuleTests |
58 | { | 59 | { |
59 | /// <summary> | ||
60 | /// Standard user ID | ||
61 | /// </summary> | ||
62 | private UUID m_userId = TestHelpers.ParseTail(0x1); | ||
63 | |||
64 | // /// <summary> | ||
65 | // /// Standard attachment item ID | ||
66 | // /// </summary> | ||
67 | // private UUID m_attItemId = TestHelpers.ParseTail(0x10); | ||
68 | // | ||
69 | // /// <summary> | ||
70 | // /// Standard attachment asset ID | ||
71 | // /// </summary> | ||
72 | // private UUID m_attAssetId = TestHelpers.ParseTail(0x11); | ||
73 | |||
74 | [TestFixtureSetUp] | 60 | [TestFixtureSetUp] |
75 | public void FixtureInit() | 61 | public void FixtureInit() |
76 | { | 62 | { |
@@ -131,8 +117,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
131 | // TestHelpers.EnableLogging(); | 117 | // TestHelpers.EnableLogging(); |
132 | 118 | ||
133 | Scene scene = CreateDefaultTestScene(); | 119 | Scene scene = CreateDefaultTestScene(); |
134 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 120 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
135 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); | 121 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
136 | 122 | ||
137 | string attName = "att"; | 123 | string attName = "att"; |
138 | 124 | ||
@@ -173,10 +159,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
173 | // log4net.Config.XmlConfigurator.Configure(); | 159 | // log4net.Config.XmlConfigurator.Configure(); |
174 | 160 | ||
175 | Scene scene = CreateDefaultTestScene(); | 161 | Scene scene = CreateDefaultTestScene(); |
176 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 162 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
177 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); | 163 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
178 | 164 | ||
179 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 165 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
180 | 166 | ||
181 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( | 167 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
182 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 168 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
@@ -204,10 +190,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
204 | // log4net.Config.XmlConfigurator.Configure(); | 190 | // log4net.Config.XmlConfigurator.Configure(); |
205 | 191 | ||
206 | Scene scene = CreateDefaultTestScene(); | 192 | Scene scene = CreateDefaultTestScene(); |
207 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 193 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
208 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); | 194 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
209 | 195 | ||
210 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 196 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
211 | 197 | ||
212 | ISceneEntity so | 198 | ISceneEntity so |
213 | = scene.AttachmentsModule.RezSingleAttachmentFromInventory( | 199 | = scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
@@ -236,10 +222,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
236 | // log4net.Config.XmlConfigurator.Configure(); | 222 | // log4net.Config.XmlConfigurator.Configure(); |
237 | 223 | ||
238 | Scene scene = CreateDefaultTestScene(); | 224 | Scene scene = CreateDefaultTestScene(); |
239 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 225 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
240 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId); | 226 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID); |
241 | 227 | ||
242 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 228 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
243 | 229 | ||
244 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( | 230 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
245 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 231 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
@@ -264,10 +250,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
264 | // log4net.Config.XmlConfigurator.Configure(); | 250 | // log4net.Config.XmlConfigurator.Configure(); |
265 | 251 | ||
266 | Scene scene = CreateDefaultTestScene(); | 252 | Scene scene = CreateDefaultTestScene(); |
267 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 253 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
268 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 254 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
269 | 255 | ||
270 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId); | 256 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); |
271 | acd.Appearance = new AvatarAppearance(); | 257 | acd.Appearance = new AvatarAppearance(); |
272 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); | 258 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); |
273 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | 259 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); |
@@ -287,10 +273,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
287 | // log4net.Config.XmlConfigurator.Configure(); | 273 | // log4net.Config.XmlConfigurator.Configure(); |
288 | 274 | ||
289 | Scene scene = CreateDefaultTestScene(); | 275 | Scene scene = CreateDefaultTestScene(); |
290 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 276 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
291 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 277 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
292 | 278 | ||
293 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId); | 279 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); |
294 | acd.Appearance = new AvatarAppearance(); | 280 | acd.Appearance = new AvatarAppearance(); |
295 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); | 281 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); |
296 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | 282 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); |
@@ -321,10 +307,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
321 | TestHelpers.InMethod(); | 307 | TestHelpers.InMethod(); |
322 | 308 | ||
323 | Scene scene = CreateDefaultTestScene(); | 309 | Scene scene = CreateDefaultTestScene(); |
324 | UserAccountHelpers.CreateUserWithInventory(scene, m_userId); | 310 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
325 | InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20); | 311 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
326 | 312 | ||
327 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId); | 313 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); |
328 | acd.Appearance = new AvatarAppearance(); | 314 | acd.Appearance = new AvatarAppearance(); |
329 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); | 315 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); |
330 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd); | 316 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd); |
@@ -373,11 +359,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
373 | SceneHelpers.SetupSceneModules( | 359 | SceneHelpers.SetupSceneModules( |
374 | sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); | 360 | sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); |
375 | 361 | ||
376 | UserAccountHelpers.CreateUserWithInventory(sceneA, m_userId); | 362 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); |
377 | ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, m_userId, sh.SceneManager); | 363 | ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, ua1.PrincipalID, sh.SceneManager); |
378 | beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); | 364 | beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); |
379 | 365 | ||
380 | InventoryItemBase attItem = CreateAttachmentItem(sceneA, m_userId, "att", 0x10, 0x20); | 366 | InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20); |
381 | 367 | ||
382 | sceneA.AttachmentsModule.RezSingleAttachmentFromInventory( | 368 | sceneA.AttachmentsModule.RezSingleAttachmentFromInventory( |
383 | beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest); | 369 | beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest); |
@@ -395,7 +381,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
395 | ((TestClient)beforeTeleportSp.ControllingClient).CompleteTeleportClientSide(); | 381 | ((TestClient)beforeTeleportSp.ControllingClient).CompleteTeleportClientSide(); |
396 | 382 | ||
397 | // Check attachments have made it into sceneB | 383 | // Check attachments have made it into sceneB |
398 | ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(m_userId); | 384 | ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID); |
399 | 385 | ||
400 | // This is appearance data, as opposed to actually rezzed attachments | 386 | // This is appearance data, as opposed to actually rezzed attachments |
401 | List<AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments(); | 387 | List<AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments(); |
@@ -413,7 +399,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
413 | Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); | 399 | Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); |
414 | 400 | ||
415 | // Check attachments have been removed from sceneA | 401 | // Check attachments have been removed from sceneA |
416 | ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(m_userId); | 402 | ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID); |
417 | 403 | ||
418 | // Since this is appearance data, it is still present on the child avatar! | 404 | // Since this is appearance data, it is still present on the child avatar! |
419 | List<AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments(); | 405 | List<AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments(); |