public void TestllBreakLink() { TestHelpers.InMethod(); UUID ownerId = TestHelpers.ParseTail(0x1); SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(2, ownerId, "grp1-", 0x10); grp1.AbsolutePosition = new Vector3(10, 10, 10); m_scene.AddSceneObject(grp1); // FIXME: This should really be a script item (with accompanying script) TaskInventoryItem grp1Item = TaskInventoryHelpers.AddNotecard( m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; LSL_Api apiGrp1 = new LSL_Api(); apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); apiGrp1.llBreakLink(2); Assert.That(grp1.Parts.Length, Is.EqualTo(1)); SceneObjectGroup grp2 = m_scene.GetSceneObjectGroup("grp1-Part1"); Assert.That(grp2, Is.Not.Null); }
public void TestMoveTaskInventoryItem() { 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; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard( scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; // Perform test string message; scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID, out message); InventoryItemBase ncUserItem = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); }
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)); }
public void TestLlGetNotecardLine() { TestHelpers.InMethod(); string[] ncLines = { "One", "Twoè", "Three" }; TaskInventoryItem ncItem = TaskInventoryHelpers.AddNotecard(m_scene.AssetService, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); AssertValidNotecardLine(ncItem.Name, 3, ScriptBaseClass.EOF); AssertValidNotecardLine(ncItem.Name, 4, ScriptBaseClass.EOF); // XXX: Is this correct or do we really expect no dataserver event to fire at all? AssertValidNotecardLine(ncItem.Name, -1, ""); AssertValidNotecardLine(ncItem.Name, -2, ""); }
public void TestMoveTaskInventoryItemNoParent() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); // Perform test scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); InventoryItemBase ncUserItem = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); }
public void TestllCreateLink() { TestHelpers.InMethod(); UUID ownerId = TestHelpers.ParseTail(0x1); SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(2, ownerId, "grp1-", 0x10); grp1.AbsolutePosition = new Vector3(10, 10, 10); m_scene.AddSceneObject(grp1); // FIXME: This should really be a script item (with accompanying script) TaskInventoryItem grp1Item = TaskInventoryHelpers.AddNotecard( m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); grp2.AbsolutePosition = new Vector3(20, 20, 20); // <180,0,0> grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); m_scene.AddSceneObject(grp2); LSL_Api apiGrp1 = new LSL_Api(); apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item); apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); Assert.That(grp1.Parts.Length, Is.EqualTo(4)); Assert.That(grp2.IsDeleted, Is.True); }