summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38978.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38978.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38978.cs90
1 files changed, 90 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38978.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38978.cs
new file mode 100644
index 00000000..9d8ce68b
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38978.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Linq;
+
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 38978, "Cell.ForceUpdateSize issues with row selection/deselection (ViewCell)", PlatformAffected.Android)]
+ public class Bugzilla38978 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ [Preserve (AllMembers = true)]
+ public class MyViewCell : ViewCell
+ {
+ Image _image;
+ public MyViewCell ()
+ {
+ _image = new Image {
+ Source = ImageSource.FromFile ("oasis.jpg"),
+ HeightRequest = 50
+ };
+
+ Label label = new Label { Text = "Click the image to resize", VerticalOptions = LayoutOptions.Center };
+
+ var tapGestureRecognizer = new TapGestureRecognizer ();
+ tapGestureRecognizer.Tapped += (object sender, EventArgs e) => {
+ if (_image.HeightRequest < 250) {
+ _image.HeightRequest = _image.Height + 100;
+ ForceUpdateSize ();
+ label.Text = "If the tapped image is not larger, this test has failed.";
+ }
+ };
+ _image.GestureRecognizers.Add (tapGestureRecognizer);
+
+ var stackLayout = new StackLayout {
+ Padding = new Thickness (20, 5, 5, 5),
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ _image,
+ label
+ }
+ };
+
+ View = stackLayout;
+ }
+
+ protected override void OnBindingContextChanged ()
+ {
+ base.OnBindingContextChanged ();
+ var item = BindingContext?.ToString();
+ if (string.IsNullOrWhiteSpace (item))
+ return;
+
+ _image.AutomationId = item;
+ }
+ }
+
+ protected override void Init ()
+ {
+ var listView = new ListView {
+ HasUnevenRows = true,
+ ItemTemplate = new DataTemplate (typeof (MyViewCell)),
+ ItemsSource = Enumerable.Range (0, 10)
+ };
+
+ Content = new StackLayout {
+ Padding = new Thickness (0, 20, 0, 0),
+ Children = {
+ listView
+ }
+ };
+ }
+
+#if UITEST
+ [Test]
+ [Category("ManualReview")]
+ public void Bugzilla38978Test ()
+ {
+ RunningApp.WaitForElement (q => q.Marked ("2"));
+ RunningApp.Tap (q => q.Marked ("2"));
+ RunningApp.Screenshot("If the tapped image is not larger, this test has failed.");
+ }
+#endif
+ }
+}