Add regression test for setting phantom status on a scene object. This is not yet complete.

bulletsim
Justin Clark-Casey (justincc) 2011-08-05 23:42:05 +01:00
parent f18780d0e3
commit ba89fc3aa1
3 changed files with 78 additions and 13 deletions

View File

@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="objectGroup"></param> /// <param name="objectGroup"></param>
public virtual void DetachFromBackup() public virtual void DetachFromBackup()
{ {
if (m_isBackedUp) if (m_isBackedUp && Scene != null)
m_scene.EventManager.OnBackup -= ProcessBackup; m_scene.EventManager.OnBackup -= ProcessBackup;
m_isBackedUp = false; m_isBackedUp = false;
@ -2520,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectPart selectionPart = GetChildPart(localID); SceneObjectPart selectionPart = GetChildPart(localID);
if (SetTemporary) if (SetTemporary && Scene != null)
{ {
DetachFromBackup(); DetachFromBackup();
// Remove from database and parcel prim count // Remove from database and parcel prim count
@ -2532,15 +2532,19 @@ namespace OpenSim.Region.Framework.Scenes
if (selectionPart != null) if (selectionPart != null)
{ {
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
if (Scene != null)
{ {
SceneObjectPart part = parts[i]; for (int i = 0; i < parts.Length; 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 SceneObjectPart part = parts[i];
break; 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;
}
} }
} }

View File

@ -261,13 +261,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
protected SceneObjectPartInventory m_inventory; protected SceneObjectPartInventory m_inventory;
public bool Undoing; public bool Undoing;
public bool IgnoreUndoUpdate = false; public bool IgnoreUndoUpdate = false;
private PrimFlags LocalFlags; private PrimFlags LocalFlags;
private float m_damage = -1.0f; private float m_damage = -1.0f;
@ -4645,6 +4642,8 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
ScheduleFullUpdate(); ScheduleFullUpdate();
// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
} }
public void UpdateRotation(Quaternion rot) public void UpdateRotation(Quaternion rot)
@ -4864,7 +4863,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
//} //}
LocalFlags=(PrimFlags)objectflagupdate; LocalFlags = (PrimFlags)objectflagupdate;
if (m_parentGroup != null && m_parentGroup.RootPart == this) if (m_parentGroup != null && m_parentGroup.RootPart == this)
{ {

View File

@ -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
{
/// <summary>
/// Basic scene object status tests
/// </summary>
[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));
}
}
}