osu/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapDetails.cs

179 lines
5.9 KiB
C#
Raw Normal View History

// 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.Linq;
2019-06-13 09:51:41 +00:00
using NUnit.Framework;
2018-04-13 09:19:50 +00:00
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Screens.Select;
2019-03-24 16:02:36 +00:00
namespace osu.Game.Tests.Visual.SongSelect
2018-04-13 09:19:50 +00:00
{
2019-06-13 09:51:41 +00:00
[System.ComponentModel.Description("PlaySongSelect beatmap details")]
public class TestSceneBeatmapDetails : OsuTestScene
2018-04-13 09:19:50 +00:00
{
2019-06-13 09:51:41 +00:00
private BeatmapDetails details;
[SetUp]
public void Setup() => Schedule(() =>
2018-04-13 09:19:50 +00:00
{
2019-06-13 09:51:41 +00:00
Child = details = new BeatmapDetails
2018-04-13 09:19:50 +00:00
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(150),
2019-06-13 09:51:41 +00:00
};
});
2018-04-13 09:19:50 +00:00
2019-06-13 09:51:41 +00:00
[Test]
public void TestAllMetrics()
{
2019-02-26 07:12:40 +00:00
AddStep("all metrics", () => details.Beatmap = new BeatmapInfo
2018-04-13 09:19:50 +00:00
{
2019-06-13 07:52:49 +00:00
BeatmapSet = new BeatmapSetInfo
{
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
},
2018-04-13 09:19:50 +00:00
Version = "All Metrics",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has all the metrics",
},
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 7,
DrainRate = 1,
OverallDifficulty = 5.7f,
ApproachRate = 3.5f,
},
StarDifficulty = 5.3f,
Metrics = new BeatmapMetrics
{
2019-06-13 07:30:38 +00:00
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
2018-04-13 09:19:50 +00:00
},
});
2019-06-13 09:51:41 +00:00
}
2018-04-13 09:19:50 +00:00
2019-06-13 09:51:41 +00:00
[Test]
public void TestAllMetricsExceptSource()
{
2019-02-26 07:12:40 +00:00
AddStep("all except source", () => details.Beatmap = new BeatmapInfo
{
2019-06-13 07:52:49 +00:00
BeatmapSet = new BeatmapSetInfo
{
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
},
2019-02-26 07:12:40 +00:00
Version = "All Metrics",
Metadata = new BeatmapMetadata
{
Tags = "this beatmap has all the metrics",
},
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 7,
DrainRate = 1,
OverallDifficulty = 5.7f,
ApproachRate = 3.5f,
},
StarDifficulty = 5.3f,
Metrics = new BeatmapMetrics
{
2019-06-13 07:30:38 +00:00
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
2019-02-26 07:12:40 +00:00
},
});
2019-06-13 09:51:41 +00:00
}
2019-02-26 07:12:40 +00:00
2019-06-13 09:51:41 +00:00
[Test]
public void TestOnlyRatings()
{
2019-02-26 07:12:40 +00:00
AddStep("ratings", () => details.Beatmap = new BeatmapInfo
2018-04-13 09:19:50 +00:00
{
2019-06-13 07:52:49 +00:00
BeatmapSet = new BeatmapSetInfo
{
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
},
2018-04-13 09:19:50 +00:00
Version = "Only Ratings",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has ratings metrics but not retries or fails",
},
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 6,
DrainRate = 9,
OverallDifficulty = 6,
ApproachRate = 6,
},
StarDifficulty = 4.8f,
});
2019-06-13 09:51:41 +00:00
}
2018-04-13 09:19:50 +00:00
2019-06-13 09:51:41 +00:00
[Test]
public void TestOnlyFailsAndRetries()
{
2019-02-26 07:12:40 +00:00
AddStep("fails retries", () => details.Beatmap = new BeatmapInfo
2018-04-13 09:19:50 +00:00
{
Version = "Only Retries and Fails",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has retries and fails but no ratings",
},
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 3.7f,
DrainRate = 6,
OverallDifficulty = 6,
ApproachRate = 7,
},
StarDifficulty = 2.91f,
Metrics = new BeatmapMetrics
{
2019-06-13 07:30:38 +00:00
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
2018-04-13 09:19:50 +00:00
},
});
2019-06-13 09:51:41 +00:00
}
2018-04-13 09:19:50 +00:00
2019-06-13 09:51:41 +00:00
[Test]
public void TestNoMetrics()
{
2019-02-26 07:12:40 +00:00
AddStep("no metrics", () => details.Beatmap = new BeatmapInfo
2018-04-13 09:19:50 +00:00
{
Version = "No Metrics",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has no metrics",
},
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 5,
OverallDifficulty = 5.5f,
ApproachRate = 6.5f,
},
StarDifficulty = 1.97f,
});
2019-06-13 09:51:41 +00:00
}
2018-04-13 09:19:50 +00:00
2019-06-13 09:51:41 +00:00
[Test]
public void TestNullBeatmap()
{
2018-04-13 09:19:50 +00:00
AddStep("null beatmap", () => details.Beatmap = null);
2019-06-13 09:51:41 +00:00
}
2019-06-13 09:51:41 +00:00
[Test]
public void TestOnlineMetrics()
{
AddStep("online ratings/retries/fails", () => details.Beatmap = new BeatmapInfo
{
OnlineBeatmapID = 162,
});
2018-04-13 09:19:50 +00:00
}
}
}