Skip to content

Commit

Permalink
Merge pull request #6499 from Susko3/simple-text-input-props-test
Browse files Browse the repository at this point in the history
Add simple `InputProperties` / `TextInputType` test
  • Loading branch information
smoogipoo authored Jan 21, 2025
2 parents c0424c3 + b198ac5 commit c7aa917
Showing 1 changed file with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Testing;
using osuTK;

namespace osu.Framework.Tests.Visual.UserInterface
{
public partial class TestSceneTextInputProperties : FrameworkTestScene
{
[SetUpSteps]
public void SetUpSteps()
{
AddStep("Create text boxes", () =>
{
FillFlowContainer flow;
Child = new BasicScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Width = 0.9f,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Spacing = new Vector2(20, 13),
}
};

foreach (var textInputType in Enum.GetValues<TextInputType>())
{
flow.Add(new BasicTextBox
{
TabbableContentContainer = flow,
RelativeSizeAxes = Axes.X,
Height = 40,
Width = 0.45f,
PlaceholderText = $"{textInputType} (allow IME)",
InputProperties = new TextInputProperties
{
Type = textInputType,
AllowIme = true
},
});
flow.Add(new BasicTextBox
{
TabbableContentContainer = flow,
RelativeSizeAxes = Axes.X,
Height = 40,
Width = 0.45f,
PlaceholderText = $"{textInputType} (no IME)",
InputProperties = new TextInputProperties
{
Type = textInputType,
AllowIme = false
},
});
}
});
}
}
}

0 comments on commit c7aa917

Please sign in to comment.