-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6499 from Susko3/simple-text-input-props-test
Add simple `InputProperties` / `TextInputType` test
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
osu.Framework.Tests/Visual/UserInterface/TestSceneTextInputProperties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}, | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
} |