Esempio n. 1
0
        public void TestSitAndStandWithNoSitTarget()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            // Make sure we're within range to sit
            Vector3 startPos = new Vector3(1, 1, 1);

            m_sp.AbsolutePosition = startPos;

            SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;

            m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);

            // FIXME: This is different for live avatars - z position is adjusted.  This is half the height of the
            // default avatar.
            // Curiously, Vector3.ToString() will not display the last two places of the float.  For example,
            // printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
            Assert.That(
                m_sp.AbsolutePosition,
                Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));

            m_sp.StandUp();

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0));
            Assert.That(part.GetSittingAvatars(), Is.Null);
            Assert.That(m_sp.ParentID, Is.EqualTo(0));
            Assert.That(m_sp.PhysicsActor, Is.Not.Null);
        }
        public void TestUndoLimit()
        {
            TestHelpers.InMethod();

            Vector3 firstSize  = new Vector3(2, 3, 4);
            Vector3 secondSize = new Vector3(5, 6, 7);
            Vector3 thirdSize  = new Vector3(8, 9, 10);
            Vector3 fourthSize = new Vector3(11, 12, 13);

            Scene scene = new SceneHelpers().SetupScene();

            scene.MaxUndoCount = 2;
            SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);

            g1.GroupResize(firstSize);
            g1.GroupResize(secondSize);
            g1.GroupResize(thirdSize);
            g1.GroupResize(fourthSize);

            g1.RootPart.Undo();
            g1.RootPart.Undo();
            g1.RootPart.Undo();

            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
            Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
        }
Esempio n. 3
0
        public void TestRepeatSameDrawContainingImageReusingTexture()
        {
            TestHelpers.InMethod();

            string dtText
                = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png";

            SetupScene(true);
            SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);

            m_dtm.AddDynamicTextureData(
                m_scene.RegionInfo.RegionID,
                so.UUID,
                m_vrm.GetContentType(),
                dtText,
                "",
                0);

            UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;

            m_dtm.AddDynamicTextureData(
                m_scene.RegionInfo.RegionID,
                so.UUID,
                m_vrm.GetContentType(),
                dtText,
                "",
                0);

            Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
        }
Esempio n. 4
0
        public void TestRepeatSameDraw()
        {
            TestHelpers.InMethod();

            string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";

            SetupScene(false);
            SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);

            m_dtm.AddDynamicTextureData(
                m_scene.RegionInfo.RegionID,
                so.UUID,
                m_vrm.GetContentType(),
                dtText,
                "");

            UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;

            m_dtm.AddDynamicTextureData(
                m_scene.RegionInfo.RegionID,
                so.UUID,
                m_vrm.GetContentType(),
                dtText,
                "");

            Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
        }
Esempio n. 5
0
        public void TestRezObjectFromInventoryItem()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            Scene            scene = new SceneHelpers().SetupScene();
            UserAccount      user1 = UserAccountHelpers.CreateUserWithInventory(scene);
            SceneObjectGroup sog1  = SceneHelpers.CreateSceneObject(1, user1.PrincipalID);
            SceneObjectPart  sop1  = sog1.RootPart;

            // Create an object embedded inside the first
            UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
            TaskInventoryItem taskSceneObjectItem
                = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);

            scene.AddSceneObject(sog1);

            Vector3    rezPos = new Vector3(10, 10, 10);
            Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
            Vector3    rezVel = new Vector3(2, 2, 2);

            scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);

            SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso");

            Assert.That(rezzedObject, Is.Not.Null);
            Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos));

            // Velocity doesn't get applied, probably because there is no physics in tests (yet)
//            Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
            Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero));

            // Confusingly, this isn't the rezzedObject.Rotation
            Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot));
        }
