1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 23:07:44 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneLabelledTextBox.cs

65 lines
2.1 KiB
C#
Raw Normal View History

// 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.
2018-07-20 19:28:39 +08:00
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2018-07-25 20:14:40 +08:00
using osu.Framework.Graphics.Containers;
2019-09-24 18:00:26 +08:00
using osu.Game.Graphics.UserInterfaceV2;
2018-07-20 19:28:39 +08:00
2019-03-25 00:02:36 +08:00
namespace osu.Game.Tests.Visual.UserInterface
2018-07-20 19:28:39 +08:00
{
[TestFixture]
public class TestSceneLabelledTextBox : OsuTestScene
2018-07-20 19:28:39 +08:00
{
[TestCase(false)]
[TestCase(true)]
public void TestTextBox(bool hasDescription) => createTextBox(hasDescription);
private void createTextBox(bool hasDescription = false)
{
AddStep("create component", () =>
{
LabelledTextBox component;
Child = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 500,
AutoSizeAxes = Axes.Y,
Child = component = new LabelledTextBox
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Label = "Testing text",
PlaceholderText = "This is definitely working as intended",
}
};
component.Label = "a sample component";
component.Description = hasDescription ? "this text describes the component" : string.Empty;
});
}
2018-07-20 19:28:39 +08:00
[BackgroundDependencyLoader]
private void load()
{
2018-07-25 20:14:40 +08:00
Child = new Container
2018-07-20 19:28:39 +08:00
{
2018-07-25 20:14:40 +08:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Left = 150, Right = 150 },
Child = new LabelledTextBox
2018-07-20 19:28:39 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Label = "Testing text",
2018-07-23 20:44:10 +08:00
PlaceholderText = "This is definitely working as intended",
2018-07-20 19:28:39 +08:00
}
};
}
}
}