1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 08:37:24 +08:00
osu-lazer/osu.Game.Rulesets.Taiko.Tests/TestSceneSampleOutput.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.9 KiB
C#
Raw Normal View History

2020-05-19 22:28:13 +08:00
// 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.
2022-06-17 15:37:17 +08:00
#nullable disable
using System.Collections.Generic;
2020-05-19 22:28:13 +08:00
using System.Linq;
2020-05-20 09:14:08 +08:00
using osu.Framework.Testing;
2020-05-19 22:28:13 +08:00
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
namespace osu.Game.Rulesets.Taiko.Tests
{
/// <summary>
/// Taiko has some interesting rules for legacy mappings.
/// </summary>
2020-05-20 09:14:08 +08:00
[HeadlessTest]
public partial class TestSceneSampleOutput : TestSceneTaikoPlayer
2020-05-19 22:28:13 +08:00
{
public override void SetUpSteps()
{
base.SetUpSteps();
string[] expectedSampleNames =
{
string.Empty,
string.Empty,
string.Empty,
string.Empty,
HitSampleInfo.HIT_FINISH,
HitSampleInfo.HIT_WHISTLE,
HitSampleInfo.HIT_WHISTLE,
HitSampleInfo.HIT_WHISTLE,
};
var actualSampleNames = new List<string>();
// due to pooling we can't access all samples right away due to object re-use,
// so we need to collect as we go.
AddStep("collect sample names", () => Player.DrawableRuleset.Playfield.NewResult += (dho, _) =>
2020-05-19 22:28:13 +08:00
{
if (!(dho is DrawableHit h))
return;
actualSampleNames.Add(string.Join(',', h.GetSamples().Select(s => s.Name)));
2020-05-19 22:28:13 +08:00
});
AddUntilStep("all samples collected", () => actualSampleNames.Count == expectedSampleNames.Length);
AddAssert("samples are correct", () => actualSampleNames.SequenceEqual(expectedSampleNames));
2020-05-19 22:28:13 +08:00
}
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TaikoBeatmapConversionTest().GetBeatmap("sample-to-type-conversions");
}
}