Class TouchInputFieldTests
Inheritance
TouchInputFieldTests
Implements
IPrebuildSetup
Assembly: UnityEngine.UI.Tests.dll
public class TouchInputFieldTests : BaseInputFieldTests, IPrebuildSetup
Fields
Declaration
protected const string kDefaultInputStr = "foobar"
Field Value
Declaration
protected const string kPrefabPath = "Assets/Resources/TouchInputFieldPrefab.prefab"
Field Value
Methods
Declaration
[Test]
public void AssignmentAgainstCharacterLimit(string text)
Parameters
Type |
Name |
Description |
string |
text |
|
AssignmentAgainstCharacterLimitWithContentType(string)
Declaration
[Test]
public void AssignmentAgainstCharacterLimitWithContentType(string text)
Parameters
Type |
Name |
Description |
string |
text |
|
Declaration
[UnityTest]
public IEnumerator AssignsShouldHideInput()
Returns
Declaration
[UnityTest]
public IEnumerator FocusOpensTouchScreenKeyboard()
Returns
Declaration
[Test]
[TestCase("*Azé09", "*Azé09", InputField.CharacterValidation.None)]
[TestCase("*Azé09?.", "Az09", InputField.CharacterValidation.Alphanumeric)]
[TestCase("Abc10x", "10", InputField.CharacterValidation.Integer)]
[TestCase("-10", "-10", InputField.CharacterValidation.Integer)]
[TestCase("10.0", "100", InputField.CharacterValidation.Integer)]
[TestCase("10.0", "10.0", InputField.CharacterValidation.Decimal)]
[TestCase(" -10.0x", "-10.0", InputField.CharacterValidation.Decimal)]
[TestCase("10,0", "10,0", InputField.CharacterValidation.Decimal)]
[TestCase(" -10,0x", "-10,0", InputField.CharacterValidation.Decimal)]
[TestCase("A10,0 ", "10,0", InputField.CharacterValidation.Decimal)]
[TestCase("A'a aaa aaa", "A'a Aaa Aaa", InputField.CharacterValidation.Name)]
[TestCase("Unity-Editor", "Unity-Editor", InputField.CharacterValidation.Name)]
[TestCase("Unity--Editor", "Unity-Editor", InputField.CharacterValidation.Name)]
[TestCase("-UnityEditor", "Unityeditor", InputField.CharacterValidation.Name)]
[TestCase(" _JOHN* (Doe)", "John Doe", InputField.CharacterValidation.Name)]
[TestCase("johndoe@unity3d.com", "johndoe@unity3d.com", InputField.CharacterValidation.EmailAddress)]
[TestCase(">john doe\\@unity3d.com", "johndoe@unity3d.com", InputField.CharacterValidation.EmailAddress)]
[TestCase("!#$%&'*+-/=?^_`{|}~@unity3d.com", "!#$%&'*+-/=?^_`{|}~@unity3d.com", InputField.CharacterValidation.EmailAddress)]
public void HonorsCharacterValidationSettingsAssignment(string input, string output, InputField.CharacterValidation validation)
Parameters
Declaration
[UnityTest]
[TestCase("*Azé09", "*Azé09", InputField.CharacterValidation.None, ExpectedResult = null)]
[TestCase("*Azé09?.", "Az09", InputField.CharacterValidation.Alphanumeric, ExpectedResult = null)]
[TestCase("Abc10x", "10", InputField.CharacterValidation.Integer, ExpectedResult = null)]
[TestCase("-10", "-10", InputField.CharacterValidation.Integer, ExpectedResult = null)]
[TestCase("10.0", "100", InputField.CharacterValidation.Integer, ExpectedResult = null)]
[TestCase("10.0", "10.0", InputField.CharacterValidation.Decimal, ExpectedResult = null)]
[TestCase(" -10.0x", "-10.0", InputField.CharacterValidation.Decimal, ExpectedResult = null)]
[TestCase("10,0", "10,0", InputField.CharacterValidation.Decimal, ExpectedResult = null)]
[TestCase(" -10,0x", "-10,0", InputField.CharacterValidation.Decimal, ExpectedResult = null)]
[TestCase("A10,0 ", "10,0", InputField.CharacterValidation.Decimal, ExpectedResult = null)]
[TestCase("A'a aaa aaa", "A'a Aaa Aaa", InputField.CharacterValidation.Name, ExpectedResult = null)]
[TestCase(" _JOHN* (Doe)", "John Doe", InputField.CharacterValidation.Name, ExpectedResult = null)]
[TestCase("johndoe@unity3d.com", "johndoe@unity3d.com", InputField.CharacterValidation.EmailAddress, ExpectedResult = null)]
[TestCase(">john doe\\@unity3d.com", "johndoe@unity3d.com", InputField.CharacterValidation.EmailAddress, ExpectedResult = null)]
[TestCase("!#$%&'*+-/=?^_`{|}~@unity3d.com", "!#$%&'*+-/=?^_`{|}~@unity3d.com", InputField.CharacterValidation.EmailAddress, ExpectedResult = null)]
public IEnumerator HonorsCharacterValidationSettingsTypingWithSelection(string input, string output, InputField.CharacterValidation validation)
Parameters
Returns
Declaration
[UnityTest]
[UnityPlatform(exclude = new RuntimePlatform[] { RuntimePlatform.IPhonePlayer, RuntimePlatform.PS4, RuntimePlatform.PS5, RuntimePlatform.VisionOS })]
public IEnumerator IsTouchScreenKeyboardVisible()
Returns
Declaration
[OneTimeTearDown]
public void OnetimeTearDown()
Declaration
[UnityTest]
public IEnumerator SendsEndEditEventOnDeselect()
Returns
Implement this method to call actions automatically before the build process.
Declaration
[TestFixture]
public class CreateSpriteTest : IPrebuildSetup
{
Texture2D m_Texture;
Sprite m_Sprite;
public void Setup()
{
#if UNITY_EDITOR
var spritePath = "Assets/Resources/Circle.png";
var ti = UnityEditor.AssetImporter.GetAtPath(spritePath) as UnityEditor.TextureImporter;
ti.textureCompression = UnityEditor.TextureImporterCompression.Uncompressed;
ti.SaveAndReimport();
#endif
}
[SetUp]
public void SetUpTest()
{
m_Texture = Resources.Load<Texture2D>("Circle");
}
[Test]
public void WhenNullTextureIsPassed_CreateShouldReturnNullSprite()
{
// Check with Valid Texture.
LogAssert.Expect(LogType.Log, "Circle Sprite Created");
Sprite.Create(m_Texture, new Rect(0, 0, m_Texture.width, m_Texture.height), new Vector2(0.5f, 0.5f));
Debug.Log("Circle Sprite Created");
// Check with NULL Texture. Should return NULL Sprite.
m_Sprite = Sprite.Create(null, new Rect(0, 0, m_Texture.width, m_Texture.height), new Vector2(0.5f, 0.5f));
Assert.That(m_Sprite, Is.Null, "Sprite created with null texture should be null");
}
}
Declaration
[Test]
public void StripsNullCharacters2()
Declaration
[TearDown]
public void TearDown()
Declaration
[SetUp]
public void TestSetup()
Implements
UnityEngine.TestTools.IPrebuildSetup