Merge pull request #7924 from EVAST9919/beatmap-listing-expanded

Implement sorting by genre and language in BeatmapListingOverlay
This commit is contained in:
Dean Herbert
2020-04-21 16:34:59 +09:00
committed by GitHub
16 changed files with 423 additions and 244 deletions

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using osu.Game.Overlays;
using NUnit.Framework;
using osu.Game.Overlays.BeatmapListing;
namespace osu.Game.Tests.Visual.Online
{
@ -13,6 +14,7 @@ namespace osu.Game.Tests.Visual.Online
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(BeatmapListingOverlay),
typeof(BeatmapListingFilterControl)
};
protected override bool UseOnlineAPI => true;

View File

@ -15,25 +15,27 @@ using osuTK;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneBeatmapListingSearchSection : OsuTestScene
public class TestSceneBeatmapListingSearchControl : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(BeatmapListingSearchSection),
typeof(BeatmapListingSearchControl),
};
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
private readonly BeatmapListingSearchSection section;
private readonly BeatmapListingSearchControl control;
public TestSceneBeatmapListingSearchSection()
public TestSceneBeatmapListingSearchControl()
{
OsuSpriteText query;
OsuSpriteText ruleset;
OsuSpriteText category;
OsuSpriteText genre;
OsuSpriteText language;
Add(section = new BeatmapListingSearchSection
Add(control = new BeatmapListingSearchControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -49,20 +51,24 @@ namespace osu.Game.Tests.Visual.UserInterface
query = new OsuSpriteText(),
ruleset = new OsuSpriteText(),
category = new OsuSpriteText(),
genre = new OsuSpriteText(),
language = new OsuSpriteText(),
}
});
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);
control.Query.BindValueChanged(q => query.Text = $"Query: {q.NewValue}", true);
control.Ruleset.BindValueChanged(r => ruleset.Text = $"Ruleset: {r.NewValue}", true);
control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
control.Language.BindValueChanged(l => language.Text = $"Language: {l.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);
AddStep("Set beatmap", () => control.BeatmapSet = beatmap_set);
AddStep("Set beatmap (no cover)", () => control.BeatmapSet = no_cover_beatmap_set);
AddStep("Set null beatmap", () => control.BeatmapSet = null);
}
private static readonly BeatmapSetInfo beatmap_set = new BeatmapSetInfo

View File

@ -13,18 +13,17 @@ using osuTK;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneBeatmapListingSort : OsuTestScene
public class TestSceneBeatmapListingSortTabControl : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(BeatmapListingSortTabControl),
typeof(OverlaySortTabControl<>),
};
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
public TestSceneBeatmapListingSort()
public TestSceneBeatmapListingSortTabControl()
{
BeatmapListingSortTabControl control;
OsuSpriteText current;

View File

@ -8,7 +8,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapListing;
using osuTK;
@ -20,8 +19,7 @@ namespace osu.Game.Tests.Visual.UserInterface
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(BeatmapSearchFilterRow<>),
typeof(BeatmapSearchRulesetFilterRow),
typeof(BeatmapSearchSmallFilterRow<>),
typeof(BeatmapSearchRulesetFilterRow)
};
[Cached]
@ -42,8 +40,8 @@ namespace osu.Game.Tests.Visual.UserInterface
Children = new Drawable[]
{
new BeatmapSearchRulesetFilterRow(),
new BeatmapSearchFilterRow<BeatmapSearchCategory>("Categories"),
new BeatmapSearchSmallFilterRow<BeatmapSearchCategory>("Header Name")
new BeatmapSearchFilterRow<SearchCategory>("Categories"),
new BeatmapSearchFilterRow<SearchCategory>("Header Name")
}
});
}