1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 20:47:25 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestScenePageSelector.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2019-09-07 12:31:07 +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;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestScenePageSelector : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(PageSelector)
};
public TestScenePageSelector()
{
Child = new PageSelector(200)
2019-09-07 12:31:07 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
2019-09-08 05:27:40 +08:00
AddStep("1 max pages", () => redraw(1));
AddStep("10 max pages", () => redraw(10));
AddStep("200 max pages, current 199", () => redraw(200, 199));
AddStep("200 max pages, current 201", () => redraw(200, 201));
AddStep("200 max pages, current -10", () => redraw(200, -10));
}
private void redraw(int maxPages, int currentPage = 0)
{
Clear();
var selector = new PageSelector(maxPages)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
if (currentPage != 0)
selector.CurrentPage.Value = currentPage;
Add(selector);
2019-09-07 12:31:07 +08:00
}
}
}