1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 15:27:24 +08:00

Add a taiko beatmap conversion test case

This commit is contained in:
smoogipoo 2018-03-02 01:40:38 +09:00
parent 070c5a95ee
commit b2827d82d4
4 changed files with 1897 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using NUnit.Framework;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Taiko.Beatmaps;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Rulesets.Taiko.Tests
{
public class TaikoBeatmapConversionTest : BeatmapConversionTest<ConvertValue>
{
protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko";
private bool isForCurrentRuleset;
[TestCase(875945, false), NonParallelizable]
public void Test(int beatmapId, bool isForCurrentRuleset)
{
this.isForCurrentRuleset = isForCurrentRuleset;
base.Test(beatmapId);
}
protected override ConvertValue CreateConvertValue(HitObject hitObject) => new ConvertValue
{
StartTime = hitObject.StartTime,
EndTime = (hitObject as IHasEndTime)?.EndTime ?? hitObject.StartTime,
IsRim = hitObject is RimHit,
IsCentre = hitObject is CentreHit,
IsDrumRoll = hitObject is DrumRoll,
IsSwell = hitObject is Swell,
IsStrong = ((TaikoHitObject)hitObject).IsStrong
};
protected override ITestableBeatmapConverter CreateConverter() => new TaikoBeatmapConverter(isForCurrentRuleset);
}
public struct ConvertValue : IEquatable<ConvertValue>
{
/// <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)
&& Precision.AlmostEquals(EndTime, other.EndTime, conversion_lenience)
&& IsRim == other.IsRim
&& IsCentre == other.IsCentre
&& IsDrumRoll == other.IsDrumRoll
&& IsSwell == other.IsSwell
&& IsStrong == other.IsStrong;
}
}

View File

@ -112,6 +112,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Scoring\TaikoScoreProcessor.cs" />
<Compile Include="TaikoInputManager.cs" />
<Compile Include="Tests\TaikoBeatmapConversionTest.cs" />
<Compile Include="Tests\TestCaseInputDrum.cs" />
<Compile Include="Tests\TestCasePerformancePoints.cs" />
<Compile Include="Tests\TestCaseTaikoPlayfield.cs" />
@ -145,6 +146,10 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Testing\Beatmaps\875945-expected-conversion.json" />
<EmbeddedResource Include="Resources\Testing\Beatmaps\875945.osu" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">