mirror of
https://github.com/AnnulusGames/Alchemy.git
synced 2025-01-22 08:18:51 -05:00
Add: tests
This commit is contained in:
parent
d375e6c54f
commit
70f37a03d6
@ -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
|
Loading…
Reference in New Issue
Block a user