2020-02-18 22:25:12 +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.
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2020-02-18 22:47:44 +08:00
|
|
|
|
using NUnit.Framework;
|
2020-02-18 22:25:12 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
2020-02-18 22:47:44 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-02-18 22:25:12 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2020-02-18 22:47:44 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2020-02-18 22:25:12 +08:00
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
using osu.Game.Overlays.BeatmapListing;
|
2020-02-18 22:47:44 +08:00
|
|
|
|
using osuTK;
|
2020-02-18 22:25:12 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.UserInterface
|
|
|
|
|
{
|
|
|
|
|
public class TestSceneBeatmapListingSearchSection : OsuTestScene
|
|
|
|
|
{
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(BeatmapListingSearchSection),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
[Cached]
|
|
|
|
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
|
|
|
|
|
2020-02-18 22:47:44 +08:00
|
|
|
|
private readonly BeatmapListingSearchSection section;
|
|
|
|
|
|
2020-02-18 22:25:12 +08:00
|
|
|
|
public TestSceneBeatmapListingSearchSection()
|
|
|
|
|
{
|
2020-02-18 22:47:44 +08:00
|
|
|
|
OsuSpriteText query;
|
|
|
|
|
OsuSpriteText ruleset;
|
|
|
|
|
OsuSpriteText category;
|
2020-02-18 22:25:12 +08:00
|
|
|
|
|
|
|
|
|
Add(section = new BeatmapListingSearchSection
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
});
|
|
|
|
|
|
2020-02-18 22:47:44 +08:00
|
|
|
|
Add(new FillFlowContainer
|
2020-02-18 22:25:12 +08:00
|
|
|
|
{
|
2020-02-18 22:47:44 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Spacing = new Vector2(0, 5),
|
|
|
|
|
Children = new Drawable[]
|
2020-02-18 22:25:12 +08:00
|
|
|
|
{
|
2020-02-18 22:47:44 +08:00
|
|
|
|
query = new OsuSpriteText(),
|
|
|
|
|
ruleset = new OsuSpriteText(),
|
|
|
|
|
category = new OsuSpriteText(),
|
2020-02-18 22:25:12 +08:00
|
|
|
|
}
|
2020-02-18 22:47:44 +08:00
|
|
|
|
});
|
2020-02-18 22:25:12 +08:00
|
|
|
|
|
2020-02-18 22:47:44 +08:00
|
|
|
|
section.Query.BindValueChanged(q => query.Text = $"Query: {q.NewValue}", true);
|
|
|
|
|
section.Ruleset.BindValueChanged(r => ruleset.Text = $"Ruleset: {r.NewValue}", true);
|
|
|
|
|
section.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCovers()
|
|
|
|
|
{
|
|
|
|
|
AddStep("Set beatmap", () => section.BeatmapSet = beatmap_set);
|
|
|
|
|
AddStep("Set beatmap (no cover)", () => section.BeatmapSet = no_cover_beatmap_set);
|
|
|
|
|
AddStep("Set null beatmap", () => section.BeatmapSet = null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static BeatmapSetInfo beatmap_set = new BeatmapSetInfo
|
|
|
|
|
{
|
|
|
|
|
OnlineInfo = new BeatmapSetOnlineInfo
|
2020-02-18 22:25:12 +08:00
|
|
|
|
{
|
2020-02-18 22:47:44 +08:00
|
|
|
|
Covers = new BeatmapSetOnlineCovers
|
2020-02-18 22:25:12 +08:00
|
|
|
|
{
|
2020-02-18 22:47:44 +08:00
|
|
|
|
Cover = "https://assets.ppy.sh/beatmaps/1094296/covers/cover@2x.jpg?1581416305"
|
2020-02-18 22:25:12 +08:00
|
|
|
|
}
|
2020-02-18 22:47:44 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
2020-02-18 22:25:12 +08:00
|
|
|
|
|
2020-02-18 22:47:44 +08:00
|
|
|
|
private static BeatmapSetInfo no_cover_beatmap_set = new BeatmapSetInfo
|
|
|
|
|
{
|
|
|
|
|
OnlineInfo = new BeatmapSetOnlineInfo
|
|
|
|
|
{
|
|
|
|
|
Covers = new BeatmapSetOnlineCovers
|
|
|
|
|
{
|
|
|
|
|
Cover = string.Empty
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2020-02-18 22:25:12 +08:00
|
|
|
|
}
|
|
|
|
|
}
|