2019-01-24 16:43:03 +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.
|
2018-07-20 19:28:39 +08:00
|
|
|
|
|
2019-03-25 00:02:36 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
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 17:25:17 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
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]
|
2019-05-15 03:37:25 +08:00
|
|
|
|
public class TestSceneLabelledTextBox : OsuTestScene
|
2018-07-20 19:28:39 +08:00
|
|
|
|
{
|
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(LabelledTextBox),
|
|
|
|
|
};
|
|
|
|
|
|
2019-09-20 17:50:50 +08:00
|
|
|
|
[TestCase(false)]
|
|
|
|
|
[TestCase(true)]
|
|
|
|
|
public void TestTextBox(bool hasDescription) => createTextBox(hasDescription);
|
|
|
|
|
|
|
|
|
|
private void createTextBox(bool hasDescription = false)
|
|
|
|
|
{
|
|
|
|
|
AddStep("create component", () =>
|
|
|
|
|
{
|
2019-09-24 17:25:17 +08:00
|
|
|
|
LabelledComponent<OsuTextBox> component;
|
2019-09-20 17:50:50 +08:00
|
|
|
|
|
|
|
|
|
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,
|
2019-09-20 17:50:50 +08:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|