* Extend update test to test situation where it also moves the folder
* Correct logic so that update folder behaves as expected0.6.1-post-fixes
parent
b1f018aa26
commit
71960f17bc
|
@ -415,6 +415,12 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
|
|
||||||
if (m_hasReceivedInventory)
|
if (m_hasReceivedInventory)
|
||||||
{
|
{
|
||||||
|
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
|
||||||
|
|
||||||
|
// Delegate movement if updated parent id isn't the same as the existing parentId
|
||||||
|
if (folder.ParentID != parentID)
|
||||||
|
MoveFolder(folderID, parentID);
|
||||||
|
|
||||||
InventoryFolderBase baseFolder = new InventoryFolderBase();
|
InventoryFolderBase baseFolder = new InventoryFolderBase();
|
||||||
baseFolder.Owner = m_userProfile.ID;
|
baseFolder.Owner = m_userProfile.ID;
|
||||||
baseFolder.ID = folderID;
|
baseFolder.ID = folderID;
|
||||||
|
@ -432,13 +438,8 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
m_commsManager.InventoryService.UpdateFolder(baseFolder);
|
m_commsManager.InventoryService.UpdateFolder(baseFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
|
|
||||||
if (folder != null)
|
|
||||||
{
|
|
||||||
folder.Name = name;
|
folder.Name = name;
|
||||||
folder.Type = (short)type;
|
folder.Type = (short)type;
|
||||||
folder.ParentID = parentID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,6 +142,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
||||||
|
|
||||||
// 1: Test updates that don't involve moving the folder
|
// 1: Test updates that don't involve moving the folder
|
||||||
|
{
|
||||||
string newFolderName1 = "newFolderName1";
|
string newFolderName1 = "newFolderName1";
|
||||||
ushort folderType1 = (ushort)AssetType.Texture;
|
ushort folderType1 = (ushort)AssetType.Texture;
|
||||||
userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
|
userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
|
||||||
|
@ -155,6 +156,32 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
|
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2: Test an update that also involves moving the folder
|
||||||
|
{
|
||||||
|
UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061");
|
||||||
|
userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
|
||||||
|
InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
|
||||||
|
|
||||||
|
string newFolderName2 = "newFolderName2";
|
||||||
|
ushort folderType2 = (ushort)AssetType.Bodypart;
|
||||||
|
userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id);
|
||||||
|
|
||||||
|
InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id);
|
||||||
|
Assert.That(newFolderName2, Is.EqualTo(folder1.Name));
|
||||||
|
Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type));
|
||||||
|
Assert.That(folder2Id, Is.EqualTo(folder1.ParentID));
|
||||||
|
|
||||||
|
Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
|
||||||
|
Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
|
||||||
|
|
||||||
|
InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
|
||||||
|
Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
|
||||||
|
Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
|
||||||
|
Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test moving an inventory folder
|
/// Test moving an inventory folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue