Add TestSetPhysics() to SOP status tests

0.7.3-extended
Justin Clark-Casey (justincc) 2012-04-21 00:54:48 +01:00
parent c1a9355865
commit 5a551b074b
3 changed files with 27 additions and 4 deletions

View File

@ -1699,6 +1699,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="isNew"></param> /// <param name="isNew"></param>
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
{ {
if (ParentGroup.Scene == null)
return;
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
return; return;
@ -4154,7 +4157,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints. // For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a // In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI. // custom checkbox in the viewer GUI.
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{ {
string hingeString = "hingejoint"; string hingeString = "hingejoint";
return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString); return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
@ -4170,7 +4173,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints. // For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a // In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI. // custom checkbox in the viewer GUI.
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{ {
string ballString = "balljoint"; string ballString = "balljoint";
return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString); return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
@ -4186,7 +4189,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints. // For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a // In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI. // custom checkbox in the viewer GUI.
if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{ {
return IsHingeJoint() || IsBallJoint(); return IsHingeJoint() || IsBallJoint();
} }

View File

@ -62,5 +62,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
} }
[Test]
public void TestSetPhysics()
{
TestHelpers.InMethod();
// Scene scene = SceneSetupHelpers.SetupScene();
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
SceneObjectPart rootPart = so.RootPart;
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
so.ScriptSetPhysicsStatus(true);
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
so.ScriptSetPhysicsStatus(false);
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
}
} }
} }