Skip to content

Commit

Permalink
feat(Droid): Enabled TextBox.CharacterCasing
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Oct 8, 2020
1 parent 89a854f commit a0d714c
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -557,5 +557,78 @@ public void TextBox_IsReadOnly_AcceptsReturn_Test()
multilineTextRect.Height.Should().Be(multilineReadonlyTextRect.Height, because: "toggling IsReadOnly should not affect AcceptsReturn=True(multiline) TextBox.Height");
normalTextRect.Height.Should().NotBe(multilineTextRect.Height, because: "toggling AcceptsReturn should not affect TextBox.Height");
}

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android)]
public void TextBox_CharacterCasingNormal_ShouldAcceptAllCasing_Test()
{
const string text = "Uno Platform";

Run("UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_CharacterCasing");

var normalCasingTextBox = _app.Marked("NormalCasingTextBox");

normalCasingTextBox.Tap();
normalCasingTextBox.ClearText();
normalCasingTextBox.EnterText(text);

Assert.AreEqual(text, normalCasingTextBox.GetDependencyPropertyValue("Text")?.ToString());
}

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android)]
public void TextBox_CharacterCasingDefault_ShouldAcceptAllCasing_Test()
{
const string text = "Uno Platform";

Run("UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_CharacterCasing");

var defaultCasingTextBox = _app.Marked("DefaultCasingTextBox");

defaultCasingTextBox.Tap();
defaultCasingTextBox.ClearText();
defaultCasingTextBox.EnterText(text);

Assert.AreEqual(text, defaultCasingTextBox.GetDependencyPropertyValue("Text")?.ToString());
}

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android)]
public void TextBox_CharacterCasingLower_ShouldBeAllLower_Test()
{
const string text = "Uno Platform";

Run("UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_CharacterCasing");

var lowerCasingTextBox = _app.Marked("LowerCasingTextBox");

lowerCasingTextBox.Tap();
lowerCasingTextBox.ClearText();
lowerCasingTextBox.EnterText(text);

Assert.AreEqual(text.ToLowerInvariant(), lowerCasingTextBox.GetDependencyPropertyValue("Text")?.ToString());
}

[Test]
[AutoRetry]
[ActivePlatforms(Platform.Android)]
public void TextBox_CharacterCasingUpper_ShouldBeAllUpper_Test()
{
const string text = "Uno Platform";

Run("UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_CharacterCasing");

var upperCasingTextBox = _app.Marked("UpperCasingTextBox");

upperCasingTextBox.Tap();
upperCasingTextBox.ClearText();
upperCasingTextBox.EnterText(text);

Assert.AreEqual(text.ToUpperInvariant(), upperCasingTextBox.GetDependencyPropertyValue("Text")?.ToString());
}

}
}
7 changes: 7 additions & 0 deletions src/SamplesApp/UITests.Shared/UITests.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_CharacterCasing.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_CornerRadius.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -4192,6 +4196,9 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_Binding_Null.xaml.cs">
<DependentUpon>TextBox_Binding_Null.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_CharacterCasing.xaml.cs">
<DependentUpon>TextBox_CharacterCasing.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Controls\TextBox\TextBox_CornerRadius.xaml.cs">
<DependentUpon>TextBox_CornerRadius.xaml</DependentUpon>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<UserControl
x:Class="UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests.TextBox_CharacterCasing"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UITests.Windows_UI_Xaml_Controls.TextBox"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">

<StackPanel Padding="20" Spacing="20">

<TextBox Header="Default"
x:Name="DefaultCasingTextBox"
PlaceholderText="Default (any casing)"/>

<TextBox Header="Lower"
x:Name="LowerCasingTextBox"
PlaceholderText="Only Lower Text"
CharacterCasing="Lower" />

<TextBox Header="Upper"
x:Name="UpperCasingTextBox"
PlaceholderText="Only Upper Text"
CharacterCasing="Upper"/>

<TextBox Header="Normal"
x:Name="NormalCasingTextBox"
PlaceholderText="Normal (any casing)"
CharacterCasing="Normal"/>
</StackPanel>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Uno.UI.Samples.Controls;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace UITests.Shared.Windows_UI_Xaml_Controls.TextBoxTests
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
///
[SampleControlInfo("TextBox", description: "TextBox_CharacterCasing")]
public sealed partial class TextBox_CharacterCasing : UserControl
{
public TextBox_CharacterCasing()
{
this.InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
#pragma warning disable 114 // new keyword hiding
namespace Windows.UI.Xaml.Controls
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false || false || false || false || false || false || false
#if false || false || false || false || false || false || false
[global::Uno.NotImplemented]
#endif
public enum CharacterCasing
public enum CharacterCasing
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false || false || false || false || false || false || false
Normal,
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false || false || false || false || false || false || false
Lower,
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false || false || false || false || false || false || false
Upper,
#endif
}
Expand Down
Loading

0 comments on commit a0d714c

Please sign in to comment.