aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-23 21:37:36 +0100
committerJustin Clark-Casey (justincc)2011-08-23 21:37:36 +0100
commit805ba268d5b642b7a9bc8d1ca10ce2e94ae2913a (patch)
treeef936c56d572da2799fdad193d864dbc83a142ca /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-805ba268d5b642b7a9bc8d1ca10ce2e94ae2913a.zip
opensim-SC_OLD-805ba268d5b642b7a9bc8d1ca10ce2e94ae2913a.tar.gz
opensim-SC_OLD-805ba268d5b642b7a9bc8d1ca10ce2e94ae2913a.tar.bz2
opensim-SC_OLD-805ba268d5b642b7a9bc8d1ca10ce2e94ae2913a.tar.xz
replace TestRemoveAttachments() with a more thorough TestRemoveAttachment()
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs78
1 files changed, 27 insertions, 51 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 87255aa..71321cc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -54,12 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
54 [TestFixture] 54 [TestFixture]
55 public class AttachmentsModuleTests 55 public class AttachmentsModuleTests
56 { 56 {
57 public Scene scene; 57 private Scene scene;
58 public UUID agent1;
59 public static Random random;
60 public AgentCircuitData acd1;
61 public SceneObjectGroup sog1, sog2;
62
63 private AttachmentsModule m_attMod; 58 private AttachmentsModule m_attMod;
64 59
65 [SetUp] 60 [SetUp]
@@ -75,11 +70,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
75 scene = SceneHelpers.SetupScene(); 70 scene = SceneHelpers.SetupScene();
76 m_attMod = new AttachmentsModule(); 71 m_attMod = new AttachmentsModule();
77 SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule()); 72 SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
78
79 agent1 = UUID.Random();
80 random = new Random();
81 sog1 = NewSOG(UUID.Random(), scene, agent1);
82 sog2 = NewSOG(UUID.Random(), scene, agent1);
83 } 73 }
84 74
85 [TearDown] 75 [TearDown]
@@ -122,16 +112,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
122 } 112 }
123 113
124 [Test] 114 [Test]
125 public void TestRemoveAttachments() 115 public void TestRemoveAttachment()
126 { 116 {
127 TestHelpers.InMethod(); 117 TestHelpers.InMethod();
118// log4net.Config.XmlConfigurator.Configure();
119
120 UUID userId = TestHelpers.ParseTail(0x1);
121 UUID attItemId = TestHelpers.ParseTail(0x2);
122 UUID attAssetId = TestHelpers.ParseTail(0x3);
123 string attName = "att";
124
125 UserAccountHelpers.CreateUserWithInventory(scene, userId);
126 ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId);
127 InventoryItemBase attItem
128 = UserInventoryHelpers.CreateInventoryItem(
129 scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
130
131 m_attMod.RezSingleAttachmentFromInventory(
132 presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
133
134 // ###
135 m_attMod.ShowDetachInUserInventory(attItemId, presence.ControllingClient);
128 136
129 ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); 137 // Check status on scene presence
130 presence.AddAttachment(sog1);
131 presence.AddAttachment(sog2);
132 presence.RemoveAttachment(sog1);
133 presence.RemoveAttachment(sog2);
134 Assert.That(presence.HasAttachments(), Is.False); 138 Assert.That(presence.HasAttachments(), Is.False);
139 List<SceneObjectGroup> attachments = presence.Attachments;
140 Assert.That(attachments.Count, Is.EqualTo(0));
141
142 // Check item status
143 Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0));
135 } 144 }
136 145
137 [Test] 146 [Test]
@@ -183,39 +192,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
183// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); 192// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
184// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); 193// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
185// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); 194// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
186// } 195// }
187
188 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
189 {
190 SceneObjectPart sop = new SceneObjectPart();
191 sop.Name = RandomName();
192 sop.Description = RandomName();
193 sop.Text = RandomName();
194 sop.SitName = RandomName();
195 sop.TouchName = RandomName();
196 sop.UUID = uuid;
197 sop.Shape = PrimitiveBaseShape.Default;
198 sop.Shape.State = 1;
199 sop.OwnerID = agent;
200
201 SceneObjectGroup sog = new SceneObjectGroup(sop);
202 sog.SetScene(scene);
203
204 return sog;
205 }
206
207 private static string RandomName()
208 {
209 StringBuilder name = new StringBuilder();
210 int size = random.Next(5,12);
211 char ch;
212 for (int i = 0; i < size; i++)
213 {
214 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
215 name.Append(ch);
216 }
217
218 return name.ToString();
219 }
220 } 196 }
221} \ No newline at end of file 197} \ No newline at end of file