refactor: Remove unnecessary AttachmentModuleTests.m_userId in favour of local variables
parent
c6fb5f0fe4
commit
b802906827
|
@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.World.Serialiser;
|
||||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
using OpenSim.Tests.Common.Mock;
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
|
||||||
|
@ -56,21 +57,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class AttachmentsModuleTests
|
public class AttachmentsModuleTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Standard user ID
|
|
||||||
/// </summary>
|
|
||||||
private UUID m_userId = TestHelpers.ParseTail(0x1);
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Standard attachment item ID
|
|
||||||
// /// </summary>
|
|
||||||
// private UUID m_attItemId = TestHelpers.ParseTail(0x10);
|
|
||||||
//
|
|
||||||
// /// <summary>
|
|
||||||
// /// Standard attachment asset ID
|
|
||||||
// /// </summary>
|
|
||||||
// private UUID m_attAssetId = TestHelpers.ParseTail(0x11);
|
|
||||||
|
|
||||||
[TestFixtureSetUp]
|
[TestFixtureSetUp]
|
||||||
public void FixtureInit()
|
public void FixtureInit()
|
||||||
{
|
{
|
||||||
|
@ -131,8 +117,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
// TestHelpers.EnableLogging();
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
Scene scene = CreateDefaultTestScene();
|
Scene scene = CreateDefaultTestScene();
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
string attName = "att";
|
string attName = "att";
|
||||||
|
|
||||||
|
@ -173,10 +159,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = CreateDefaultTestScene();
|
Scene scene = CreateDefaultTestScene();
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
|
@ -204,10 +190,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = CreateDefaultTestScene();
|
Scene scene = CreateDefaultTestScene();
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
ISceneEntity so
|
ISceneEntity so
|
||||||
= scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
= scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
|
@ -236,10 +222,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = CreateDefaultTestScene();
|
Scene scene = CreateDefaultTestScene();
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
|
@ -264,10 +250,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = CreateDefaultTestScene();
|
Scene scene = CreateDefaultTestScene();
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
|
AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
|
||||||
acd.Appearance = new AvatarAppearance();
|
acd.Appearance = new AvatarAppearance();
|
||||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||||
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
||||||
|
@ -287,10 +273,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = CreateDefaultTestScene();
|
Scene scene = CreateDefaultTestScene();
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
|
AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
|
||||||
acd.Appearance = new AvatarAppearance();
|
acd.Appearance = new AvatarAppearance();
|
||||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||||
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
||||||
|
@ -321,10 +307,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
Scene scene = CreateDefaultTestScene();
|
Scene scene = CreateDefaultTestScene();
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
|
AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
|
||||||
acd.Appearance = new AvatarAppearance();
|
acd.Appearance = new AvatarAppearance();
|
||||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd);
|
||||||
|
@ -373,11 +359,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
SceneHelpers.SetupSceneModules(
|
SceneHelpers.SetupSceneModules(
|
||||||
sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());
|
sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(sceneA, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);
|
||||||
ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, m_userId, sh.SceneManager);
|
ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, ua1.PrincipalID, sh.SceneManager);
|
||||||
beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
|
beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(sceneA, m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
|
sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);
|
beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
|
@ -395,7 +381,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
((TestClient)beforeTeleportSp.ControllingClient).CompleteTeleportClientSide();
|
((TestClient)beforeTeleportSp.ControllingClient).CompleteTeleportClientSide();
|
||||||
|
|
||||||
// Check attachments have made it into sceneB
|
// Check attachments have made it into sceneB
|
||||||
ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(m_userId);
|
ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID);
|
||||||
|
|
||||||
// This is appearance data, as opposed to actually rezzed attachments
|
// This is appearance data, as opposed to actually rezzed attachments
|
||||||
List<AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();
|
List<AvatarAttachment> sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();
|
||||||
|
@ -413,7 +399,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
|
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
|
||||||
|
|
||||||
// Check attachments have been removed from sceneA
|
// Check attachments have been removed from sceneA
|
||||||
ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(m_userId);
|
ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID);
|
||||||
|
|
||||||
// Since this is appearance data, it is still present on the child avatar!
|
// Since this is appearance data, it is still present on the child avatar!
|
||||||
List<AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();
|
List<AvatarAttachment> sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();
|
||||||
|
|
|
@ -126,6 +126,11 @@ namespace OpenSim.Tests.Common
|
||||||
return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll");
|
return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UserAccount CreateUserWithInventory(Scene scene, int userId)
|
||||||
|
{
|
||||||
|
return CreateUserWithInventory(scene, "Bill", "Bailey", TestHelpers.ParseTail(userId), "troll");
|
||||||
|
}
|
||||||
|
|
||||||
public static UserAccount CreateUserWithInventory(
|
public static UserAccount CreateUserWithInventory(
|
||||||
Scene scene, string firstName, string lastName, UUID userId, string pw)
|
Scene scene, string firstName, string lastName, UUID userId, string pw)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue