1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 14:07:25 +08:00

Make test actually test drum behaviours

This commit is contained in:
Dean Herbert 2022-07-22 16:18:14 +09:00
parent c32af3c041
commit b884ed2a3d

View File

@ -1,55 +1,50 @@
// 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.
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests
{
[TestFixture]
public class TestSceneDrumTouchInputArea : DrawableTaikoRulesetTestScene
public class TestSceneDrumTouchInputArea : OsuTestScene
{
protected const double NUM_HIT_OBJECTS = 10;
protected const double HIT_OBJECT_TIME_SPACING_MS = 1000;
[Cached]
private TaikoInputManager taikoInputManager = new TaikoInputManager(new TaikoRuleset().RulesetInfo);
[BackgroundDependencyLoader]
private void load()
{
var drumTouchInputArea = new DrumTouchInputArea();
DrawableRuleset.KeyBindingInputManager.Add(drumTouchInputArea);
drumTouchInputArea.ShowTouchControls();
}
private DrumTouchInputArea drumTouchInputArea = null!;
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
[SetUpSteps]
public void SetUpSteps()
{
List<TaikoHitObject> hitObjects = new List<TaikoHitObject>();
for (int i = 0; i < NUM_HIT_OBJECTS; i++)
AddStep("create drum", () =>
{
hitObjects.Add(new Hit
Children = new Drawable[]
{
StartTime = Time.Current + i * HIT_OBJECT_TIME_SPACING_MS,
IsStrong = isOdd(i),
Type = isOdd(i / 2) ? HitType.Centre : HitType.Rim
new InputDrum
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Height = 0.5f,
},
drumTouchInputArea = new DrumTouchInputArea
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Height = 0.5f,
},
};
});
}
var beatmap = new Beatmap<TaikoHitObject>
[Test]
public void TestDrum()
{
BeatmapInfo = { Ruleset = ruleset },
HitObjects = hitObjects
};
return beatmap;
}
private bool isOdd(int number)
{
return number % 2 == 0;
AddStep("show drum", () => drumTouchInputArea.Show());
}
}
}