Esempio n. 6
0
        public void TestAddSatOnAttachmentFromGround()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            m_numberOfAttachEventsFired = 0;

            Scene         scene = CreateTestScene();
            UserAccount   ua1   = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
            ScenePresence sp    = SceneHelpers.AddScenePresence(scene, ua1);

            string attName = "att";

            SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);

            UserAccount   ua2 = UserAccountHelpers.CreateUserWithInventory(scene, 0x2);
            ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, ua2);

            // Put avatar within 10m of the prim so that sit doesn't fail.
            sp2.AbsolutePosition = new Vector3(0, 0, 0);
            sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero);

            scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false);

            Assert.That(sp.HasAttachments(), Is.False);
            Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));

            // Check events
            Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0));
        }
Esempio n. 7
0
        public void TestResizeSceneObjectPart()
        {
            TestHelpers.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            Scene scene = new SceneHelpers().SetupScene();

            SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero);

            g1.RootPart.Scale = new Vector3(2, 3, 4);
            g1.Parts[1].Scale = new Vector3(5, 6, 7);

            scene.AddSceneObject(g1);

            SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);

            g1Post.Parts[1].Resize(new Vector3(8, 9, 10));

            SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID);

            SceneObjectPart g1RootPart  = g1PostPost.RootPart;
            SceneObjectPart g1ChildPart = g1PostPost.Parts[1];

            Assert.That(g1RootPart.Scale.X, Is.EqualTo(2));
            Assert.That(g1RootPart.Scale.Y, Is.EqualTo(3));
            Assert.That(g1RootPart.Scale.Z, Is.EqualTo(4));

            Assert.That(g1ChildPart.Scale.X, Is.EqualTo(8));
            Assert.That(g1ChildPart.Scale.Y, Is.EqualTo(9));
            Assert.That(g1ChildPart.Scale.Z, Is.EqualTo(10));
        }
        public override void SetUp()
        {
            base.SetUp();

            // This is an unfortunate bit of clean up we have to do because MainServer manages things through static
            // variables and the VM is not restarted between tests.
            uint port = 9999;

            MainServer.RemoveHttpServer(port);

            BaseHttpServer server = new BaseHttpServer(port, false, 0, "");

            MainServer.AddHttpServer(server);
            MainServer.Instance = server;

            server.Start();

            m_engine    = new MockScriptEngine();
            m_urlModule = new UrlModule();

            m_scene = new SceneHelpers().SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule);

            SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);

            m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart);

            // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
            // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
            m_lslApi = new LSL_Api();
            m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem);
        }
Esempio n. 9
0
        public void TestSitAndStandWithNoSitTarget()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));

            // FIXME: To get this to work for now, we are going to place the npc right next to the target so that
            // the autopilot doesn't trigger
            Vector3 startPos = new Vector3(1, 1, 1);

            INPCModule npcModule = scene.RequestModuleInterface <INPCModule>();
            UUID       npcId     = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance);

            ScenePresence   npc  = scene.GetScenePresence(npcId);
            SceneObjectPart part = SceneHelpers.AddSceneObject(scene);

            npcModule.Sit(npc.UUID, part.UUID, scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));

            // FIXME: This is different for live avatars - z position is adjusted.  This is half the height of the
            // default avatar.
            // Curiously, Vector3.ToString() will not display the last two places of the float.  For example,
            // printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
            Assert.That(
                npc.AbsolutePosition,
                Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));

            npcModule.Stand(npc.UUID, scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(npc.ParentID, Is.EqualTo(0));
        }
