Test banana colour change based on random seed

This commit is contained in:
ekrctb 2020-12-02 17:16:36 +09:00
parent 08848e49de
commit ef741a1471

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Tests
{
@ -31,6 +32,7 @@ namespace osu.Game.Rulesets.Catch.Tests
float fruitRotation = 0;
float bananaRotation = 0;
float bananaScale = 0;
Color4 bananaColour = new Color4();
AddStep("set random seed to 0", () =>
{
@ -40,16 +42,19 @@ namespace osu.Game.Rulesets.Catch.Tests
fruitRotation = drawableFruit.InnerRotation;
bananaRotation = drawableBanana.InnerRotation;
bananaScale = drawableBanana.InnerScale;
bananaColour = drawableBanana.AccentColour.Value;
});
AddStep("change random seed", () =>
{
// Use a seed value such that the banana colour is different (2/3 of the seed values are okay).
randomSeed.Value = 10;
});
AddAssert("fruit rotation is changed", () => drawableFruit.InnerRotation != fruitRotation);
AddAssert("banana rotation is changed", () => drawableBanana.InnerRotation != bananaRotation);
AddAssert("banana scale is changed", () => drawableBanana.InnerScale != bananaScale);
AddAssert("banana colour is changed", () => drawableBanana.AccentColour.Value != bananaColour);
AddStep("reset random seed", () =>
{
@ -59,7 +64,8 @@ namespace osu.Game.Rulesets.Catch.Tests
AddAssert("rotation and scale restored", () =>
drawableFruit.InnerRotation == fruitRotation &&
drawableBanana.InnerRotation == bananaRotation &&
drawableBanana.InnerScale == bananaScale);
drawableBanana.InnerScale == bananaScale &&
drawableBanana.AccentColour.Value == bananaColour);
AddStep("change start time", () =>
{