mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-08 03:48:19 -05:00
add EnumUtil
This commit is contained in:
21
Scripts/Editor/Tests/EnumUtilTest.cs
Normal file
21
Scripts/Editor/Tests/EnumUtilTest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
public class EnumUtilTest
|
||||
{
|
||||
[Test]
|
||||
public void EnumUtilTestSimplePasses()
|
||||
{
|
||||
Assert.AreEqual(default(HumanBodyBones), EnumUtil.TryParseOrDefault<HumanBodyBones>("xxx"));
|
||||
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
Assert.AreEqual(HumanBodyBones.UpperChest, EnumUtil.TryParseOrDefault<HumanBodyBones>("upperchest"));
|
||||
#else
|
||||
Assert.AreEqual(default(HumanBodyBones), EnumUtil.TryParseOrDefault<HumanBodyBones>("upperchest"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Scripts/Editor/Tests/EnumUtilTest.cs.meta
Normal file
12
Scripts/Editor/Tests/EnumUtilTest.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4a5f44a23cb4884b9667b622f262497
|
||||
timeCreated: 1523088686
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,22 +3,25 @@ using System.Collections.Generic;
|
||||
using VRM;
|
||||
|
||||
|
||||
public class VRMBlendShapeKeyTest
|
||||
namespace VRM
|
||||
{
|
||||
[Test]
|
||||
public void KeyTest()
|
||||
public class VRMBlendShapeKeyTest
|
||||
{
|
||||
var key = new BlendShapeKey("Blink", BlendShapePreset.Blink);
|
||||
[Test]
|
||||
public void KeyTest()
|
||||
{
|
||||
var key = new BlendShapeKey("Blink", BlendShapePreset.Blink);
|
||||
|
||||
Assert.AreEqual(key, new BlendShapeKey("blink"));
|
||||
Assert.AreEqual(key, new BlendShapeKey(BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key, new BlendShapeKey("xxx", BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key, new BlendShapeKey("blink"));
|
||||
Assert.AreEqual(key, new BlendShapeKey(BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key, new BlendShapeKey("xxx", BlendShapePreset.Blink));
|
||||
|
||||
var dict = new Dictionary<BlendShapeKey, float>();
|
||||
dict[new BlendShapeKey("xxx", BlendShapePreset.Blink)] = 1.0f;
|
||||
var dict = new Dictionary<BlendShapeKey, float>();
|
||||
dict[new BlendShapeKey("xxx", BlendShapePreset.Blink)] = 1.0f;
|
||||
|
||||
Assert.IsTrue(dict.ContainsKey(new BlendShapeKey("blink")));
|
||||
Assert.IsTrue(dict.ContainsKey(new BlendShapeKey(BlendShapePreset.Blink)));
|
||||
Assert.IsTrue(dict.ContainsKey(new BlendShapeKey("xxx", BlendShapePreset.Blink)));
|
||||
Assert.IsTrue(dict.ContainsKey(new BlendShapeKey("blink")));
|
||||
Assert.IsTrue(dict.ContainsKey(new BlendShapeKey(BlendShapePreset.Blink)));
|
||||
Assert.IsTrue(dict.ContainsKey(new BlendShapeKey("xxx", BlendShapePreset.Blink)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user