Skip to content

Commit

Permalink
Adjust the default shadow size.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed May 5, 2022
1 parent d2a3f7b commit f9a751e
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ public void TestSerializer()
{
var shader = new ShadowShader
{
ShadowOffset = new Vector2(10),
ShadowOffset = new Vector2(3),
ShadowColour = new Color4(0.5f, 0.5f, 0.5f, 0.5f),
};

const string expected = "{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":10.0,\"y\":10.0}}";
const string expected = "{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}";
string result = JsonConvert.SerializeObject(shader, CreateSettings());
Assert.AreEqual(expected, result);
}

[Test]
public void TestDeserialize()
{
const string json = "{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":10.0,\"y\":10.0}}";
const string json = "{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}";

var expected = new ShadowShader
{
ShadowOffset = new Vector2(10),
ShadowOffset = new Vector2(3),
ShadowColour = new Color4(0.5f, 0.5f, 0.5f, 0.5f),
};
var actual = JsonConvert.DeserializeObject<ICustomizedShader>(json, CreateSettings()) as ShadowShader;
Expand All @@ -60,14 +60,14 @@ public void TestSerializerListItems()
{
new ShadowShader
{
ShadowOffset = new Vector2(10),
ShadowOffset = new Vector2(3),
ShadowColour = new Color4(0.5f, 0.5f, 0.5f, 0.5f),
}
}
};

const string expected =
"{\"$type\":\"StepShader\",\"name\":\"HelloShader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":10.0,\"y\":10.0}}]}";
"{\"$type\":\"StepShader\",\"name\":\"HelloShader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}";
string actual = JsonConvert.SerializeObject(shader, CreateSettings());
Assert.AreEqual(expected, actual);
}
Expand All @@ -76,7 +76,7 @@ public void TestSerializerListItems()
public void TestDeserializeListItems()
{
const string json =
"{\"$type\":\"StepShader\",\"name\":\"HelloShader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":10.0,\"y\":10.0}}]}";
"{\"$type\":\"StepShader\",\"name\":\"HelloShader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#7F7F7F7F\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}";

var expected = new StepShader
{
Expand All @@ -85,7 +85,7 @@ public void TestDeserializeListItems()
{
new ShadowShader
{
ShadowOffset = new Vector2(10),
ShadowOffset = new Vector2(3),
ShadowColour = new Color4(0.5f, 0.5f, 0.5f, 0.5f),
}
}
Expand Down

0 comments on commit f9a751e

Please sign in to comment.