diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2017-06-08 15:30:25 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-08 15:30:25 -0600 |
commit | ac865bb0347246660b924e39b9f417121598c52d (patch) | |
tree | ab3ca573ae778677beb57825366f03db95be9ce1 /Xamarin.Forms.Controls.Issues | |
parent | 3a0aa901641e60aacc1213ff9db94d5b7c3107b3 (diff) | |
download | xamarin-forms-ac865bb0347246660b924e39b9f417121598c52d.tar.gz xamarin-forms-ac865bb0347246660b924e39b9f417121598c52d.tar.bz2 xamarin-forms-ac865bb0347246660b924e39b9f417121598c52d.zip |
Update View Enabled property when IsEnabled changes (#968)
* Actually update Enabled on Android renderers
* Fix test number
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
2 files changed, 67 insertions, 1 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs new file mode 100644 index 00000000..47b4d021 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36703.cs @@ -0,0 +1,65 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 36703, "TapGestureRecognizer inside initially disable Image will never fire Tapped event", PlatformAffected.All)] + public class Bugzilla36703 : TestContentPage + { + const string TestImage = "testimage"; + const string Success = "Success"; + const string Toggle = "toggle"; + const string Testing = "Testing..."; + + protected override void Init() + { + var image = new Image { Source = "coffee.png", IsEnabled = false, AutomationId = TestImage }; + var button = new Button { Text = $"Toggle IsEnabled (now {image.IsEnabled})", AutomationId = Toggle }; + var resultLabel = new Label { Text = "Testing..."}; + var instructions = new Label { Text = $"Tap the image. The '{Testing}' label should remain unchanged. Tap the 'Toggle IsEnabled' button. Now tap the image again. The {Testing} Label should change its text to {Success}." }; + + button.Clicked += (sender, args) => + { + image.IsEnabled = !image.IsEnabled; + button.Text = $"Toggle IsEnabled (now {image.IsEnabled})"; + }; + + Content = new StackLayout + { + Padding = new Thickness(0, 20, 0, 0), + Children = + { + instructions, resultLabel, + image, button + } + }; + + var tapGestureRecognizer = new TapGestureRecognizer(); + tapGestureRecognizer.Tapped += delegate + { + resultLabel.Text = Success; + }; + + image.GestureRecognizers.Add(tapGestureRecognizer); + } + +#if UITEST + [Test] + public void _36703Test() + { + RunningApp.WaitForElement(TestImage); + RunningApp.Tap(TestImage); + RunningApp.WaitForElement(Testing); + RunningApp.Tap(Toggle); + RunningApp.Tap(TestImage); + RunningApp.WaitForElement(Success); + } +#endif + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index d04dbb54..24511b8a 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -82,6 +82,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla36649.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla36559.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla36171.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla36703.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla36846.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla36955.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla37462.cs" /> @@ -708,4 +709,4 @@ <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> </ItemGroup> -</Project> +</Project>
\ No newline at end of file |