diff options
author | Samantha Houts <samantha@teamredwall.com> | 2016-06-17 03:10:18 -0700 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-06-17 11:10:18 +0100 |
commit | 925fc0aa588a060eb23fa16c1d225dd030012c23 (patch) | |
tree | 83676c25c29d97d9250516b217020ba85425796d /Xamarin.Forms.Controls.Issues | |
parent | d44396a4534b1e2bc81143c809e4adaee656ab15 (diff) | |
download | xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.gz xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.tar.bz2 xamarin-forms-925fc0aa588a060eb23fa16c1d225dd030012c23.zip |
Prep Cell & friends for removal of InternalsVisibleTo (#142)
* Prep Cell & friends for removal of InternalsVisibleTo
Includes:
- Cell
- EntryCell
- ListView
- MenuItem
- TableView
- ViewCell
- Toolbar
Moved extensions to Internal & removed TPH
* Update docs
* [Controls] Ignore Issue2411 on iOS <9
* [Controls] Formatting for Issue2411
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2411.cs | 230 |
1 files changed, 134 insertions, 96 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2411.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2411.cs index 20c73c93..70e81197 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2411.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2411.cs @@ -15,90 +15,97 @@ using Xamarin.UITest; namespace Xamarin.Forms.Controls.TestCasesPages { - [Preserve (AllMembers=true)] - [Issue (IssueTracker.Github, 2411, "ListView.ScrollTo not working in TabbedPage", PlatformAffected.Android)] + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Github, 2411, "ListView.ScrollTo not working in TabbedPage", PlatformAffected.Android)] public class Issue2411 : TestTabbedPage { - protected override void Init () + protected override void Init() { - Children.Add (new XamarinListViewScrollToBugPage1 ()); - Children.Add (new XamarinListViewScrollToBugPage2 ()); - Children.Add (new XamarinListViewScrollToBugPage3 ()); + Children.Add(new XamarinListViewScrollToBugPage1()); + Children.Add(new XamarinListViewScrollToBugPage2()); + Children.Add(new XamarinListViewScrollToBugPage3()); } #if UITEST [Test] #if __ANDROID__ - [Ignore ("Appearing event is tied to virtualization in TabbedPage for Material")] + [Ignore("Appearing event is tied to virtualization in TabbedPage for Material")] #endif - [Issue (IssueTracker.Github, 2411, "ScrollToPositon.MakeVisible not called every time TabbedPage", PlatformAffected.Android)] - public void Issue2411ScrollToPositionMakeVisible () + [Issue(IssueTracker.Github, 2411, "ScrollToPosition.MakeVisible not called every time TabbedPage", PlatformAffected.Android)] + public void Issue2411ScrollToPositionMakeVisible() { - RunningApp.WaitForElement (q => q.Marked ("99 99 99 99 99 99")); - RunningApp.Screenshot ("ScrollTo working correctly"); - RunningApp.Tap (q => q.Marked ("Crash in ScrollToPosition.End")); - RunningApp.Screenshot ("On Second Tab"); - RunningApp.WaitForElement (q => q.Marked ("2 0 0 0 0 0 0")); - RunningApp.Tap (q => q.Marked ("Scroll To in OnAppearing")); - RunningApp.Screenshot ("On First Tab"); - RunningApp.WaitForElement (q => q.Marked ("99 99 99 99 99 99")); - - var listViewBound = RunningApp.Query (q => q.Marked ("listView"))[0].Rect; - Xamarin.Forms.Core.UITests.Gestures.ScrollForElement (RunningApp, "* marked:'0 0 0 0 0 0'", new Xamarin.Forms.Core.UITests.Drag (listViewBound, Xamarin.Forms.Core.UITests.Drag.Direction.TopToBottom, Xamarin.Forms.Core.UITests.Drag.DragLength.Long)); - RunningApp.Screenshot ("Scrolled to Top"); - - RunningApp.Tap (q => q.Marked ("Crash in ScrollToPosition.End")); - RunningApp.Screenshot ("On Second Tab"); - RunningApp.WaitForElement (q => q.Marked ("2 0 0 0 0 0 0")); - RunningApp.Tap (q => q.Marked ("Scroll To in OnAppearing")); - RunningApp.Screenshot ("On First Tab"); - RunningApp.WaitForElement (q => q.Marked ("99 99 99 99 99 99")); + RunningApp.WaitForElement(q => q.Marked("99 99 99 99 99 99")); + RunningApp.Screenshot("ScrollTo working correctly"); + RunningApp.Tap(q => q.Marked("Crash in ScrollToPosition.End")); + RunningApp.Screenshot("On Second Tab"); + RunningApp.WaitForElement(q => q.Marked("2 0 0 0 0 0 0")); + RunningApp.Tap(q => q.Marked("Scroll To in OnAppearing")); + RunningApp.Screenshot("On First Tab"); + RunningApp.WaitForElement(q => q.Marked("99 99 99 99 99 99")); + + var listViewBound = RunningApp.Query(q => q.Marked("listView"))[0].Rect; + Xamarin.Forms.Core.UITests.Gestures.ScrollForElement(RunningApp, "* marked:'0 0 0 0 0 0'", new Xamarin.Forms.Core.UITests.Drag(listViewBound, Xamarin.Forms.Core.UITests.Drag.Direction.TopToBottom, Xamarin.Forms.Core.UITests.Drag.DragLength.Long)); + RunningApp.Screenshot("Scrolled to Top"); + + RunningApp.Tap(q => q.Marked("Crash in ScrollToPosition.End")); + RunningApp.Screenshot("On Second Tab"); + RunningApp.WaitForElement(q => q.Marked("2 0 0 0 0 0 0")); + RunningApp.Tap(q => q.Marked("Scroll To in OnAppearing")); + RunningApp.Screenshot("On First Tab"); + RunningApp.WaitForElement(q => q.Marked("99 99 99 99 99 99")); } [Test] - [Issue (IssueTracker.Github, 2411, "ScrollToPositon.End crashing in TabbedPage", PlatformAffected.Android)] - public void Issue2411ScrollToPositionEndCrash () + [Issue(IssueTracker.Github, 2411, "ScrollToPosition.End crashing in TabbedPage", PlatformAffected.Android)] + public void Issue2411ScrollToPositionEndCrash() { - RunningApp.Tap (q => q.Marked ("Crash in ScrollToPosition.End")); - RunningApp.Screenshot ("On Second Tab"); - RunningApp.Tap (q => q.Marked ("Scroll To in OnAppearing")); - RunningApp.Screenshot ("On First Tab"); - RunningApp.Tap (q => q.Marked ("Crash in ScrollToPosition.End")); - RunningApp.Screenshot ("On Second Tab Again"); - RunningApp.Tap (q => q.Marked ("ScrollToPosition.End End - Not animated")); - RunningApp.WaitForElement (q => q.Marked ("2 99 99 99 99 99 99")); + RunningApp.Tap(q => q.Marked("Crash in ScrollToPosition.End")); + RunningApp.Screenshot("On Second Tab"); + RunningApp.Tap(q => q.Marked("Scroll To in OnAppearing")); + RunningApp.Screenshot("On First Tab"); + RunningApp.Tap(q => q.Marked("Crash in ScrollToPosition.End")); + RunningApp.Screenshot("On Second Tab Again"); + RunningApp.Tap(q => q.Marked("ScrollToPosition.End End - Not animated")); + RunningApp.WaitForElement(q => q.Marked("2 99 99 99 99 99 99")); } [Test] - [Issue (IssueTracker.Github, 2411, "ScrollToPositon.End crashing in TabbedPage", PlatformAffected.Android)] - public void Issue2411ScrollToPositionWrongOnUneven () + [Issue(IssueTracker.Github, 2411, "ScrollToPositon.End crashing in TabbedPage", PlatformAffected.Android)] + public void Issue2411ScrollToPositionWrongOnUneven() { - RunningApp.Tap (q => q.Marked ("Crash in ScrollToPosition.End")); - RunningApp.Tap (q => q.Marked ("Scroll To in OnAppearing Uneven")); - RunningApp.Screenshot ("On Third Tab"); - RunningApp.WaitForElement (q => q.Marked ("99 99 99 99 99 99")); + RunningApp.Tap(q => q.Marked("Crash in ScrollToPosition.End")); + RunningApp.Tap(q => q.Marked("Scroll To in OnAppearing Uneven")); + + var dontRun = RunningApp.Query(q => q.Marked(XamarinListViewScrollToBugPage3.DontRun)); + if (dontRun.Length > 0) + Assert.Inconclusive("Ignored on iOS < 9 until Bugzilla 28277 is resolved."); + + RunningApp.Screenshot("On Third Tab"); + RunningApp.WaitForElement(q => q.Marked("99 99 99 99 99 99")); } #endif } - [Preserve (AllMembers = true)] + [Preserve(AllMembers = true)] internal class ListObj { public string Name { get; set; } } - [Preserve (AllMembers = true)] + [Preserve(AllMembers = true)] public class CellTemplateScrollTo : ViewCell { - public CellTemplateScrollTo () + public CellTemplateScrollTo() { - Label cellLabel = new Label () { + Label cellLabel = new Label() + { HorizontalOptions = LayoutOptions.FillAndExpand, }; - cellLabel.SetBinding (Label.TextProperty, new Binding ("Name", BindingMode.OneWay)); + cellLabel.SetBinding(Label.TextProperty, new Binding("Name", BindingMode.OneWay)); - StackLayout root = new StackLayout () { + StackLayout root = new StackLayout() + { Children = { cellLabel } @@ -108,87 +115,97 @@ namespace Xamarin.Forms.Controls.TestCasesPages } } - [Preserve (AllMembers = true)] + [Preserve(AllMembers = true)] public class CellTemplateScrollToUneven : CellTemplateScrollTo { - public CellTemplateScrollToUneven () + public CellTemplateScrollToUneven() { Height = 60 + new Random().Next(10, 100); } } - [Preserve (AllMembers = true)] + [Preserve(AllMembers = true)] public class XamarinListViewScrollToBugPage1 : ContentPage { ListView _listView; - ObservableCollection<ListObj> _collection = new ObservableCollection<ListObj> (); + ObservableCollection<ListObj> _collection = new ObservableCollection<ListObj>(); - public XamarinListViewScrollToBugPage1 () + public XamarinListViewScrollToBugPage1() { Title = "Scroll To in OnAppearing"; - for (int i = 0; i < 100; i++) { - var item = new ListObj { Name = string.Format ("{0} {0} {0} {0} {0} {0}", i) }; - _collection.Add (item); + for (int i = 0; i < 100; i++) + { + var item = new ListObj { Name = string.Format("{0} {0} {0} {0} {0} {0}", i) }; + _collection.Add(item); } - _listView = new ListView { + _listView = new ListView + { ItemsSource = _collection, - ItemTemplate = new DataTemplate (typeof(CellTemplateScrollTo)) + ItemTemplate = new DataTemplate(typeof(CellTemplateScrollTo)) }; _listView.AutomationId = "listView"; - Content = new StackLayout { + Content = new StackLayout + { Children = { _listView } }; } - protected override void OnAppearing () + protected override void OnAppearing() { - base.OnAppearing (); - _listView.ScrollTo (_collection.Last(), ScrollToPosition.MakeVisible, false); + base.OnAppearing(); + _listView.ScrollTo(_collection.Last(), ScrollToPosition.MakeVisible, false); } } - [Preserve (AllMembers = true)] + [Preserve(AllMembers = true)] public class XamarinListViewScrollToBugPage2 : ContentPage { ListView _listView; - ObservableCollection<ListObj> _collection = new ObservableCollection<ListObj> (); + ObservableCollection<ListObj> _collection = new ObservableCollection<ListObj>(); - public XamarinListViewScrollToBugPage2 () + public XamarinListViewScrollToBugPage2() { Title = "Crash in ScrollToPosition.End"; - for (int i = 0; i < 100; i++) { - var item = new ListObj { Name = string.Format ("2 {0} {0} {0} {0} {0} {0}", i) }; - _collection.Add (item); + for (int i = 0; i < 100; i++) + { + var item = new ListObj { Name = string.Format("2 {0} {0} {0} {0} {0} {0}", i) }; + _collection.Add(item); } - _listView = new ListView { + _listView = new ListView + { ItemsSource = _collection, - ItemTemplate = new DataTemplate (typeof(CellTemplateScrollTo)) + ItemTemplate = new DataTemplate(typeof(CellTemplateScrollTo)) }; - var endButton = new Button { + var endButton = new Button + { Text = "ScrollToPosition.End End - Not animated", - Command = new Command (() => { - _listView.ScrollTo (_collection.Last(), ScrollToPosition.End, false); + Command = new Command(() => + { + _listView.ScrollTo(_collection.Last(), ScrollToPosition.End, false); }) }; - var endButtonAnimated = new Button { + var endButtonAnimated = new Button + { Text = "ScrollToPosition.MakeVisible End - Animated", - Command = new Command (() => { - _listView.ScrollTo (_collection.Last(), ScrollToPosition.MakeVisible, true); + Command = new Command(() => + { + _listView.ScrollTo(_collection.Last(), ScrollToPosition.MakeVisible, true); }) }; - Content = new StackLayout { + Content = new StackLayout + { Children = { endButton, endButtonAnimated, @@ -201,30 +218,50 @@ namespace Xamarin.Forms.Controls.TestCasesPages public class XamarinListViewScrollToBugPage3 : ContentPage { ListView _listView; - ObservableCollection<ListObj> _collection = new ObservableCollection<ListObj> (); - int _i =0; - public XamarinListViewScrollToBugPage3 () + ObservableCollection<ListObj> _collection = new ObservableCollection<ListObj>(); + int _i = 0; + public const string DontRun = "Don't run"; + public XamarinListViewScrollToBugPage3() { Title = "Scroll To in OnAppearing Uneven"; - for (_i = 0; _i < 100; _i++) { - var item = new ListObj { Name = string.Format ("{0} {0} {0} {0} {0} {0}", _i) }; - _collection.Add (item); + bool runTest = true; + // This test will fail in iOS < 9 because using ScrollTo with UnevenRows with estimation is currently not working. + // It did not previously fail because this test used `TakePerformanceHit` to turn off row estimation. However, as + // that was never a public feature, it was never a valid fix for the test. + // https://bugzilla.xamarin.com/show_bug.cgi?id=28277 +#if !UITEST + if (App.IOSVersion < 9) + runTest = false; +#endif + + if (!runTest) + _collection.Add(new ListObj { Name = DontRun }); + else + { + for (_i = 0; _i < 100; _i++) + { + var item = new ListObj { Name = string.Format("{0} {0} {0} {0} {0} {0}", _i) }; + _collection.Add(item); + } } - var btnAdd = new Button { + var btnAdd = new Button + { Text = "Add item", WidthRequest = 100 }; btnAdd.Clicked += BtnAddOnClicked; - var btnBottom = new Button { + var btnBottom = new Button + { Text = "Scroll to end", WidthRequest = 100 }; btnBottom.Clicked += BtnBottomOnClicked; - var btnPanel = new StackLayout { + var btnPanel = new StackLayout + { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Children = { @@ -233,19 +270,20 @@ namespace Xamarin.Forms.Controls.TestCasesPages } }; - _listView = new ListView { + _listView = new ListView + { ItemsSource = _collection, BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.FillAndExpand, HasUnevenRows = true, - ItemTemplate = new DataTemplate (typeof(CellTemplateScrollToUneven)) + ItemTemplate = new DataTemplate(typeof(CellTemplateScrollToUneven)) }; - _listView.TakePerformanceHit = true; _listView.ItemTapped += (sender, e) => ((ListView)sender).SelectedItem = null; _listView.AutomationId = "listView"; - Content = new StackLayout { + Content = new StackLayout + { Children = { btnPanel, _listView @@ -253,10 +291,10 @@ namespace Xamarin.Forms.Controls.TestCasesPages }; } - protected override void OnAppearing () + protected override void OnAppearing() { - base.OnAppearing (); - _listView.ScrollTo (_collection.Last(), ScrollToPosition.MakeVisible, false); + base.OnAppearing(); + _listView.ScrollTo(_collection.Last(), ScrollToPosition.MakeVisible, false); } void BtnBottomOnClicked(object sender, EventArgs e) @@ -268,7 +306,7 @@ namespace Xamarin.Forms.Controls.TestCasesPages void BtnAddOnClicked(object sender, EventArgs eventArgs) { var str = string.Format("Item {0}", _i++); - var item = new ListObj { Name = string.Format ("{0} {0} {0} {0} {0} {0}", _i) }; + var item = new ListObj { Name = string.Format("{0} {0} {0} {0} {0} {0}", _i) }; _collection.Add(item); _listView.ScrollTo(item, ScrollToPosition.End, true); |