osu/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 11:28:39 +00:00
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
2018-07-25 12:14:40 +00:00
using osu.Framework.Graphics.Containers;
2019-09-24 10:00:26 +00:00
using osu.Game.Graphics.UserInterfaceV2;
2018-07-20 11:28:39 +00:00
2019-03-24 16:02:36 +00:00
namespace osu.Game.Tests.Visual.UserInterface
2018-07-20 11:28:39 +00:00
{
[TestFixture]
public class TestSceneLabelledTextBox : OsuTestScene
2018-07-20 11:28:39 +00: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 11:28:39 +00:00
[BackgroundDependencyLoader]
private void load()
{
2018-07-25 12:14:40 +00:00
Child = new Container
2018-07-20 11:28:39 +00:00
{
2018-07-25 12:14:40 +00:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Left = 150, Right = 150 },
Child = new LabelledTextBox
2018-07-20 11:28:39 +00:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Label = "Testing text",
2018-07-23 12:44:10 +00:00
PlaceholderText = "This is definitely working as intended",
2018-07-20 11:28:39 +00:00
}
};
}
}
}