Skip to content

Commit

Permalink
Add simple InputProperties / TextInputType test
Browse files Browse the repository at this point in the history
  • Loading branch information
Susko3 committed Jan 20, 2025
1 parent fe9fc8b commit 93950aa
Showing 1 changed file with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// 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(0, 13),
}
};

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

0 comments on commit 93950aa

Please sign in to comment.