mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 22:50:08 -05:00
Name についてテストケースに追加
This commit is contained in:
parent
c065863d39
commit
3f5e78a735
|
|
@ -10,21 +10,22 @@ namespace VRM
|
|||
{
|
||||
static BlendShapeKey CreateBlendShapeKey(string name, BlendShapePreset preset)
|
||||
{
|
||||
var argTypes = new Type[] { typeof(string), typeof(BlendShapePreset) };
|
||||
var argTypes = new Type[] {typeof(string), typeof(BlendShapePreset)};
|
||||
// private constructor
|
||||
var constructor = typeof(BlendShapeKey).GetConstructor(
|
||||
BindingFlags.Instance | BindingFlags.NonPublic,
|
||||
null, argTypes, null);
|
||||
return (BlendShapeKey)constructor.Invoke(new object[] { name, preset });
|
||||
return (BlendShapeKey) constructor.Invoke(new object[] {name, preset});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void KeyTest()
|
||||
{
|
||||
var key = CreateBlendShapeKey("Blink", BlendShapePreset.Blink);
|
||||
Assert.AreEqual(key, CreateBlendShapeKey("Blink", BlendShapePreset.Blink));
|
||||
var key = BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink);
|
||||
Assert.AreEqual(key, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key, CreateBlendShapeKey("Blink", BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key, CreateBlendShapeKey("xxx", BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key.Name, "Blink");
|
||||
|
||||
var dict = new Dictionary<BlendShapeKey, float>();
|
||||
dict[key] = 1.0f;
|
||||
|
|
@ -35,17 +36,23 @@ namespace VRM
|
|||
|
||||
dict.Clear();
|
||||
|
||||
var key2 = BlendShapeKey.CreateUnknown("Blink"); // name: Blink, Preset: Unknown
|
||||
var key2 = BlendShapeKey.CreateUnknown("Blink"); // Name: Blink, Preset: Unknown
|
||||
dict[key2] = 1.0f;
|
||||
|
||||
Assert.AreEqual(key2, CreateBlendShapeKey("Blink", BlendShapePreset.Unknown));
|
||||
Assert.AreNotEqual(key2, BlendShapeKey.CreateUnknown("blink"));
|
||||
Assert.AreNotEqual(key2, CreateBlendShapeKey("Blink", BlendShapePreset.Blink));
|
||||
Assert.AreNotEqual(key2, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key2.Name, "Blink");
|
||||
|
||||
Assert.IsFalse(dict.ContainsKey(BlendShapeKey.CreateUnknown("blink")));
|
||||
Assert.IsFalse(dict.ContainsKey(CreateBlendShapeKey("Blink", BlendShapePreset.Blink)));
|
||||
Assert.IsFalse(dict.ContainsKey(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink)));
|
||||
|
||||
var key3 = CreateBlendShapeKey("xxx", BlendShapePreset.Blink); // Unknown 以外は独自の名前を持てない
|
||||
Assert.AreEqual(key3, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));
|
||||
Assert.AreNotEqual(key3, CreateBlendShapeKey("xxx", BlendShapePreset.Unknown));
|
||||
Assert.AreEqual(key3.Name, "Blink");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user