示例#1
0
        public void TestllGetLinkPrimitiveParams()
        {
            TestHelpers.InMethod();
            TestHelpers.EnableLogging();

            UUID ownerId = TestHelpers.ParseTail(0x1);

            SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(2, ownerId, "grp1-", 0x10);

            grp1.AbsolutePosition = new Vector3(10, 11, 12);
            m_scene.AddSceneObject(grp1);

            LSL_Api apiGrp1 = new LSL_Api();

            apiGrp1.Initialize(m_engine, grp1.RootPart, null);

            // Check simple 1 prim case
            {
                LSL_List resList
                    = apiGrp1.llGetLinkPrimitiveParams(1, new LSL_List(new LSL_Integer(ScriptBaseClass.PRIM_ROTATION)));

                Assert.That(resList.Length, Is.EqualTo(1));
            }

            // Check 2 prim case
            {
                LSL_List resList
                    = apiGrp1.llGetLinkPrimitiveParams(
                          1,
                          new LSL_List(
                              new LSL_Integer(ScriptBaseClass.PRIM_ROTATION),
                              new LSL_Integer(ScriptBaseClass.PRIM_LINK_TARGET),
                              new LSL_Integer(2),
                              new LSL_Integer(ScriptBaseClass.PRIM_ROTATION)));

                Assert.That(resList.Length, Is.EqualTo(2));
            }

            // Check invalid parameters are ignored
            {
                LSL_List resList
                    = apiGrp1.llGetLinkPrimitiveParams(3, new LSL_List(new LSL_Integer(ScriptBaseClass.PRIM_ROTATION)));

                Assert.That(resList.Length, Is.EqualTo(0));
            }

            // Check all parameters are ignored if an initial bad link is given
            {
                LSL_List resList
                    = apiGrp1.llGetLinkPrimitiveParams(
                          3,
                          new LSL_List(
                              new LSL_Integer(ScriptBaseClass.PRIM_ROTATION),
                              new LSL_Integer(ScriptBaseClass.PRIM_LINK_TARGET),
                              new LSL_Integer(1),
                              new LSL_Integer(ScriptBaseClass.PRIM_ROTATION)));

                Assert.That(resList.Length, Is.EqualTo(0));
            }

            // Check only subsequent parameters are ignored when we hit the first bad link number
            {
                LSL_List resList
                    = apiGrp1.llGetLinkPrimitiveParams(
                          1,
                          new LSL_List(
                              new LSL_Integer(ScriptBaseClass.PRIM_ROTATION),
                              new LSL_Integer(ScriptBaseClass.PRIM_LINK_TARGET),
                              new LSL_Integer(3),
                              new LSL_Integer(ScriptBaseClass.PRIM_ROTATION)));

                Assert.That(resList.Length, Is.EqualTo(1));
            }
        }