2019-01-24 08:43:03 +00: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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using NUnit.Framework;
|
2020-01-09 04:43:44 +00:00
|
|
|
|
using osu.Framework.Utils;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
|
|
|
|
using osu.Game.Tests.Beatmaps;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Tests
|
|
|
|
|
{
|
2018-06-13 14:43:58 +00:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TaikoBeatmapConversionTest : BeatmapConversionTest<ConvertValue>
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko";
|
|
|
|
|
|
|
|
|
|
[NonParallelizable]
|
2018-05-17 06:17:47 +00:00
|
|
|
|
[TestCase("basic")]
|
|
|
|
|
[TestCase("slider-generating-drumroll")]
|
2019-08-05 08:02:28 +00:00
|
|
|
|
public void Test(string name) => base.Test(name);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
protected override IEnumerable<ConvertValue> CreateConvertValue(HitObject hitObject)
|
|
|
|
|
{
|
|
|
|
|
yield return new ConvertValue
|
|
|
|
|
{
|
|
|
|
|
StartTime = hitObject.StartTime,
|
2019-11-25 10:01:24 +00:00
|
|
|
|
EndTime = hitObject.GetEndTime(),
|
2018-04-13 09:19:50 +00:00
|
|
|
|
IsRim = hitObject is RimHit,
|
|
|
|
|
IsCentre = hitObject is CentreHit,
|
|
|
|
|
IsDrumRoll = hitObject is DrumRoll,
|
|
|
|
|
IsSwell = hitObject is Swell,
|
|
|
|
|
IsStrong = ((TaikoHitObject)hitObject).IsStrong
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-16 04:09:48 +00:00
|
|
|
|
protected override Ruleset CreateRuleset() => new TaikoRuleset();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-13 14:43:58 +00:00
|
|
|
|
public struct ConvertValue : IEquatable<ConvertValue>
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A sane value to account for osu!stable using ints everwhere.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float conversion_lenience = 2;
|
|
|
|
|
|
|
|
|
|
public double StartTime;
|
|
|
|
|
public double EndTime;
|
|
|
|
|
public bool IsRim;
|
|
|
|
|
public bool IsCentre;
|
|
|
|
|
public bool IsDrumRoll;
|
|
|
|
|
public bool IsSwell;
|
|
|
|
|
public bool IsStrong;
|
|
|
|
|
|
|
|
|
|
public bool Equals(ConvertValue other)
|
|
|
|
|
=> Precision.AlmostEquals(StartTime, other.StartTime, conversion_lenience)
|
|
|
|
|
&& Precision.AlmostEquals(EndTime, other.EndTime, conversion_lenience)
|
|
|
|
|
&& IsRim == other.IsRim
|
|
|
|
|
&& IsCentre == other.IsCentre
|
|
|
|
|
&& IsDrumRoll == other.IsDrumRoll
|
|
|
|
|
&& IsSwell == other.IsSwell
|
|
|
|
|
&& IsStrong == other.IsStrong;
|
|
|
|
|
}
|
|
|
|
|
}
|