mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 06:57:51 +08:00
Make test actually test drum behaviours
This commit is contained in:
parent
c32af3c041
commit
b884ed2a3d
@ -1,55 +1,50 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets.Taiko.UI;
|
using osu.Game.Rulesets.Taiko.UI;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests
|
namespace osu.Game.Rulesets.Taiko.Tests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneDrumTouchInputArea : DrawableTaikoRulesetTestScene
|
public class TestSceneDrumTouchInputArea : OsuTestScene
|
||||||
{
|
{
|
||||||
protected const double NUM_HIT_OBJECTS = 10;
|
[Cached]
|
||||||
protected const double HIT_OBJECT_TIME_SPACING_MS = 1000;
|
private TaikoInputManager taikoInputManager = new TaikoInputManager(new TaikoRuleset().RulesetInfo);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private DrumTouchInputArea drumTouchInputArea = null!;
|
||||||
private void load()
|
|
||||||
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
{
|
{
|
||||||
var drumTouchInputArea = new DrumTouchInputArea();
|
AddStep("create drum", () =>
|
||||||
DrawableRuleset.KeyBindingInputManager.Add(drumTouchInputArea);
|
|
||||||
drumTouchInputArea.ShowTouchControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
|
||||||
{
|
|
||||||
List<TaikoHitObject> hitObjects = new List<TaikoHitObject>();
|
|
||||||
|
|
||||||
for (int i = 0; i < NUM_HIT_OBJECTS; i++)
|
|
||||||
{
|
{
|
||||||
hitObjects.Add(new Hit
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
StartTime = Time.Current + i * HIT_OBJECT_TIME_SPACING_MS,
|
new InputDrum
|
||||||
IsStrong = isOdd(i),
|
{
|
||||||
Type = isOdd(i / 2) ? HitType.Centre : HitType.Rim
|
Anchor = Anchor.TopCentre,
|
||||||
});
|
Origin = Anchor.TopCentre,
|
||||||
}
|
Height = 0.5f,
|
||||||
|
},
|
||||||
var beatmap = new Beatmap<TaikoHitObject>
|
drumTouchInputArea = new DrumTouchInputArea
|
||||||
{
|
{
|
||||||
BeatmapInfo = { Ruleset = ruleset },
|
Anchor = Anchor.BottomCentre,
|
||||||
HitObjects = hitObjects
|
Origin = Anchor.BottomCentre,
|
||||||
};
|
Height = 0.5f,
|
||||||
|
},
|
||||||
return beatmap;
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool isOdd(int number)
|
[Test]
|
||||||
|
public void TestDrum()
|
||||||
{
|
{
|
||||||
return number % 2 == 0;
|
AddStep("show drum", () => drumTouchInputArea.Show());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user