aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-26 22:24:51 +0100
committerJustin Clark-Casey (justincc)2011-08-26 22:24:51 +0100
commit040ad11e611729be16e61dbc5075eca14067c6a9 (patch)
tree01cbfcb2d469c53a7bb846ce05d435e1438fde39 /OpenSim/Region
parentcomment out verbose test logging from last commit (diff)
downloadopensim-SC_OLD-040ad11e611729be16e61dbc5075eca14067c6a9.zip
opensim-SC_OLD-040ad11e611729be16e61dbc5075eca14067c6a9.tar.gz
opensim-SC_OLD-040ad11e611729be16e61dbc5075eca14067c6a9.tar.bz2
opensim-SC_OLD-040ad11e611729be16e61dbc5075eca14067c6a9.tar.xz
refactor: remove common presence set up in attachments tests
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs70
1 files changed, 38 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 072148c..b7d21fd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
56 { 56 {
57 private Scene scene; 57 private Scene scene;
58 private AttachmentsModule m_attMod; 58 private AttachmentsModule m_attMod;
59 private ScenePresence m_presence;
59 60
60 [SetUp] 61 [SetUp]
61 public void Init() 62 public void Init()
@@ -80,24 +81,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
80 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; 81 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
81 } 82 }
82 83
84 /// <summary>
85 /// Add the standard presence for a test.
86 /// </summary>
87 private void AddPresence()
88 {
89 UUID userId = TestHelpers.ParseTail(0x1);
90 UserAccountHelpers.CreateUserWithInventory(scene, userId);
91 m_presence = SceneHelpers.AddScenePresence(scene, userId);
92 }
93
83 [Test] 94 [Test]
84 public void TestAddAttachmentFromGround() 95 public void TestAddAttachmentFromGround()
85 { 96 {
86 TestHelpers.InMethod(); 97 TestHelpers.InMethod();
87// log4net.Config.XmlConfigurator.Configure(); 98// log4net.Config.XmlConfigurator.Configure();
88 99
89 UUID userId = TestHelpers.ParseTail(0x1); 100 AddPresence();
90 string attName = "att"; 101 string attName = "att";
91 102
92 UserAccountHelpers.CreateUserWithInventory(scene, userId);
93 ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId);
94 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; 103 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup;
95 104
96 m_attMod.AttachObject(presence.ControllingClient, so, (uint)AttachmentPoint.Chest, false); 105 m_attMod.AttachObject(m_presence.ControllingClient, so, (uint)AttachmentPoint.Chest, false);
97 106
98 // Check status on scene presence 107 // Check status on scene presence
99 Assert.That(presence.HasAttachments(), Is.True); 108 Assert.That(m_presence.HasAttachments(), Is.True);
100 List<SceneObjectGroup> attachments = presence.Attachments; 109 List<SceneObjectGroup> attachments = m_presence.Attachments;
101 Assert.That(attachments.Count, Is.EqualTo(1)); 110 Assert.That(attachments.Count, Is.EqualTo(1));
102 SceneObjectGroup attSo = attachments[0]; 111 SceneObjectGroup attSo = attachments[0];
103 Assert.That(attSo.Name, Is.EqualTo(attName)); 112 Assert.That(attSo.Name, Is.EqualTo(attName));
@@ -107,7 +116,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
107 Assert.That(attSo.IsTemporary, Is.False); 116 Assert.That(attSo.IsTemporary, Is.False);
108 117
109 // Check item status 118 // Check item status
110 Assert.That(presence.Appearance.GetAttachpoint( 119 Assert.That(m_presence.Appearance.GetAttachpoint(
111 attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest)); 120 attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest));
112 } 121 }
113 122
@@ -117,23 +126,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
117 TestHelpers.InMethod(); 126 TestHelpers.InMethod();
118// log4net.Config.XmlConfigurator.Configure(); 127// log4net.Config.XmlConfigurator.Configure();
119 128
120 UUID userId = TestHelpers.ParseTail(0x1); 129 AddPresence();
130
121 UUID attItemId = TestHelpers.ParseTail(0x2); 131 UUID attItemId = TestHelpers.ParseTail(0x2);
122 UUID attAssetId = TestHelpers.ParseTail(0x3); 132 UUID attAssetId = TestHelpers.ParseTail(0x3);
123 string attName = "att"; 133 string attName = "att";
124 134
125 UserAccountHelpers.CreateUserWithInventory(scene, userId);
126 ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId);
127 InventoryItemBase attItem 135 InventoryItemBase attItem
128 = UserInventoryHelpers.CreateInventoryItem( 136 = UserInventoryHelpers.CreateInventoryItem(
129 scene, attName, attItemId, attAssetId, userId, InventoryType.Object); 137 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
130 138
131 m_attMod.RezSingleAttachmentFromInventory( 139 m_attMod.RezSingleAttachmentFromInventory(
132 presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 140 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
133 141
134 // Check status on scene presence 142 // Check status on scene presence
135 Assert.That(presence.HasAttachments(), Is.True); 143 Assert.That(m_presence.HasAttachments(), Is.True);
136 List<SceneObjectGroup> attachments = presence.Attachments; 144 List<SceneObjectGroup> attachments = m_presence.Attachments;
137 Assert.That(attachments.Count, Is.EqualTo(1)); 145 Assert.That(attachments.Count, Is.EqualTo(1));
138 SceneObjectGroup attSo = attachments[0]; 146 SceneObjectGroup attSo = attachments[0];
139 Assert.That(attSo.Name, Is.EqualTo(attName)); 147 Assert.That(attSo.Name, Is.EqualTo(attName));
@@ -143,7 +151,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
143 Assert.That(attSo.IsTemporary, Is.False); 151 Assert.That(attSo.IsTemporary, Is.False);
144 152
145 // Check item status 153 // Check item status
146 Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); 154 Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
147 } 155 }
148 156
149 [Test] 157 [Test]
@@ -152,24 +160,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
152 TestHelpers.InMethod(); 160 TestHelpers.InMethod();
153// log4net.Config.XmlConfigurator.Configure(); 161// log4net.Config.XmlConfigurator.Configure();
154 162
155 UUID userId = TestHelpers.ParseTail(0x1); 163 AddPresence();
164
156 UUID attItemId = TestHelpers.ParseTail(0x2); 165 UUID attItemId = TestHelpers.ParseTail(0x2);
157 UUID attAssetId = TestHelpers.ParseTail(0x3); 166 UUID attAssetId = TestHelpers.ParseTail(0x3);
158 string attName = "att"; 167 string attName = "att";
159 168
160 UserAccountHelpers.CreateUserWithInventory(scene, userId);
161 ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId);
162 InventoryItemBase attItem 169 InventoryItemBase attItem
163 = UserInventoryHelpers.CreateInventoryItem( 170 = UserInventoryHelpers.CreateInventoryItem(
164 scene, attName, attItemId, attAssetId, userId, InventoryType.Object); 171 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
165 172
166 UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( 173 UUID attSoId = m_attMod.RezSingleAttachmentFromInventory(
167 presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 174 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
168 m_attMod.DetachSingleAttachmentToGround(attSoId, presence.ControllingClient); 175 m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient);
169 176
170 // Check status on scene presence 177 // Check status on scene presence
171 Assert.That(presence.HasAttachments(), Is.False); 178 Assert.That(m_presence.HasAttachments(), Is.False);
172 List<SceneObjectGroup> attachments = presence.Attachments; 179 List<SceneObjectGroup> attachments = m_presence.Attachments;
173 Assert.That(attachments.Count, Is.EqualTo(0)); 180 Assert.That(attachments.Count, Is.EqualTo(0));
174 181
175 // Check item status 182 // Check item status
@@ -185,28 +192,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
185 TestHelpers.InMethod(); 192 TestHelpers.InMethod();
186// log4net.Config.XmlConfigurator.Configure(); 193// log4net.Config.XmlConfigurator.Configure();
187 194
188 UUID userId = TestHelpers.ParseTail(0x1); 195 AddPresence();
196
189 UUID attItemId = TestHelpers.ParseTail(0x2); 197 UUID attItemId = TestHelpers.ParseTail(0x2);
190 UUID attAssetId = TestHelpers.ParseTail(0x3); 198 UUID attAssetId = TestHelpers.ParseTail(0x3);
191 string attName = "att"; 199 string attName = "att";
192 200
193 UserAccountHelpers.CreateUserWithInventory(scene, userId);
194 ScenePresence presence = SceneHelpers.AddScenePresence(scene, userId);
195 InventoryItemBase attItem 201 InventoryItemBase attItem
196 = UserInventoryHelpers.CreateInventoryItem( 202 = UserInventoryHelpers.CreateInventoryItem(
197 scene, attName, attItemId, attAssetId, userId, InventoryType.Object); 203 scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
198 204
199 m_attMod.RezSingleAttachmentFromInventory( 205 m_attMod.RezSingleAttachmentFromInventory(
200 presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); 206 m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest);
201 m_attMod.DetachSingleAttachmentToInv(attItemId, presence.ControllingClient); 207 m_attMod.DetachSingleAttachmentToInv(attItemId, m_presence.ControllingClient);
202 208
203 // Check status on scene presence 209 // Check status on scene presence
204 Assert.That(presence.HasAttachments(), Is.False); 210 Assert.That(m_presence.HasAttachments(), Is.False);
205 List<SceneObjectGroup> attachments = presence.Attachments; 211 List<SceneObjectGroup> attachments = m_presence.Attachments;
206 Assert.That(attachments.Count, Is.EqualTo(0)); 212 Assert.That(attachments.Count, Is.EqualTo(0));
207 213
208 // Check item status 214 // Check item status
209 Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0)); 215 Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0));
210 } 216 }
211 217
212 [Test] 218 [Test]