Esempio n. 10
0
        public void TestSitWithinRangeNoTarget()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            // Less than 10 meters away from 0, 0, 0 (default part position)
            Vector3 startPos = new Vector3(9.9f, 0, 0);

            m_sp.AbsolutePosition = startPos;

            SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;

            // We need to preserve this here because phys actor is removed by the sit.
            Vector3 spPhysActorSize = m_sp.PhysicsActor.Size;

            m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);

            Assert.That(m_sp.PhysicsActor, Is.Null);

            Assert.That(
                m_sp.AbsolutePosition,
                Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2)));

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
            HashSet <ScenePresence> sittingAvatars = part.GetSittingAvatars();

            Assert.That(sittingAvatars.Count, Is.EqualTo(1));
            Assert.That(sittingAvatars.Contains(m_sp));
            Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
        }
        public void TestUndoRedoResizeSceneObject()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            Vector3 firstSize  = new Vector3(2, 3, 4);
            Vector3 secondSize = new Vector3(5, 6, 7);

            Scene scene = new SceneHelpers().SetupScene();

            scene.MaxUndoCount = 20;
            SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);

            // TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG,
            // which is the way that AddSceneObject() sets up the object (i.e. it creates the SOP first).  However,
            // this is somewhat by chance.  Really, we shouldn't be storing undo states at all if the object is not
            // in a scene.
            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));

            g1.GroupResize(firstSize);
            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));

            g1.GroupResize(secondSize);
            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));

            g1.RootPart.Undo();
            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
            Assert.That(g1.GroupScale, Is.EqualTo(firstSize));

            g1.RootPart.Redo();
            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
            Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
        }
Esempio n. 12
0
        public void TestSitAndStandWithSitTarget()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));

            Vector3    startPos  = new Vector3(128, 128, 30);
            INPCModule npcModule = scene.RequestModuleInterface <INPCModule>();
            UUID       npcId     = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance);

            ScenePresence   npc  = scene.GetScenePresence(npcId);
            SceneObjectPart part = SceneHelpers.AddSceneObject(scene);

            part.SitTargetPosition = new Vector3(0, 0, 1);
            npcModule.Sit(npc.UUID, part.UUID, scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
            Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
            Assert.That(
                npc.AbsolutePosition,
                Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));

            npcModule.Stand(npc.UUID, scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(npc.ParentID, Is.EqualTo(0));
        }
Esempio n. 13
0
        public void TestSitAndStandWithSitTarget()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            // If a prim has a sit target then we can sit from any distance away
            Vector3 startPos = new Vector3(128, 128, 30);

            m_sp.AbsolutePosition = startPos;

            SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);

            part.SitTargetPosition = new Vector3(0, 0, 1);

            m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID));
            Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
            Assert.That(
                m_sp.AbsolutePosition,
                Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
            Assert.That(m_sp.PhysicsActor, Is.Null);

            m_sp.StandUp();

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(m_sp.ParentID, Is.EqualTo(0));
            Assert.That(m_sp.PhysicsActor, Is.Not.Null);
        }
Esempio n. 14
0
        public void TestSitAndStandWithNoSitTarget()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            SetUpScene();

            ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));

            // FIXME: To get this to work for now, we are going to place the npc right next to the target so that
            // the autopilot doesn't trigger
            Vector3 startPos = new Vector3(1, 1, 1);

            UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);

            ScenePresence   npc  = m_scene.GetScenePresence(npcId);
            SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;

            m_npcMod.Sit(npc.UUID, part.UUID, m_scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));

            // We should really be using the NPC size but this would mean preserving the physics actor since it is
            // removed on sit.
            Assert.That(
                npc.AbsolutePosition,
                Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, sp.PhysicsActor.Size.Z / 2)));

            m_npcMod.Stand(npc.UUID, m_scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(npc.ParentID, Is.EqualTo(0));
        }
