2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2020-04-14 15:52:17 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Mania.Replays;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class ManiaLegacyReplayTest
|
|
|
|
|
{
|
|
|
|
|
[TestCase(ManiaAction.Key1)]
|
|
|
|
|
[TestCase(ManiaAction.Key1, ManiaAction.Key2)]
|
2024-08-08 05:36:04 +08:00
|
|
|
|
[TestCase(ManiaAction.Key5)]
|
|
|
|
|
[TestCase(ManiaAction.Key9)]
|
2020-04-14 15:52:17 +08:00
|
|
|
|
public void TestEncodeDecodeSingleStage(params ManiaAction[] actions)
|
|
|
|
|
{
|
2022-10-05 18:14:31 +08:00
|
|
|
|
var beatmap = new ManiaBeatmap(new StageDefinition(9));
|
2020-04-14 15:52:17 +08:00
|
|
|
|
|
|
|
|
|
var frame = new ManiaReplayFrame(0, actions);
|
|
|
|
|
var legacyFrame = frame.ToLegacy(beatmap);
|
|
|
|
|
|
|
|
|
|
var decodedFrame = new ManiaReplayFrame();
|
|
|
|
|
decodedFrame.FromLegacy(legacyFrame, beatmap);
|
|
|
|
|
|
|
|
|
|
Assert.That(decodedFrame.Actions, Is.EquivalentTo(frame.Actions));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase(ManiaAction.Key1)]
|
|
|
|
|
[TestCase(ManiaAction.Key1, ManiaAction.Key2)]
|
2024-08-08 05:36:04 +08:00
|
|
|
|
[TestCase(ManiaAction.Key3)]
|
2020-04-14 15:52:17 +08:00
|
|
|
|
[TestCase(ManiaAction.Key8)]
|
2024-08-08 05:36:04 +08:00
|
|
|
|
[TestCase(ManiaAction.Key3, ManiaAction.Key8)]
|
|
|
|
|
[TestCase(ManiaAction.Key3, ManiaAction.Key6)]
|
|
|
|
|
[TestCase(ManiaAction.Key10)]
|
2020-04-14 15:52:17 +08:00
|
|
|
|
public void TestEncodeDecodeDualStage(params ManiaAction[] actions)
|
|
|
|
|
{
|
2022-10-05 18:14:31 +08:00
|
|
|
|
var beatmap = new ManiaBeatmap(new StageDefinition(5));
|
|
|
|
|
beatmap.Stages.Add(new StageDefinition(5));
|
2020-04-14 15:52:17 +08:00
|
|
|
|
|
|
|
|
|
var frame = new ManiaReplayFrame(0, actions);
|
|
|
|
|
var legacyFrame = frame.ToLegacy(beatmap);
|
|
|
|
|
|
|
|
|
|
var decodedFrame = new ManiaReplayFrame();
|
|
|
|
|
decodedFrame.FromLegacy(legacyFrame, beatmap);
|
|
|
|
|
|
|
|
|
|
Assert.That(decodedFrame.Actions, Is.EquivalentTo(frame.Actions));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|