2019-01-24 16:43:03 +08:00
|
|
|
|
// 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 17:19:50 +08:00
|
|
|
|
|
2019-03-13 13:12:05 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2019-03-08 17:32:39 +08:00
|
|
|
|
using System.Linq;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using NUnit.Framework;
|
2019-05-31 13:40:53 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-08 17:32:39 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Screens.Select;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-03-25 00:02:36 +08:00
|
|
|
|
namespace osu.Game.Tests.Visual.SongSelect
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
[System.ComponentModel.Description("PlaySongSelect leaderboard/details area")]
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public class TestSceneBeatmapDetailArea : OsuTestScene
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-03-13 13:12:05 +08:00
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(BeatmapDetails) };
|
|
|
|
|
|
2019-05-31 13:40:53 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuGameBase game)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-03-08 17:32:39 +08:00
|
|
|
|
BeatmapDetailArea detailsArea;
|
|
|
|
|
Add(detailsArea = new BeatmapDetailArea
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(550f, 450f),
|
|
|
|
|
});
|
2019-03-08 17:32:39 +08:00
|
|
|
|
|
2019-05-31 13:51:12 +08:00
|
|
|
|
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
2019-03-08 17:32:39 +08:00
|
|
|
|
{
|
2019-06-13 15:52:49 +08:00
|
|
|
|
BeatmapSetInfo =
|
|
|
|
|
{
|
|
|
|
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
|
|
|
|
},
|
2019-03-08 17:32:39 +08:00
|
|
|
|
BeatmapInfo =
|
|
|
|
|
{
|
|
|
|
|
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 15:30:38 +08:00
|
|
|
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
|
|
|
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
2019-03-08 17:32:39 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2019-05-31 13:51:12 +08:00
|
|
|
|
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
2019-03-08 17:32:39 +08:00
|
|
|
|
{
|
2019-06-13 15:52:49 +08:00
|
|
|
|
BeatmapSetInfo =
|
|
|
|
|
{
|
|
|
|
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
|
|
|
|
},
|
2019-03-08 17:32:39 +08:00
|
|
|
|
BeatmapInfo =
|
|
|
|
|
{
|
|
|
|
|
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 15:30:38 +08:00
|
|
|
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
|
|
|
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
2019-03-08 17:32:39 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2019-05-31 13:51:12 +08:00
|
|
|
|
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
2019-03-08 17:32:39 +08:00
|
|
|
|
{
|
2019-06-13 15:52:49 +08:00
|
|
|
|
BeatmapSetInfo =
|
|
|
|
|
{
|
|
|
|
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
|
|
|
|
},
|
2019-03-08 17:32:39 +08:00
|
|
|
|
BeatmapInfo =
|
|
|
|
|
{
|
|
|
|
|
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,
|
|
|
|
|
},
|
2019-06-13 15:52:49 +08:00
|
|
|
|
StarDifficulty = 4.8f
|
2019-03-08 17:32:39 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2019-05-31 13:51:12 +08:00
|
|
|
|
AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
2019-03-08 17:32:39 +08:00
|
|
|
|
{
|
|
|
|
|
BeatmapInfo =
|
|
|
|
|
{
|
|
|
|
|
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 15:30:38 +08:00
|
|
|
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
|
|
|
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
2019-03-08 17:32:39 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2019-05-31 13:51:12 +08:00
|
|
|
|
AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap(null, null)
|
2019-03-08 17:32:39 +08:00
|
|
|
|
{
|
|
|
|
|
BeatmapInfo =
|
|
|
|
|
{
|
|
|
|
|
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,
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddStep("null beatmap", () => detailsArea.Beatmap = null);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|