From ba89fc3aa1833c0fd6b5518d85ca966768597c6c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Aug 2011 23:42:05 +0100 Subject: Add regression test for setting phantom status on a scene object. This is not yet complete. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 22 ++++---- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++- .../Scenes/Tests/SceneObjectStatusTests.cs | 62 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 57baa99..3b6a458 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void DetachFromBackup() { - if (m_isBackedUp) + if (m_isBackedUp && Scene != null) m_scene.EventManager.OnBackup -= ProcessBackup; m_isBackedUp = false; @@ -2520,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart selectionPart = GetChildPart(localID); - if (SetTemporary) + if (SetTemporary && Scene != null) { DetachFromBackup(); // Remove from database and parcel prim count @@ -2532,15 +2532,19 @@ namespace OpenSim.Region.Framework.Scenes if (selectionPart != null) { SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) + + if (Scene != null) { - SceneObjectPart part = parts[i]; - if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || - part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || - part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) + for (int i = 0; i < parts.Length; i++) { - UsePhysics = false; // Reset physics - break; + SceneObjectPart part = parts[i]; + if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) + { + UsePhysics = false; // Reset physics + break; + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 90ad34e..e8a1070 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -261,12 +261,9 @@ namespace OpenSim.Region.Framework.Scenes } protected SceneObjectPartInventory m_inventory; - public bool Undoing; - public bool IgnoreUndoUpdate = false; - private PrimFlags LocalFlags; @@ -4645,6 +4642,8 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); + +// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); } public void UpdateRotation(Quaternion rot) @@ -4864,7 +4863,7 @@ namespace OpenSim.Region.Framework.Scenes // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; //} - LocalFlags=(PrimFlags)objectflagupdate; + LocalFlags = (PrimFlags)objectflagupdate; if (m_parentGroup != null && m_parentGroup.RootPart == this) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs new file mode 100644 index 0000000..a26fe33 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -0,0 +1,62 @@ +/* + * 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.Reflection; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Basic scene object status tests + /// + [TestFixture] + public class SceneObjectStatusTests + { + [Test] + public void TestSetPhantom() + { + TestHelper.InMethod(); + +// Scene scene = SceneSetupHelpers.SetupScene(); + SceneObjectGroup so = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); + SceneObjectPart rootPart = so.RootPart; + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + + so.RootPart.ScriptSetPhantomStatus(true); + + Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); + } + } +} \ No newline at end of file -- cgit v1.1