1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 15:03:16 +08:00

Update visual test.

This commit is contained in:
DrabWeb 2017-09-08 14:15:28 -03:00
parent 55e8bdfb05
commit ce68b6661e
2 changed files with 88 additions and 33 deletions

View File

@ -20,42 +20,97 @@ namespace osu.Desktop.Tests.Visual
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(150), Padding = new MarginPadding(150),
Beatmap = new BeatmapInfo });
AddStep("beatmap all metrics", () => details.Beatmap = new BeatmapInfo
{
Version = "All Metrics",
Metadata = new BeatmapMetadata
{ {
Version = "VisualTest", Source = "osu!lazer",
Metadata = new BeatmapMetadata Tags = "this beatmap has all the metrics",
{ },
Source = "Some guy", Difficulty = new BeatmapDifficulty
Tags = "beatmap metadata example with a very very long list of tags and not much creativity", {
}, CircleSize = 7,
Difficulty = new BeatmapDifficulty DrainRate = 1,
{ OverallDifficulty = 5.7f,
CircleSize = 7, ApproachRate = 3.5f,
ApproachRate = 3.5f, },
OverallDifficulty = 5.7f, StarDifficulty = 5.3f,
DrainRate = 1, Metrics = new BeatmapMetrics
}, {
StarDifficulty = 5.3f, Ratings = Enumerable.Range(0, 10),
Metrics = new BeatmapMetrics Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
{ Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
Ratings = Enumerable.Range(0, 10),
Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6),
},
}, },
}); });
AddRepeatStep("fail values", newRetryAndFailValues, 10); AddStep("beatmap ratings", () => details.Beatmap = new BeatmapInfo
} {
Version = "Only Ratings",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has ratings metrics but not retries or fails",
},
Difficulty = new BeatmapDifficulty
{
CircleSize = 6,
DrainRate = 9,
OverallDifficulty = 6,
ApproachRate = 6,
},
StarDifficulty = 4.8f,
Metrics = new BeatmapMetrics
{
Ratings = Enumerable.Range(0, 10),
},
});
private int lastRange = 1; AddStep("beatmap fails retries", () => details.Beatmap = new BeatmapInfo
{
Version = "Only Retries and Fails",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has retries and fails but no ratings",
},
Difficulty = new BeatmapDifficulty
{
CircleSize = 3.7f,
DrainRate = 6,
OverallDifficulty = 6,
ApproachRate = 7,
},
StarDifficulty = 2.91f,
Metrics = new BeatmapMetrics
{
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
},
});
private void newRetryAndFailValues() AddStep("beatmap no metrics", () => details.Beatmap = new BeatmapInfo
{ {
details.Beatmap.Metrics.Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6); Version = "No Metrics",
details.Beatmap.Metrics.Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6); Metadata = new BeatmapMetadata
details.Beatmap = details.Beatmap; {
lastRange += 100; Source = "osu!lazer",
Tags = "this beatmap has no metrics",
},
Difficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 5,
OverallDifficulty = 5.5f,
ApproachRate = 6.5f,
},
StarDifficulty = 1.97f,
Metrics = new BeatmapMetrics(),
});
AddStep("null beatmap", () => details.Beatmap = null);
} }
} }
} }

View File

@ -215,8 +215,8 @@ namespace osu.Game.Screens.Select
private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true) private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true)
{ {
var hasRatings = metrics?.Ratings.Any() ?? false; var hasRatings = metrics?.Ratings?.Any() ?? false;
var hasRetriesFails = (metrics?.Retries.Any() ?? false) && metrics.Fails.Any(); var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics?.Fails?.Any() ?? false);
if (failOnMissing) loading.Hide(); if (failOnMissing) loading.Hide();