1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 01:07:24 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestScenePageSelector.cs

55 lines
1.6 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)
};
2019-09-10 06:36:25 +08:00
private readonly PageSelector pageSelector;
2019-09-07 12:31:07 +08:00
public TestScenePageSelector()
{
2019-09-10 06:36:25 +08:00
Child = pageSelector = new PageSelector
2019-09-07 12:31:07 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
2019-09-08 05:27:40 +08:00
2019-09-10 06:36:25 +08:00
AddStep("10 max pages", () => setMaxPages(10));
AddStep("200 max pages, current 199", () =>
2019-09-08 05:27:40 +08:00
{
2019-09-10 06:36:25 +08:00
setMaxPages(200);
setCurrentPage(199);
});
AddStep("200 max pages, current 201", () =>
{
setMaxPages(200);
setCurrentPage(201);
});
AddStep("200 max pages, current -10", () =>
{
setMaxPages(200);
setCurrentPage(-10);
});
AddStep("-10 max pages", () =>
{
setMaxPages(-10);
});
}
2019-09-08 05:27:40 +08:00
2019-09-10 06:36:25 +08:00
private void setMaxPages(int maxPages) => pageSelector.MaxPages.Value = maxPages;
2019-09-08 05:27:40 +08:00
2019-09-10 06:36:25 +08:00
private void setCurrentPage(int currentPage) => pageSelector.CurrentPage.Value = currentPage;
2019-09-07 12:31:07 +08:00
}
}