Skip to content

Instantly share code, notes, and snippets.

@adrianknight89
Created December 3, 2016 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianknight89/ba0b76b16b364c7718a4468bc0c2fab9 to your computer and use it in GitHub Desktop.
Save adrianknight89/ba0b76b16b364c7718a4468bc0c2fab9 to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
// Apply the default category of "Issues" to all of the tests in this assembly
// We use this as a catch-all for tests which haven't been individually categorized
#if UITEST
[assembly: NUnit.Framework.Category("Issues")]
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 43993, "iOS: ListView size does not return to normal after keyboard disappears", PlatformAffected.iOS)]
public class Bugzilla43993 : TestContentPage // or TestMasterDetailPage, etc ...
{
ListView _listView;
protected override void Init()
{
var grid = new Grid { RowSpacing = 0 };
grid.RowDefinitions.Add(new RowDefinition { Height = 50 });
grid.RowDefinitions.Add(new RowDefinition { Height = 50 });
grid.RowDefinitions.Add(new RowDefinition());
grid.RowDefinitions.Add(new RowDefinition { Height = 50 });
var contentView = new ContentView() { BackgroundColor = Color.Red };
grid.AddChild(contentView, 0, 0);
var entry = new Entry { AutomationId = "entry", BackgroundColor = Color.Blue };
grid.AddChild(entry, 0, 1);
var list = new List<int>();
for (var i = 0; i < 100; i++)
{
list.Add(i);
}
_listView = new ListView() { ItemsSource = list };
grid.AddChild(_listView, 0, 2);
var contentView2 = new ContentView() { BackgroundColor = Color.Yellow };
grid.AddChild(contentView2, 0, 3);
Content = grid;
NavigationPage.SetHasNavigationBar(this, false);
}
protected override void OnAppearing()
{
base.OnAppearing();
_listView.ScrollTo(99, ScrollToPosition.End, false);
}
#if UITEST
[Test]
public void Issue43993Test ()
{
RunningApp.WaitForElement(q => q.Marked("99"));
RunningApp.WaitForElement(q => q.Marked("entry"));
RunningApp.Tap(q => q.Marked("entry"));
RunningApp.EnterText(q => q.Marked("entry"), "Typing");
RunningApp.DismissKeyboard();
RunningApp.WaitForElement(q => q.Marked("99"));
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment