From 23d478f2fa06d1dedabfb24cf6ff763b586173ce Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sun, 9 Aug 2009 02:01:21 -0500 Subject: Adding in Reflection-based testing, to ensure that all properties are covered. --- OpenSim/Data/Tests/BasicRegionTest.cs | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'OpenSim/Data/Tests/BasicRegionTest.cs') diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 836da78..a746ef0 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs @@ -532,6 +532,53 @@ namespace OpenSim.Data.Tests Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration), "Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration))"); } } + + [Test] + public void T016_RandomSogWithSceneParts() + { + UUID tmpSog = UUID.Random(); + UUID tmp1 = UUID.Random(); + UUID tmp2 = UUID.Random(); + UUID tmp3 = UUID.Random(); + UUID newregion = UUID.Random(); + SceneObjectPart p1 = new SceneObjectPart(); + SceneObjectPart p2 = new SceneObjectPart(); + SceneObjectPart p3 = new SceneObjectPart(); + p1.Shape = PrimitiveBaseShape.Default; + p2.Shape = PrimitiveBaseShape.Default; + p3.Shape = PrimitiveBaseShape.Default; + ScrambleForTesting.Scramble(p1); + ScrambleForTesting.Scramble(p2); + ScrambleForTesting.Scramble(p3); + p1.UUID = tmp1; + p2.UUID = tmp2; + p3.UUID = tmp3; + SceneObjectGroup sog = NewSOG("Sop 0", tmpSog, newregion); + ScrambleForTesting.Scramble(sog); + sog.UUID = tmpSog; + sog.AddPart(p1); + sog.AddPart(p2); + sog.AddPart(p3); + + SceneObjectPart[] parts = sog.GetParts(); + Assert.That(parts.Length, Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); + + db.StoreObject(sog, newregion); + List sogs = db.LoadObjects(newregion); + Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); + SceneObjectGroup newsog = sogs[0]; + + SceneObjectPart[] newparts = newsog.GetParts(); + Assert.That(newparts.Length, Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); + + Assert.That(newsog, Constraints.PropertyCompareConstraint(sog) + .IgnoreProperty(x=>x.LocalId) + .IgnoreProperty(x=>x.HasGroupChanged) + .IgnoreProperty(x=>x.IsSelected) + .IgnoreProperty(x=>x.RegionHandle) + .IgnoreProperty(x=>x.Scene) + .IgnoreProperty(x=>x.RootPart.InventorySerial)); + } [Test] public void T020_PrimInventoryEmpty() -- cgit v1.1 From f6251ce810e0bebe68d08a8e4b20a9dfc3fe1af6 Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sat, 15 Aug 2009 06:08:36 -0500 Subject: * Modified SQLite/SQLiteInventoryStore.cs to not throw if the inventory row does not exist, to match the mysql behavior. * Modified SQLite/SQLiteRegionData.cs to only persist temporary items following the same rules mysql uses. * Added another ignore to the inventory test that was missing. * Added a few more ignores to the RegionTest that the first version of my test were missing. * Added ignoring the root Folder ID, which is set by the inventory system. * Added several improvements to the PropertyCompareConstraint: Protection against infinite loops, added IComparable (for UUID) and moved IComparable before the property matching. * Fixed a bug where I was saving the inside of the ignore expression instead of the outside of it. --- OpenSim/Data/Tests/BasicRegionTest.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Data/Tests/BasicRegionTest.cs') diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index a746ef0..8373922 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs @@ -576,8 +576,10 @@ namespace OpenSim.Data.Tests .IgnoreProperty(x=>x.HasGroupChanged) .IgnoreProperty(x=>x.IsSelected) .IgnoreProperty(x=>x.RegionHandle) + .IgnoreProperty(x=>x.RegionUUID) .IgnoreProperty(x=>x.Scene) - .IgnoreProperty(x=>x.RootPart.InventorySerial)); + .IgnoreProperty(x=>x.Children) + .IgnoreProperty(x=>x.RootPart)); } [Test] -- cgit v1.1 From dd78c250aed0924d06e28a826c2ad565ca232045 Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sun, 16 Aug 2009 03:35:31 -0500 Subject: * Added Expression based ignores to the PropertyScrambler, which makes a lot of the tests clearer because I'm not constantly resetting properties. --- OpenSim/Data/Tests/BasicRegionTest.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'OpenSim/Data/Tests/BasicRegionTest.cs') diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 8373922..8474921 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs @@ -71,14 +71,7 @@ namespace OpenSim.Data.Tests public void SuperInit() { - try - { - XmlConfigurator.Configure(); - } - catch (Exception) - { - // I don't care, just leave log4net off - } + OpenSim.Tests.Common.TestLogging.LogToConsole(); region1 = UUID.Random(); region3 = UUID.Random(); @@ -536,6 +529,9 @@ namespace OpenSim.Data.Tests [Test] public void T016_RandomSogWithSceneParts() { + PropertyScrambler scrambler = + new PropertyScrambler() + .DontScramble(x => x.UUID); UUID tmpSog = UUID.Random(); UUID tmp1 = UUID.Random(); UUID tmp2 = UUID.Random(); @@ -547,14 +543,18 @@ namespace OpenSim.Data.Tests p1.Shape = PrimitiveBaseShape.Default; p2.Shape = PrimitiveBaseShape.Default; p3.Shape = PrimitiveBaseShape.Default; - ScrambleForTesting.Scramble(p1); - ScrambleForTesting.Scramble(p2); - ScrambleForTesting.Scramble(p3); p1.UUID = tmp1; p2.UUID = tmp2; p3.UUID = tmp3; + scrambler.Scramble(p1); + scrambler.Scramble(p2); + scrambler.Scramble(p3); + SceneObjectGroup sog = NewSOG("Sop 0", tmpSog, newregion); - ScrambleForTesting.Scramble(sog); + PropertyScrambler sogScrambler = + new PropertyScrambler() + .DontScramble(x => x.UUID); + sogScrambler.Scramble(sog); sog.UUID = tmpSog; sog.AddPart(p1); sog.AddPart(p2); -- cgit v1.1