Easier to differentiate between items in the shared #RLV folder and attached items that are not in the shared folder Minor internal refactoring Updated tests
63 lines
2.6 KiB
C#
63 lines
2.6 KiB
C#
using Moq;
|
|
|
|
namespace LibreMetaverse.RLV.Tests.Restrictions
|
|
{
|
|
public class AddAttachRestrictionTests : RestrictionsBase
|
|
{
|
|
#region @addattach[:<attach_point_name>]=<y/n>
|
|
[Fact]
|
|
public async Task AddAttach()
|
|
{
|
|
var sampleTree = SampleInventoryTree.BuildInventoryTree();
|
|
var sharedFolder = sampleTree.Root;
|
|
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedTo = RlvAttachmentPoint.Chin;
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedPrimId = new Guid("11111111-0001-4aaa-8aaa-ffffffffffff");
|
|
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedTo = RlvAttachmentPoint.Chin;
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedPrimId = new Guid("11111111-0003-4aaa-8aaa-ffffffffffff");
|
|
|
|
var inventoryMap = new InventoryMap(sharedFolder, []);
|
|
_queryCallbacks.Setup(e =>
|
|
e.TryGetInventoryMapAsync(default)
|
|
).ReturnsAsync((true, inventoryMap));
|
|
|
|
Assert.True(await _rlv.ProcessMessage("@addattach=n", _sender.Id, _sender.Name));
|
|
|
|
// #RLV/Clothing/Hats/Fancy Hat
|
|
Assert.False(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_Hats_FancyHat_Chin, true));
|
|
|
|
// #RLV/Clothing/Happy Shirt
|
|
Assert.False(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_HappyShirt, true));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task AddAttach_Specific()
|
|
{
|
|
var sampleTree = SampleInventoryTree.BuildInventoryTree();
|
|
var sharedFolder = sampleTree.Root;
|
|
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedTo = RlvAttachmentPoint.Groin;
|
|
sampleTree.Root_Clothing_HappyShirt.AttachedPrimId = new Guid("11111111-0001-4aaa-8aaa-ffffffffffff");
|
|
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedTo = RlvAttachmentPoint.Chin;
|
|
sampleTree.Root_Clothing_Hats_FancyHat_Chin.AttachedPrimId = new Guid("11111111-0003-4aaa-8aaa-ffffffffffff");
|
|
|
|
var inventoryMap = new InventoryMap(sharedFolder, []);
|
|
_queryCallbacks.Setup(e =>
|
|
e.TryGetInventoryMapAsync(default)
|
|
).ReturnsAsync((true, inventoryMap));
|
|
|
|
Assert.True(await _rlv.ProcessMessage("@addattach:groin=n", _sender.Id, _sender.Name));
|
|
|
|
// #RLV/Clothing/Hats/Fancy Hat
|
|
Assert.True(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_Hats_FancyHat_Chin, true));
|
|
|
|
// #RLV/Clothing/Happy Shirt
|
|
Assert.False(_rlv.Permissions.CanAttach(sampleTree.Root_Clothing_HappyShirt, true));
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|