Esempio n. 15
0
        public void TestSitAndStandWithSitTarget()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            SetUpScene();

            ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));

            Vector3 startPos = new Vector3(128, 128, 30);
            UUID    npcId    = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);

            ScenePresence   npc  = m_scene.GetScenePresence(npcId);
            SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;

            part.SitTargetPosition = new Vector3(0, 0, 1);
            m_npcMod.Sit(npc.UUID, part.UUID, m_scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
            Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
//            Assert.That(
//                npc.AbsolutePosition,
//                Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));

            m_npcMod.Stand(npc.UUID, m_scene);

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(npc.ParentID, Is.EqualTo(0));
        }
        public void TestDeleteSceneObjectAsync()
        {
            TestHelpers.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");

            TestScene scene = SceneHelpers.SetupScene();

            // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
            AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;

            sogd.Enabled = false;

            SceneObjectPart part = SceneHelpers.AddSceneObject(scene);

            IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;

            scene.DeRezObjects(client, new System.Collections.Generic.List <uint>()
            {
                part.LocalId
            }, UUID.Zero, DeRezAction.Delete, UUID.Zero);

            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart, Is.Not.Null);

            sogd.InventoryDeQueueAndDelete();

            SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart2, Is.Null);
        }
        public void TestRedoBeyondAvailable()
        {
            TestHelpers.InMethod();

            Vector3 newSize = new Vector3(2, 3, 4);

            Scene scene = new SceneHelpers().SetupScene();

            scene.MaxUndoCount = 20;
            SceneObjectGroup g1           = SceneHelpers.AddSceneObject(scene);
            Vector3          originalSize = g1.GroupScale;

            g1.RootPart.Redo();

            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
            Assert.That(g1.GroupScale, Is.EqualTo(originalSize));

            g1.GroupResize(newSize);
            g1.RootPart.Undo();
            g1.RootPart.Redo();
            g1.RootPart.Redo();

            Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
            Assert.That(g1.GroupScale, Is.EqualTo(newSize));
        }
Esempio n. 18
0
        public void TestNoTelehubSceneObject()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            EstateManagementModule emm = new EstateManagementModule();

            SceneHelpers sh    = new SceneHelpers();
            Scene        scene = sh.SetupScene();

            SceneHelpers.SetupSceneModules(scene, emm);

            UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);

            SceneObjectGroup telehubSo    = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
            SceneObjectGroup spawnPointSo = SceneHelpers.AddSceneObject(scene, "spawnpointObject", telehubSceneObjectOwner);

            emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
            emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "spawnpoint add", spawnPointSo.LocalId);
            scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;

            scene.DeleteSceneObject(telehubSo, false);

            // Must still be possible to successfully log in
            UUID loggingInUserId = TestHelpers.ParseTail(0x2);

            UserAccount ua
                = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");

            SceneHelpers.AddScenePresence(scene, ua);

            Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
        }
Esempio n. 19
0
        public void TestSitAndStandWithNoSitTargetChildPrim()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            // Make sure we're within range to sit
            Vector3 startPos = new Vector3(1, 1, 1);

            m_sp.AbsolutePosition = startPos;

            SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene, 2, m_sp.UUID, "part", 0x10).Parts[1];

            part.OffsetPosition = new Vector3(2, 3, 4);

            // We need to preserve this here because phys actor is removed by the sit.
            Vector3 spPhysActorSize = m_sp.PhysicsActor.Size;

            m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);

            Assert.That(
                m_sp.AbsolutePosition,
                Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2)));

            m_sp.StandUp();

            Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
            Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0));
            Assert.That(part.GetSittingAvatars(), Is.Null);
            Assert.That(m_sp.ParentID, Is.EqualTo(0));
            Assert.That(m_sp.PhysicsActor, Is.Not.Null);
        }
        public void TestAddAttachmentFromGround()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            AddPresence();
            string attName = "att";

            SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup;

            m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false);

            // Check status on scene presence
            Assert.That(m_presence.HasAttachments(), Is.True);
            List <SceneObjectGroup> attachments = m_presence.GetAttachments();

            Assert.That(attachments.Count, Is.EqualTo(1));
            SceneObjectGroup attSo = attachments[0];

            Assert.That(attSo.Name, Is.EqualTo(attName));
            Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
            Assert.That(attSo.IsAttachment);
            Assert.That(attSo.UsesPhysics, Is.False);
            Assert.That(attSo.IsTemporary, Is.False);

            // Check item status
            Assert.That(m_presence.Appearance.GetAttachpoint(
                            attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest));
        }
