Add: tests

This commit is contained in:
AnnulusGames 2024-02-14 16:50:15 +09:00
parent d375e6c54f
commit 70f37a03d6

View File

@ -27,6 +27,44 @@ namespace Alchemy.Tests.Runtime
Assert.AreEqual(before, after);
}
[Test]
public void Test_Serialize_Deserialize_Gradient()
{
var before = new Gradient()
{
colorKeys = new GradientColorKey[] { new(Color.white, 0f) },
alphaKeys = new GradientAlphaKey[] { new(0f, 1f), new(1f, 1f) },
mode = GradientMode.Blend,
};
var beforeJson = SerializationHelper.ToJson(before, objects);
Debug.Log(beforeJson);
var after = SerializationHelper.FromJson<Gradient>(beforeJson, objects);
Assert.AreEqual(before, after);
}
[Test]
public void Test_Serialize_Deserialize_GradientColorKey()
{
var before = new GradientColorKey() { color = Color.black, time = 1f };
var beforeJson = SerializationHelper.ToJson(before, objects);
Debug.Log(beforeJson);
var after = SerializationHelper.FromJson<GradientColorKey>(beforeJson, objects);
Assert.AreEqual(before, after);
}
[Test]
public void Test_Serialize_Deserialize_GradientAlphaKey()
{
var before = new GradientAlphaKey() { alpha = 0.5f, time = 1f };
var beforeJson = SerializationHelper.ToJson(before, objects);
Debug.Log(beforeJson);
var after = SerializationHelper.FromJson<GradientAlphaKey>(beforeJson, objects);
Assert.AreEqual(before, after);
}
}
}
#endif