diff options
Diffstat (limited to 'OpenSim/Framework/Tests/MundaneFrameworkTests.cs')
-rw-r--r-- | OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index e2e08c0..0c588eb 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs | |||
@@ -29,12 +29,17 @@ using NUnit.Framework; | |||
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | 31 | using OpenMetaverse.StructuredData; |
32 | using System; | ||
32 | 33 | ||
33 | namespace OpenSim.Framework.Tests | 34 | namespace OpenSim.Framework.Tests |
34 | { | 35 | { |
35 | [TestFixture] | 36 | [TestFixture] |
36 | public class MundaneFrameworkTests | 37 | public class MundaneFrameworkTests |
37 | { | 38 | { |
39 | private bool m_RegionSettingsOnSaveEventFired; | ||
40 | private bool m_RegionLightShareDataOnSaveEventFired; | ||
41 | |||
42 | |||
38 | [Test] | 43 | [Test] |
39 | public void ChildAgentDataUpdate01() | 44 | public void ChildAgentDataUpdate01() |
40 | { | 45 | { |
@@ -124,6 +129,141 @@ namespace OpenSim.Framework.Tests | |||
124 | Assert.IsTrue(position2.Size == position1.Size, "Size didn't unpack the same way it packed"); | 129 | Assert.IsTrue(position2.Size == position1.Size, "Size didn't unpack the same way it packed"); |
125 | 130 | ||
126 | } | 131 | } |
132 | |||
133 | [Test] | ||
134 | public void RegionSettingsTest01() | ||
135 | { | ||
136 | RegionSettings settings = new RegionSettings(); | ||
137 | settings.OnSave += RegionSaveFired; | ||
138 | settings.Save(); | ||
139 | settings.OnSave -= RegionSaveFired; | ||
140 | |||
141 | string str = settings.LoadedCreationDate; | ||
142 | int dt = settings.LoadedCreationDateTime; | ||
143 | string id = settings.LoadedCreationID; | ||
144 | string time = settings.LoadedCreationTime; | ||
145 | |||
146 | Assert.That(m_RegionSettingsOnSaveEventFired, "RegionSettings Save Event didn't Fire"); | ||
147 | |||
148 | } | ||
149 | public void RegionSaveFired(RegionSettings settings) | ||
150 | { | ||
151 | m_RegionSettingsOnSaveEventFired = true; | ||
152 | } | ||
153 | |||
154 | [Test] | ||
155 | public void InventoryItemBaseConstructorTest01() | ||
156 | { | ||
157 | InventoryItemBase b1 = new InventoryItemBase(); | ||
158 | Assert.That(b1.ID == UUID.Zero, "void constructor should create an inventory item with ID = UUID.Zero"); | ||
159 | Assert.That(b1.Owner == UUID.Zero, "void constructor should create an inventory item with Owner = UUID.Zero"); | ||
160 | |||
161 | UUID ItemID = UUID.Random(); | ||
162 | UUID OwnerID = UUID.Random(); | ||
163 | |||
164 | InventoryItemBase b2 = new InventoryItemBase(ItemID); | ||
165 | Assert.That(b2.ID == ItemID, "ID constructor should create an inventory item with ID = ItemID"); | ||
166 | Assert.That(b2.Owner == UUID.Zero, "ID constructor should create an inventory item with Owner = UUID.Zero"); | ||
167 | |||
168 | InventoryItemBase b3 = new InventoryItemBase(ItemID,OwnerID); | ||
169 | Assert.That(b3.ID == ItemID, "ID,OwnerID constructor should create an inventory item with ID = ItemID"); | ||
170 | Assert.That(b3.Owner == OwnerID, "ID,OwnerID constructor should create an inventory item with Owner = OwnerID"); | ||
171 | |||
172 | } | ||
173 | |||
174 | [Test] | ||
175 | public void AssetMetaDataNonNullContentTypeTest01() | ||
176 | { | ||
177 | AssetMetadata assetMetadata = new AssetMetadata(); | ||
178 | assetMetadata.ContentType = "image/jp2"; | ||
179 | Assert.That(assetMetadata.Type == (sbyte)AssetType.Texture, "Content type should be AssetType.Texture"); | ||
180 | Assert.That(assetMetadata.ContentType == "image/jp2", "Text of content type should be image/jp2"); | ||
181 | UUID rndID = UUID.Random(); | ||
182 | assetMetadata.ID = rndID.ToString(); | ||
183 | Assert.That(assetMetadata.ID.ToLower() == rndID.ToString().ToLower(), "assetMetadata.ID Setter/Getter not Consistent"); | ||
184 | DateTime fixedTime = DateTime.Now; | ||
185 | assetMetadata.CreationDate = fixedTime; | ||
186 | } | ||
187 | |||
188 | [Test] | ||
189 | public void RegionLightShareDataCloneSaveTest01() | ||
190 | { | ||
191 | RegionLightShareData rlsd = new RegionLightShareData(); | ||
192 | rlsd.OnSave += RegionLightShareDataSaveFired; | ||
193 | rlsd.Save(); | ||
194 | rlsd.OnSave -= RegionLightShareDataSaveFired; | ||
195 | Assert.IsTrue(m_RegionLightShareDataOnSaveEventFired, "OnSave Event Never Fired"); | ||
196 | |||
197 | object o = rlsd.Clone(); | ||
198 | RegionLightShareData dupe = (RegionLightShareData) o; | ||
199 | Assert.IsTrue(rlsd.sceneGamma == dupe.sceneGamma, "Memberwise Clone of RegionLightShareData failed"); | ||
200 | } | ||
201 | public void RegionLightShareDataSaveFired(RegionLightShareData settings) | ||
202 | { | ||
203 | m_RegionLightShareDataOnSaveEventFired = true; | ||
204 | } | ||
205 | |||
206 | [Test] | ||
207 | public void EstateSettingsMundateTests() | ||
208 | { | ||
209 | EstateSettings es = new EstateSettings(); | ||
210 | es.AddBan(null); | ||
211 | UUID bannedUserId = UUID.Random(); | ||
212 | es.AddBan(new EstateBan() | ||
213 | { BannedHostAddress = string.Empty, | ||
214 | BannedHostIPMask = string.Empty, | ||
215 | BannedHostNameMask = string.Empty, | ||
216 | BannedUserID = bannedUserId} | ||
217 | ); | ||
218 | Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); | ||
219 | Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); | ||
220 | |||
221 | es.RemoveBan(bannedUserId); | ||
222 | |||
223 | Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); | ||
224 | |||
225 | es.AddEstateManager(UUID.Zero); | ||
226 | |||
227 | es.AddEstateManager(bannedUserId); | ||
228 | Assert.IsTrue(es.IsEstateManager(bannedUserId), "bannedUserId should be EstateManager but isn't."); | ||
229 | |||
230 | es.RemoveEstateManager(bannedUserId); | ||
231 | Assert.IsFalse(es.IsEstateManager(bannedUserId), "bannedUserID is estateManager but shouldn't be"); | ||
232 | |||
233 | Assert.IsFalse(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't"); | ||
234 | |||
235 | es.AddEstateUser(bannedUserId); | ||
236 | |||
237 | Assert.IsTrue(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); | ||
238 | es.RemoveEstateUser(bannedUserId); | ||
239 | |||
240 | es.AddEstateManager(bannedUserId); | ||
241 | |||
242 | Assert.IsTrue(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should"); | ||
243 | |||
244 | Assert.That(es.EstateGroups.Length == 0, "No Estate Groups Added.. so the array should be 0 length"); | ||
245 | |||
246 | es.AddEstateGroup(bannedUserId); | ||
247 | |||
248 | Assert.That(es.EstateGroups.Length == 1, "1 Estate Groups Added.. so the array should be 1 length"); | ||
249 | |||
250 | Assert.That(es.EstateGroups[0] == bannedUserId,"User ID should be in EstateGroups"); | ||
251 | |||
252 | } | ||
253 | |||
254 | [Test] | ||
255 | public void InventoryFolderBaseConstructorTest01() | ||
256 | { | ||
257 | UUID uuid1 = UUID.Random(); | ||
258 | UUID uuid2 = UUID.Random(); | ||
259 | |||
260 | InventoryFolderBase fld = new InventoryFolderBase(uuid1); | ||
261 | Assert.That(fld.ID == uuid1, "ID constructor failed to save value in ID field."); | ||
262 | |||
263 | fld = new InventoryFolderBase(uuid1, uuid2); | ||
264 | Assert.That(fld.ID == uuid1, "ID,Owner constructor failed to save value in ID field."); | ||
265 | Assert.That(fld.Owner == uuid2, "ID,Owner constructor failed to save value in ID field."); | ||
266 | } | ||
127 | 267 | ||
128 | 268 | ||
129 | } | 269 | } |