From cf42fcd978601a315ac1eb9599ab169f14fc9a8d Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Wed, 24 Aug 2011 20:21:51 -0500 Subject: llSetPrimitiveParams correct prim hollow for cases where limit should be 70%. Signed-off-by: BlueWall --- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 75 ++++++++++++++++++---- 1 file changed, 64 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 623c82d..8cd1e84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -182,6 +182,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Vector3.Zero) { Name = obj1Name, UUID = objUuid }; Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); + // Note that prim hollow check is passed with the other prim params in order to allow the + // specification of a different check value from the prim param. A cylinder, prism, sphere, + // torus or ring, with a hole shape of square, is limited to a hollow of 70%. Test 5 below + // specifies a value of 95% and checks to see if 70% was properly returned. + // Test a sphere. CheckllSetPrimitiveParams( "test 1", // Prim test identification string @@ -191,7 +196,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut 0.80d, // Prim hollow new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist - new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple + new LSL_Types.Vector3(0.32d, 0.76d, 0.0d), // Prim dimple + 0.80d); // Prim hollow check // Test a prism. CheckllSetPrimitiveParams( @@ -203,7 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests 0.90d, // Prim hollow new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper - new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + 0.90d); // Prim hollow check // Test a box. CheckllSetPrimitiveParams( @@ -212,10 +219,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests ScriptBaseClass.PRIM_TYPE_BOX, // Prim type ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut - 0.90d, // Prim hollow + 0.95d, // Prim hollow new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper - new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + 0.95d); // Prim hollow check // Test a tube. CheckllSetPrimitiveParams( @@ -232,13 +240,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper 1.0d, // Prim revolutions 1.0d, // Prim radius - 0.0d); // Prim skew + 0.0d, // Prim skew + 0.00d); // Prim hollow check + + // Test a prism. + CheckllSetPrimitiveParams( + "test 5", // Prim test identification string + new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size + ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type + ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.95d, // Prim hollow + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + 0.70d); // Prim hollow check + + // Test a sculpted prim. + CheckllSetPrimitiveParams( + "test 6", // Prim test identification string + new LSL_Types.Vector3(2.0d, 2.0d, 2.0d), // Prim size + ScriptBaseClass.PRIM_TYPE_SCULPT, // Prim type + "be293869-d0d9-0a69-5989-ad27f1946fd4", // Prim map + ScriptBaseClass.PRIM_SCULPT_TYPE_SPHERE); // Prim sculpt type } // Set prim params for a box, cylinder or prism and check results. public void CheckllSetPrimitiveParams(string primTest, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, - double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear, + double primHollowCheck) { // Set the prim params. m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, @@ -256,7 +287,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); - Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); @@ -266,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // Set prim params for a sphere and check results. public void CheckllSetPrimitiveParams(string primTest, LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, - double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple, double primHollowCheck) { // Set the prim params. m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, @@ -284,7 +315,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); - Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); @@ -295,7 +326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, - double primRev, double primRadius, double primSkew) + double primRev, double primRadius, double primSkew, double primHollowCheck) { // Set the prim params. m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, @@ -314,7 +345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); - Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + Assert.AreEqual(primHollowCheck, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); @@ -329,6 +360,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests "TestllSetPrimitiveParams " + primTest + " prim skew fail"); } + // Set prim params for a sculpted prim and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, string primMap, int primSculptType) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primMap, primSculptType)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Validate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primMap, (string)m_lslApi.llList2String(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim map check fail"); + Assert.AreEqual(primSculptType, m_lslApi.llList2Integer(primParams, 3), + "TestllSetPrimitiveParams " + primTest + " prim type scuplt check fail"); + } + public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) { // Check each vector component against expected result. -- cgit v1.1