aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-02-04 00:55:03 +0000
committerJustin Clark-Casey (justincc)2012-02-04 00:55:03 +0000
commit6c252a0fa1342ea71bf7d2d0a417d9ff6ddea1b3 (patch)
treed2d9d422578296ea8fb2068772b51102f0795c3f /OpenSim/Framework/Serialization
parentOnly look for an uploaded transactional asset in Scene.UpdateTaskInventory if... (diff)
downloadopensim-SC_OLD-6c252a0fa1342ea71bf7d2d0a417d9ff6ddea1b3.zip
opensim-SC_OLD-6c252a0fa1342ea71bf7d2d0a417d9ff6ddea1b3.tar.gz
opensim-SC_OLD-6c252a0fa1342ea71bf7d2d0a417d9ff6ddea1b3.tar.bz2
opensim-SC_OLD-6c252a0fa1342ea71bf7d2d0a417d9ff6ddea1b3.tar.xz
Add TestRegionSettingsDeserialize
Diffstat (limited to 'OpenSim/Framework/Serialization')
-rw-r--r--OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs2
-rw-r--r--OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs134
2 files changed, 135 insertions, 1 deletions
diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
index 11a3a0a..b8ed9e1 100644
--- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
+++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Framework.Serialization.Tests
118 public void TestLandDataDeserializeNoAccessLists() 118 public void TestLandDataDeserializeNoAccessLists()
119 { 119 {
120 TestHelpers.InMethod(); 120 TestHelpers.InMethod();
121 log4net.Config.XmlConfigurator.Configure(); 121// log4net.Config.XmlConfigurator.Configure();
122 122
123 LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); 123 LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized);
124 Assert.That(ld != null, "Deserialize(string) returned null"); 124 Assert.That(ld != null, "Deserialize(string) returned null");
diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
new file mode 100644
index 0000000..a61e4af
--- /dev/null
+++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
@@ -0,0 +1,134 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenMetaverse.StructuredData;
32using NUnit.Framework;
33using OpenSim.Framework;
34using OpenSim.Framework.Serialization.External;
35using OpenSim.Tests.Common;
36
37namespace OpenSim.Framework.Serialization.Tests
38{
39 [TestFixture]
40 public class RegionSettingsSerializerTests
41 {
42 private string m_serializedRs = @"<?xml version=""1.0"" encoding=""utf-16""?>
43<RegionSettings>
44 <General>
45 <AllowDamage>True</AllowDamage>
46 <AllowLandResell>True</AllowLandResell>
47 <AllowLandJoinDivide>True</AllowLandJoinDivide>
48 <BlockFly>True</BlockFly>
49 <BlockLandShowInSearch>True</BlockLandShowInSearch>
50 <BlockTerraform>True</BlockTerraform>
51 <DisableCollisions>True</DisableCollisions>
52 <DisablePhysics>True</DisablePhysics>
53 <DisableScripts>True</DisableScripts>
54 <MaturityRating>1</MaturityRating>
55 <RestrictPushing>True</RestrictPushing>
56 <AgentLimit>40</AgentLimit>
57 <ObjectBonus>1.4</ObjectBonus>
58 </General>
59 <GroundTextures>
60 <Texture1>00000000-0000-0000-0000-000000000020</Texture1>
61 <Texture2>00000000-0000-0000-0000-000000000040</Texture2>
62 <Texture3>00000000-0000-0000-0000-000000000060</Texture3>
63 <Texture4>00000000-0000-0000-0000-000000000080</Texture4>
64 <ElevationLowSW>1.9</ElevationLowSW>
65 <ElevationLowNW>15.9</ElevationLowNW>
66 <ElevationLowSE>49</ElevationLowSE>
67 <ElevationLowNE>45.3</ElevationLowNE>
68 <ElevationHighSW>2.1</ElevationHighSW>
69 <ElevationHighNW>4.5</ElevationHighNW>
70 <ElevationHighSE>9.2</ElevationHighSE>
71 <ElevationHighNE>19.2</ElevationHighNE>
72 </GroundTextures>
73 <Terrain>
74 <WaterHeight>23</WaterHeight>
75 <TerrainRaiseLimit>17.9</TerrainRaiseLimit>
76 <TerrainLowerLimit>0.4</TerrainLowerLimit>
77 <UseEstateSun>True</UseEstateSun>
78 <FixedSun>true</FixedSun>
79 <SunPosition>12</SunPosition>
80 </Terrain>
81</RegionSettings>";
82
83 private RegionSettings m_rs;
84
85 [SetUp]
86 public void Setup()
87 {
88 m_rs = new RegionSettings();
89 m_rs.AgentLimit = 17;
90 m_rs.AllowDamage = true;
91 m_rs.AllowLandJoinDivide = true;
92 m_rs.AllowLandResell = true;
93 m_rs.BlockFly = true;
94 m_rs.BlockShowInSearch = true;
95 m_rs.BlockTerraform = true;
96 m_rs.DisableCollisions = true;
97 m_rs.DisablePhysics = true;
98 m_rs.DisableScripts = true;
99 m_rs.Elevation1NW = 15.9;
100 m_rs.Elevation1NE = 45.3;
101 m_rs.Elevation1SE = 49;
102 m_rs.Elevation1SW = 1.9;
103 m_rs.Elevation2NW = 4.5;
104 m_rs.Elevation2NE = 19.2;
105 m_rs.Elevation2SE = 9.2;
106 m_rs.Elevation2SW = 2.1;
107 m_rs.FixedSun = true;
108 m_rs.SunPosition = 12.0;
109 m_rs.ObjectBonus = 1.4;
110 m_rs.RestrictPushing = true;
111 m_rs.TerrainLowerLimit = 0.4;
112 m_rs.TerrainRaiseLimit = 17.9;
113 m_rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020");
114 m_rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040");
115 m_rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060");
116 m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
117 m_rs.UseEstateSun = true;
118 m_rs.WaterHeight = 23;
119 }
120
121 [Test]
122 public void TestRegionSettingsDeserialize()
123 {
124 TestHelpers.InMethod();
125// log4net.Config.XmlConfigurator.Configure();
126
127 RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs);
128 Assert.That(deserRs, Is.Not.Null);
129 Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
130 Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));
131 Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit));
132 }
133 }
134}