mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 05:52:54 +08:00
Add test coverage of correct multiplier written to .osu
file
This commit is contained in:
parent
01c614935b
commit
853d67f9cc
@ -1,9 +1,15 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
using SharpCompress.Archives.Zip;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Tests.Editor
|
namespace osu.Game.Rulesets.Taiko.Tests.Editor
|
||||||
{
|
{
|
||||||
@ -11,6 +17,40 @@ namespace osu.Game.Rulesets.Taiko.Tests.Editor
|
|||||||
{
|
{
|
||||||
protected override Ruleset CreateRuleset() => new TaikoRuleset();
|
protected override Ruleset CreateRuleset() => new TaikoRuleset();
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTaikoSliderMultiplierInExport()
|
||||||
|
{
|
||||||
|
AddStep("Set slider multiplier", () => EditorBeatmap.Difficulty.SliderMultiplier = 2);
|
||||||
|
|
||||||
|
SaveEditor();
|
||||||
|
AddStep("export beatmap", () => Game.BeatmapManager.Export(EditorBeatmap.BeatmapInfo.BeatmapSet!).WaitSafely());
|
||||||
|
|
||||||
|
AddAssert("check slider multiplier correct in file", () =>
|
||||||
|
{
|
||||||
|
string export = LocalStorage.GetFiles("exports").First();
|
||||||
|
|
||||||
|
using (var stream = LocalStorage.GetStream(export))
|
||||||
|
using (var zip = ZipArchive.Open(stream))
|
||||||
|
{
|
||||||
|
using (var osuStream = zip.Entries.First().OpenEntryStream())
|
||||||
|
using (var reader = new StreamReader(osuStream))
|
||||||
|
{
|
||||||
|
string? line;
|
||||||
|
|
||||||
|
while ((line = reader.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
if (line.StartsWith("SliderMultiplier", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return float.Parse(line.Split(':', StringSplitOptions.TrimEntries).Last(), provider: CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}, () => Is.EqualTo(2));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestTaikoSliderMultiplier()
|
public void TestTaikoSliderMultiplier()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user