From 6c252a0fa1342ea71bf7d2d0a417d9ff6ddea1b3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Feb 2012 00:55:03 +0000 Subject: Add TestRegionSettingsDeserialize --- .../Serialization/Tests/LandDataSerializerTests.cs | 2 +- .../Tests/RegionSettingsSerializerTests.cs | 134 +++++++++++++++++++++ 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs (limited to 'OpenSim/Framework') 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 public void TestLandDataDeserializeNoAccessLists() { TestHelpers.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); 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 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using NUnit.Framework; +using OpenSim.Framework; +using OpenSim.Framework.Serialization.External; +using OpenSim.Tests.Common; + +namespace OpenSim.Framework.Serialization.Tests +{ + [TestFixture] + public class RegionSettingsSerializerTests + { + private string m_serializedRs = @" + + + True + True + True + True + True + True + True + True + True + 1 + True + 40 + 1.4 + + + 00000000-0000-0000-0000-000000000020 + 00000000-0000-0000-0000-000000000040 + 00000000-0000-0000-0000-000000000060 + 00000000-0000-0000-0000-000000000080 + 1.9 + 15.9 + 49 + 45.3 + 2.1 + 4.5 + 9.2 + 19.2 + + + 23 + 17.9 + 0.4 + True + true + 12 + +"; + + private RegionSettings m_rs; + + [SetUp] + public void Setup() + { + m_rs = new RegionSettings(); + m_rs.AgentLimit = 17; + m_rs.AllowDamage = true; + m_rs.AllowLandJoinDivide = true; + m_rs.AllowLandResell = true; + m_rs.BlockFly = true; + m_rs.BlockShowInSearch = true; + m_rs.BlockTerraform = true; + m_rs.DisableCollisions = true; + m_rs.DisablePhysics = true; + m_rs.DisableScripts = true; + m_rs.Elevation1NW = 15.9; + m_rs.Elevation1NE = 45.3; + m_rs.Elevation1SE = 49; + m_rs.Elevation1SW = 1.9; + m_rs.Elevation2NW = 4.5; + m_rs.Elevation2NE = 19.2; + m_rs.Elevation2SE = 9.2; + m_rs.Elevation2SW = 2.1; + m_rs.FixedSun = true; + m_rs.SunPosition = 12.0; + m_rs.ObjectBonus = 1.4; + m_rs.RestrictPushing = true; + m_rs.TerrainLowerLimit = 0.4; + m_rs.TerrainRaiseLimit = 17.9; + m_rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020"); + m_rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040"); + m_rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060"); + m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); + m_rs.UseEstateSun = true; + m_rs.WaterHeight = 23; + } + + [Test] + public void TestRegionSettingsDeserialize() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs); + Assert.That(deserRs, Is.Not.Null); + Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); + Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); + Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); + } + } +} -- cgit v1.1