mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Add failing beatmap listing sort direction on criteria change test
This commit is contained in:
parent
7c1ccefa4a
commit
df3ccdff9f
@ -14,10 +14,11 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.BeatmapListing;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public partial class TestSceneBeatmapListingSortTabControl : OsuTestScene
|
||||
public partial class TestSceneBeatmapListingSortTabControl : OsuManualInputManagerTestScene
|
||||
{
|
||||
private readonly BeatmapListingSortTabControl control;
|
||||
|
||||
@ -111,6 +112,29 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
resetUsesCriteriaOnCategory(SortCriteria.Updated, SearchCategory.Mine);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSortDirectionOnCriteriaChange()
|
||||
{
|
||||
AddStep("set category to leaderboard", () => control.Reset(SearchCategory.Leaderboard, false));
|
||||
AddAssert("sort direction is descending", () => control.SortDirection.Value == SortDirection.Descending);
|
||||
|
||||
AddStep("click ranked sort button", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(control.TabControl.ChildrenOfType<BeatmapListingSortTabControl.BeatmapTabButton>().Single(s => s.Active.Value));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddAssert("sort direction is ascending", () => control.SortDirection.Value == SortDirection.Ascending);
|
||||
|
||||
AddStep("click first inactive sort button", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(control.TabControl.ChildrenOfType<BeatmapListingSortTabControl.BeatmapTabButton>().First(s => !s.Active.Value));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddAssert("sort direction is descending", () => control.SortDirection.Value == SortDirection.Descending);
|
||||
}
|
||||
|
||||
private void criteriaShowsOnCategory(bool expected, SortCriteria criteria, SearchCategory category)
|
||||
{
|
||||
AddAssert($"{criteria.ToString().ToLowerInvariant()} {(expected ? "shown" : "not shown")} on {category.ToString().ToLowerInvariant()}", () =>
|
||||
|
@ -102,7 +102,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
};
|
||||
}
|
||||
|
||||
private partial class BeatmapTabButton : TabButton
|
||||
public partial class BeatmapTabButton : TabButton
|
||||
{
|
||||
public readonly Bindable<SortDirection> SortDirection = new Bindable<SortDirection>();
|
||||
|
||||
|
@ -117,7 +117,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
protected partial class TabButton : HeaderButton
|
||||
public partial class TabButton : HeaderButton
|
||||
{
|
||||
public readonly BindableBool Active = new BindableBool();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user