Extend TestCaseTaikoPlayfield a bit.

This commit is contained in:
smoogipooo 2017-04-10 14:28:28 +09:00
parent d6f388f8fd
commit f4094fbde2

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.MathUtils;
@ -11,20 +12,21 @@ using osu.Game.Modes.Taiko.Judgements;
using osu.Game.Modes.Taiko.Objects;
using osu.Game.Modes.Taiko.Objects.Drawables;
using osu.Game.Modes.Taiko.UI;
using System;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseTaikoPlayfield : TestCase
{
public override string Description => "Taiko playfield";
private const double default_duration = 300;
private const float scroll_time = 1000;
private TaikoPlayfield playfield;
public override string Description => "Taiko playfield";
protected override double TimePerAction => default_duration * 2;
private const double default_duration = 300;
private const float scroll_time = 1000;
private readonly Random rng = new Random(1337);
private TaikoPlayfield playfield;
public override void Reset()
{
@ -41,7 +43,11 @@ namespace osu.Desktop.VisualTests.Tests
AddStep("Strong Rim", () => addRimHit(true));
AddStep("Add bar line", () => addBarLine(false));
AddStep("Add major bar line", () => addBarLine(true));
AddStep("Height test 1", () => changePlayfieldSize(1));
AddStep("Height test 2", () => changePlayfieldSize(2));
AddStep("Height test 3", () => changePlayfieldSize(3));
AddStep("Height test 4", () => changePlayfieldSize(4));
AddStep("Height test 5", () => changePlayfieldSize(5));
var rateAdjustClock = new StopwatchClock(true) { Rate = 1 };
@ -57,6 +63,31 @@ namespace osu.Desktop.VisualTests.Tests
});
}
private void changePlayfieldSize(int step)
{
switch (step)
{
case 1:
addCentreHit(false);
break;
case 2:
addCentreHit(true);
break;
case 3:
addDrumRoll(false);
break;
case 4:
addDrumRoll(true);
break;
case 5:
addSwell(1000);
playfield.Delay(scroll_time - 100);
break;
}
playfield.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500);
}
private void addHitJudgement()
{
TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great;