Esempio n. 21
0
        public void TestOsForceAttachToOtherAvatarFromInventory()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            string          taskInvObjItemName = "sphere";
            UUID            taskInvObjItemId   = UUID.Parse("00000000-0000-0000-0000-100000000000");
            AttachmentPoint attachPoint        = AttachmentPoint.Chin;

            UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "one", 0x1, "pass");
            UserAccount ua2 = UserAccountHelpers.CreateUserWithInventory(m_scene, "user", "two", 0x2, "pass");

            ScenePresence     sp         = SceneHelpers.AddScenePresence(m_scene, ua1);
            SceneObjectGroup  inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
            TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);

            new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
            OSSL_Api osslApi = new OSSL_Api();

            osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);

            // Create an object embedded inside the first
            TaskInventoryHelpers.AddSceneObject(
                m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);

            ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2);

            osslApi.osForceAttachToOtherAvatarFromInventory(sp2.UUID.ToString(), taskInvObjItemName, (int)attachPoint);

            // Check scene presence status
            Assert.That(sp.HasAttachments(), Is.False);
            List <SceneObjectGroup> attachments = sp.GetAttachments();

            Assert.That(attachments.Count, Is.EqualTo(0));

            Assert.That(sp2.HasAttachments(), Is.True);
            List <SceneObjectGroup> attachments2 = sp2.GetAttachments();

            Assert.That(attachments2.Count, Is.EqualTo(1));
            SceneObjectGroup attSo = attachments2[0];

            Assert.That(attSo.Name, Is.EqualTo(taskInvObjItemName));
            Assert.That(attSo.OwnerID, Is.EqualTo(ua2.PrincipalID));
            Assert.That(attSo.AttachmentPoint, Is.EqualTo((uint)attachPoint));
            Assert.That(attSo.IsAttachment);
            Assert.That(attSo.UsesPhysics, Is.False);
            Assert.That(attSo.IsTemporary, Is.False);

            // Check appearance status
            List <AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments();

            Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0));

            List <AvatarAttachment> attachmentsInAppearance2 = sp2.Appearance.GetAttachments();

            Assert.That(attachmentsInAppearance2.Count, Is.EqualTo(1));
            Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint));
        }
