Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions LibreMetaverse.Tests/InventoryManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,31 @@ public void CreateInventoryItem_ReturnsCorrectSubclass()
Assert.That(unknown, Is.InstanceOf<InventoryItem>());
}
}

[TestCase(23, "Widget", "widget")]
[TestCase(24, "Person", "person")]
[TestCase(25, "Settings", "settings")]
[TestCase(26, "Material", "material")]
[TestCase(27, "GLTF", "gltf")]
[TestCase(28, "GLTFBin", "glbin")]
public void InventoryTypeCanonicalTail_HasExpectedWireValueAndName(int value, string enumName, string wireName)
{
var inventoryType = (InventoryType)value;

using (Assert.EnterMultipleScope())
{
Assert.That(Enum.GetName(typeof(InventoryType), inventoryType), Is.EqualTo(enumName));
Assert.That(Utils.InventoryTypeToString(inventoryType), Is.EqualTo(wireName));
Assert.That(Utils.StringToInventoryType(wireName), Is.EqualTo(inventoryType));
}
}

[Test]
public void CreateInventoryItem_MaterialWireValue_ReturnsMaterial()
{
var item = InventoryManager.CreateInventoryItem((InventoryType)26, UUID.Random());

Assert.That(item, Is.InstanceOf<InventoryMaterial>());
}
}
}
16 changes: 12 additions & 4 deletions LibreMetaverse.Types/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,18 @@ public enum InventoryType : sbyte
Gesture = 20,
/// <summary></summary>
Mesh = 22,
/// <summary></summary>
Settings = 23,
/// <summary></summary>
Material = 24,
/// <summary>Widget</summary>
Widget = 23,
/// <summary>Person</summary>
Person = 24,
/// <summary>Settings</summary>
Settings = 25,
/// <summary>Render material</summary>
Material = 26,
/// <summary>glTF asset</summary>
GLTF = 27,
/// <summary>Binary glTF asset</summary>
GLTFBin = 28,
}

/// <summary>
Expand Down
8 changes: 7 additions & 1 deletion LibreMetaverse.Types/UtilsConversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ public static partial class Utils
"animation", // 19
"gesture", // 20
string.Empty, // 21
"mesh" // 22
"mesh", // 22
"widget", // 23
"person", // 24
"settings", // 25
"material", // 26
"gltf", // 27
"glbin" // 28
};

private static readonly string[] _SaleTypeNames = {
Expand Down
Loading