mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +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.
|
||||
// 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()
|
||||
private DrumTouchInputArea drumTouchInputArea = null!;
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
var drumTouchInputArea = new DrumTouchInputArea();
|
||||
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++)
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
var beatmap = new Beatmap<TaikoHitObject>
|
||||
{
|
||||
BeatmapInfo = { Ruleset = ruleset },
|
||||
HitObjects = hitObjects
|
||||
};
|
||||
|
||||
return beatmap;
|
||||
new InputDrum
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Height = 0.5f,
|
||||
},
|
||||
drumTouchInputArea = new DrumTouchInputArea
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Height = 0.5f,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
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