Esempio n. 22
0
        public void TestTakeCopyWhenCopierIsNotOwnerWithPerms()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");

            TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);

            SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
            UserAccount ua     = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
            TestClient  client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;

            // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
            AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;

            sogd.Enabled = false;

            SceneObjectGroup so        = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
            uint             soLocalId = so.LocalId;

            // Base must allow transfer and copy
            so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
            // Must be set so anyone can copy
            so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;

            List <uint> localIds = new List <uint>();

            localIds.Add(so.LocalId);

            // Specifying a UUID.Zero in this case will plop it in the Objects folder
            scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);

            // Check that object isn't copied until we crank the sogd handle.
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);

            Assert.That(retrievedPart, Is.Not.Null);
            Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);

            sogd.InventoryDeQueueAndDelete();

            // Check that object is still there.
            SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);

            Assert.That(retrievedPart2, Is.Not.Null);
            Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));

            // Check that we have a copy in inventory
            InventoryItemBase item
                = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");

            Assert.That(item, Is.Not.Null);
        }
        public void TestCrossOnSameSimulatorPrimLimitsOkay()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            UUID userId            = TestHelpers.ParseTail(0x1);
            int  sceneObjectIdTail = 0x2;

            EntityTransferModule           etmA = new EntityTransferModule();
            EntityTransferModule           etmB = new EntityTransferModule();
            LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
            LandManagementModule           lmmA = new LandManagementModule();
            LandManagementModule           lmmB = new LandManagementModule();

            IConfigSource config        = new IniConfigSource();
            IConfig       modulesConfig = config.AddConfig("Modules");

            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);

            IConfig permissionsConfig = config.AddConfig("Permissions");

            permissionsConfig.Set("permissionmodules", "PrimLimitsModule");

            SceneHelpers sh     = new SceneHelpers();
            TestScene    sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene    sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(
                sceneA, config, etmA, lmmA, new PrimLimitsModule(), new PrimCountModule());
            SceneHelpers.SetupSceneModules(
                sceneB, config, etmB, lmmB, new PrimLimitsModule(), new PrimCountModule());

            // We must set up the parcel for this to work.  Normally this is taken care of by OpenSimulator startup
            // code which is not yet easily invoked by tests.
            lmmA.EventManagerOnNoLandDataFromStorage();
            lmmB.EventManagerOnNoLandDataFromStorage();

            SceneObjectGroup so1   = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
            UUID             so1Id = so1.UUID;

            so1.AbsolutePosition = new Vector3(128, 10, 20);

            // Cross with a negative value.  We must make this call rather than setting AbsolutePosition directly
            // because only this will execute permission checks in the source region.
            sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId);

            // crossing is async
            Thread.Sleep(500);

            Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id));
            Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id));
        }
        public void TestAddAttachmentFromGround()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            m_numberOfAttachEventsFired = 0;

            Scene         scene = CreateTestScene();
            UserAccount   ua1   = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
            ScenePresence sp    = SceneHelpers.AddScenePresence(scene, ua1);

            string attName = "att";

            SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);

            Assert.That(so.Backup, Is.True);

            m_numberOfAttachEventsFired = 0;
            scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false);

            // Check status on scene presence
            Assert.That(sp.HasAttachments(), Is.True);
            List <SceneObjectGroup> attachments = sp.GetAttachments();

            Assert.That(attachments.Count, Is.EqualTo(1));
            SceneObjectGroup attSo = attachments[0];

            Assert.That(attSo.Name, Is.EqualTo(attName));
            Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
            Assert.That(attSo.IsAttachment);
            Assert.That(attSo.UsesPhysics, Is.False);
            Assert.That(attSo.IsTemporary, Is.False);
            Assert.That(attSo.Backup, Is.False);

            // Check item status
            Assert.That(
                sp.Appearance.GetAttachpoint(attSo.FromItemID),
                Is.EqualTo((int)AttachmentPoint.Chest));

            InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));

            Assert.That(attachmentItem, Is.Not.Null);
            Assert.That(attachmentItem.Name, Is.EqualTo(attName));

            InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object);

            Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));

            Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));

            // Check events
            Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
        }
        public void TestDeleteSceneObject()
        {
            TestHelpers.InMethod();

            TestScene       scene = SceneHelpers.SetupScene();
            SceneObjectPart part  = SceneHelpers.AddSceneObject(scene);

            scene.DeleteSceneObject(part.ParentGroup, false);

            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart, Is.Null);
        }
