2020-05-16 09:17:32 +00: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.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-12-13 07:41:29 +00:00
|
|
|
using System.Linq;
|
2020-05-16 09:17:32 +00:00
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Osu;
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
using osu.Game.Screens.Ranking;
|
|
|
|
using osu.Game.Screens.Ranking.Contracted;
|
2021-12-13 07:34:48 +00:00
|
|
|
using osu.Game.Tests.Resources;
|
2020-05-16 09:17:32 +00:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Ranking
|
|
|
|
{
|
|
|
|
public class TestSceneContractedPanelMiddleContent : OsuTestScene
|
|
|
|
{
|
|
|
|
[Test]
|
2020-05-22 11:18:47 +00:00
|
|
|
public void TestShowPanel()
|
2020-05-16 09:17:32 +00:00
|
|
|
{
|
2021-12-13 07:37:20 +00:00
|
|
|
AddStep("show example score", () => showPanel(CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)), TestResources.CreateTestScoreInfo()));
|
2020-05-16 09:17:32 +00:00
|
|
|
}
|
|
|
|
|
2021-07-21 06:35:59 +00:00
|
|
|
[Test]
|
|
|
|
public void TestExcessMods()
|
|
|
|
{
|
2021-12-13 07:41:29 +00:00
|
|
|
AddStep("show excess mods score", () =>
|
|
|
|
{
|
|
|
|
var score = TestResources.CreateTestScoreInfo();
|
|
|
|
score.Mods = score.BeatmapInfo.Ruleset.CreateInstance().CreateAllMods().ToArray();
|
|
|
|
showPanel(CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)), score);
|
|
|
|
});
|
2021-07-21 06:35:59 +00:00
|
|
|
}
|
|
|
|
|
2020-05-16 09:17:32 +00:00
|
|
|
private void showPanel(WorkingBeatmap workingBeatmap, ScoreInfo score)
|
|
|
|
{
|
|
|
|
Child = new ContractedPanelMiddleContentContainer(workingBeatmap, score);
|
|
|
|
}
|
|
|
|
|
|
|
|
private class ContractedPanelMiddleContentContainer : Container
|
|
|
|
{
|
|
|
|
[Cached]
|
|
|
|
private Bindable<WorkingBeatmap> workingBeatmap { get; set; }
|
|
|
|
|
|
|
|
public ContractedPanelMiddleContentContainer(WorkingBeatmap beatmap, ScoreInfo score)
|
|
|
|
{
|
|
|
|
workingBeatmap = new Bindable<WorkingBeatmap>(beatmap);
|
|
|
|
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
2020-05-22 11:18:47 +00:00
|
|
|
Size = new Vector2(ScorePanel.CONTRACTED_WIDTH, 460);
|
2020-05-16 09:17:32 +00:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4Extensions.FromHex("#353535"),
|
|
|
|
},
|
|
|
|
new ContractedPanelMiddleContent(score),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|