mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 09:03:01 +08:00
Fix drawables are added multiple times in a test scene
This commit is contained in:
parent
1a6b8e022c
commit
5936a8ffb4
@ -12,13 +12,14 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
{
|
{
|
||||||
public class TestSceneFruitRandomness : OsuTestScene
|
public class TestSceneFruitRandomness : OsuTestScene
|
||||||
{
|
{
|
||||||
[Test]
|
private readonly Bindable<int> randomSeed = new Bindable<int>();
|
||||||
public void TestFruitRandomness()
|
private readonly TestDrawableFruit drawableFruit;
|
||||||
{
|
private readonly TestDrawableBanana drawableBanana;
|
||||||
Bindable<int> randomSeed = new Bindable<int>();
|
|
||||||
|
|
||||||
var drawableFruit = new TestDrawableFruit(new Fruit());
|
public TestSceneFruitRandomness()
|
||||||
var drawableBanana = new TestDrawableBanana(new Banana());
|
{
|
||||||
|
drawableFruit = new TestDrawableFruit(new Fruit());
|
||||||
|
drawableBanana = new TestDrawableBanana(new Banana());
|
||||||
|
|
||||||
drawableFruit.RandomSeed.BindTo(randomSeed);
|
drawableFruit.RandomSeed.BindTo(randomSeed);
|
||||||
drawableBanana.RandomSeed.BindTo(randomSeed);
|
drawableBanana.RandomSeed.BindTo(randomSeed);
|
||||||
@ -26,6 +27,12 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
Add(new TestDrawableCatchHitObjectSpecimen(drawableFruit) { X = -200 });
|
Add(new TestDrawableCatchHitObjectSpecimen(drawableFruit) { X = -200 });
|
||||||
Add(new TestDrawableCatchHitObjectSpecimen(drawableBanana));
|
Add(new TestDrawableCatchHitObjectSpecimen(drawableBanana));
|
||||||
|
|
||||||
|
AddSliderStep("random seed", 0, 100, 0, x => randomSeed.Value = x);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestFruitRandomness()
|
||||||
|
{
|
||||||
float fruitRotation = 0;
|
float fruitRotation = 0;
|
||||||
float bananaRotation = 0;
|
float bananaRotation = 0;
|
||||||
float bananaScale = 0;
|
float bananaScale = 0;
|
||||||
@ -70,8 +77,6 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("random seed is changed", () => randomSeed.Value == 1000);
|
AddAssert("random seed is changed", () => randomSeed.Value == 1000);
|
||||||
|
|
||||||
AddSliderStep("random seed", 0, 100, 0, x => randomSeed.Value = x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestDrawableFruit : DrawableFruit
|
private class TestDrawableFruit : DrawableFruit
|
||||||
|
Loading…
Reference in New Issue
Block a user