Esempio n. 26
0
        public void TestDeRezSceneObjectToAgents()
        {
            TestHelpers.InMethod();
            //            TestHelpers.EnableLogging();

            SceneHelpers sh     = new SceneHelpers();
            TestScene    sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene    sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);

            // We need this so that the creation of the root client for userB in sceneB can trigger the creation of a child client in sceneA
            LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
            EntityTransferModule           etmB = new EntityTransferModule();
            IConfigSource config        = new IniConfigSource();
            IConfig       modulesConfig = config.AddConfig("Modules");

            modulesConfig.Set("EntityTransferModule", etmB.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);
            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(sceneB, config, etmB);

            // We need this for derez
            SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule());

            UserAccount uaA = UserAccountHelpers.CreateUserWithInventory(sceneA, "Andy", "AAA", 0x1, "");
            UserAccount uaB = UserAccountHelpers.CreateUserWithInventory(sceneA, "Brian", "BBB", 0x2, "");

            TestClient clientA = (TestClient)SceneHelpers.AddScenePresence(sceneA, uaA).ControllingClient;

            // This is the more long-winded route we have to take to get a child client created for userB in sceneA
            // rather than just calling AddScenePresence() as for userA
            AgentCircuitData  acd           = SceneHelpers.GenerateAgentData(uaB);
            TestClient        clientB       = new TestClient(acd, sceneB);
            List <TestClient> childClientsB = new List <TestClient>();

            EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(clientB, childClientsB);

            SceneHelpers.AddScenePresence(sceneB, clientB, acd);

            SceneObjectGroup so        = SceneHelpers.AddSceneObject(sceneA);
            uint             soLocalId = so.LocalId;

            sceneA.DeleteSceneObject(so, false);

            Assert.That(clientA.ReceivedKills.Count, Is.EqualTo(1));
            Assert.That(clientA.ReceivedKills[0], Is.EqualTo(soLocalId));

            Assert.That(childClientsB[0].ReceivedKills.Count, Is.EqualTo(1));
            Assert.That(childClientsB[0].ReceivedKills[0], Is.EqualTo(soLocalId));
        }
        public void TestLlRemoteLoadScriptPin()
        {
            TestHelpers.InMethod();
            //                        TestHelpers.EnableLogging();

            UUID user1Id = TestHelpers.ParseTail(0x1);
            UUID user2Id = TestHelpers.ParseTail(0x2);

            SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, "sourceSo", user1Id);

            m_scene.AddSceneObject(sourceSo);
            LSL_Api api = new LSL_Api();

            api.Initialize(m_engine, sourceSo.RootPart, null);
            TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World");

            SceneObjectGroup targetSo           = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
            SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id);

            // Test that we cannot load a script when the target pin has never been set (i.e. it is zero)
            api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 0, 0, 0);
            Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));

            // Test that we cannot load a script when the given pin does not match the target
            targetSo.RootPart.ScriptAccessPin = 5;
            api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
            Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));

            // Test that we cannot load into a prim with a different owner
            otherOwnedTargetSo.RootPart.ScriptAccessPin = 3;
            api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
            Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));

            // Test that we can load a script when given pin and dest pin match.
            targetSo.RootPart.ScriptAccessPin = 3;
            api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
            TaskInventoryItem insertedItem = targetSo.RootPart.Inventory.GetInventoryItem("script");

            Assert.IsNotNull(insertedItem);

            // Test that we can no longer load if access pin is unset
            targetSo.RootPart.Inventory.RemoveInventoryItem(insertedItem.ItemID);
            Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));

            targetSo.RootPart.ScriptAccessPin = 0;
            api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
            Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
        }
Esempio n. 28
0
        public void TestDeleteSceneObject()
        {
            TestHelpers.InMethod();

            TestScene        scene = new SceneHelpers().SetupScene();
            SceneObjectGroup so    = SceneHelpers.AddSceneObject(scene);

            Assert.That(so.IsDeleted, Is.False);
            uint retrievedPartID = so.LocalId;

            scene.DeleteSceneObject(so, false);

            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(retrievedPartID);

            Assert.That(retrievedPart, Is.Null);
        }
Esempio n. 29
0
        public void TestResizeSceneObject()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            Scene            scene = new SceneHelpers().SetupScene();
            SceneObjectGroup g1    = SceneHelpers.AddSceneObject(scene);

            g1.GroupResize(new Vector3(2, 3, 4));

            SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);

            Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
            Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
            Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
        }
Esempio n. 30
0
        public void TestOsForceAttachToAvatarFromInventoryNotObject()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            string          taskInvObjItemName = "sphere";
            UUID            taskInvObjItemId   = UUID.Parse("00000000-0000-0000-0000-100000000000");
            AttachmentPoint attachPoint        = AttachmentPoint.Chin;

            UserAccount       ua1        = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
            ScenePresence     sp         = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
            SceneObjectGroup  inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
            TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart);

            new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
            OSSL_Api osslApi = new OSSL_Api();

            osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);

            // Create an object embedded inside the first
            TaskInventoryHelpers.AddNotecard(
                m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!");

            bool exceptionCaught = false;

            try
            {
                osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint);
            }
            catch (Exception)
            {
                exceptionCaught = true;
            }

            Assert.That(exceptionCaught, Is.True);

            // Check scene presence status
            Assert.That(sp.HasAttachments(), Is.False);
            List <SceneObjectGroup> attachments = sp.GetAttachments();

            Assert.That(attachments.Count, Is.EqualTo(0));

            // Check appearance status
            List <AvatarAttachment> attachmentsInAppearance = sp.Appearance.GetAttachments();

            Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0));
        }