aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-23 21:20:23 +0100
committerJustin Clark-Casey (justincc)2011-08-23 21:20:23 +0100
commit34aed96a2f67b94dbb4fb1900f8fa1e3228a7d50 (patch)
tree9fbce6e6d018368634a27816150585697d79f1d1 /OpenSim/Region/CoreModules
parentRemove pointless contains check in ScenePresence.RemoveAttachment() (diff)
downloadopensim-SC_OLD-34aed96a2f67b94dbb4fb1900f8fa1e3228a7d50.zip
opensim-SC_OLD-34aed96a2f67b94dbb4fb1900f8fa1e3228a7d50.tar.gz
opensim-SC_OLD-34aed96a2f67b94dbb4fb1900f8fa1e3228a7d50.tar.bz2
opensim-SC_OLD-34aed96a2f67b94dbb4fb1900f8fa1e3228a7d50.tar.xz
replace old TestAddAttachments() with a more thorough TestAddAttachment()
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs35
1 files changed, 28 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 5bac4c6..87255aa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
60 public AgentCircuitData acd1; 60 public AgentCircuitData acd1;
61 public SceneObjectGroup sog1, sog2; 61 public SceneObjectGroup sog1, sog2;
62 62
63 private AttachmentsModule m_attMod;
64
63 [SetUp] 65 [SetUp]
64 public void Init() 66 public void Init()
65 { 67 {
@@ -71,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
71 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); 73 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
72 74
73 scene = SceneHelpers.SetupScene(); 75 scene = SceneHelpers.SetupScene();
74 SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); 76 m_attMod = new AttachmentsModule();
77 SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
75 78
76 agent1 = UUID.Random(); 79 agent1 = UUID.Random();
77 random = new Random(); 80 random = new Random();
@@ -86,18 +89,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
86 // threads. Possibly, later tests should be rewritten not to worry about such things. 89 // threads. Possibly, later tests should be rewritten not to worry about such things.
87 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; 90 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
88 } 91 }
89 92
90 [Test] 93 [Test]
91 public void TestAddAttachments() 94 public void TestAddAttachment()
92 { 95 {
93 TestHelpers.InMethod(); 96 TestHelpers.InMethod();
97// log4net.Config.XmlConfigurator.Configure();
94 98
95 ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); 99 UUID userId = TestHelpers.ParseTail(0x1);
96 presence.AddAttachment(sog1); 100 UUID attItemId = TestHelpers.ParseTail(0x2);
97 presence.AddAttachment(sog2); 101 UUID attAssetId = TestHelpers.ParseTail(0x3);
102 string attName = "att";
98 103
104 UserAccountHelpers.CreateUserWithInventory(scene, userId);
105 ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId);
106 InventoryItemBase attItem
107 = UserInventoryHelpers.CreateInventoryItem(
108 scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
109
110 m_attMod.RezSingleAttachmentFromInventory(
111 presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
112
113 // Check status on scene presence
99 Assert.That(presence.HasAttachments(), Is.True); 114 Assert.That(presence.HasAttachments(), Is.True);
100 Assert.That(presence.ValidateAttachments(), Is.True); 115 List<SceneObjectGroup> attachments = presence.Attachments;
116 Assert.That(attachments.Count, Is.EqualTo(1));
117 Assert.That(attachments[0].Name, Is.EqualTo(attName));
118 Assert.That(attachments[0].GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest));
119
120 // Check item status
121 Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
101 } 122 }
102 123
103 [Test] 124 [Test]