diff options
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2241.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2241.cs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2241.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2241.cs new file mode 100644 index 00000000..5bd750b3 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2241.cs @@ -0,0 +1,58 @@ +using System; + +using Xamarin.Forms; +using Xamarin.Forms.CustomAttributes; + +#if UITEST +using NUnit.Framework; +using Xamarin.UITest; +using Xamarin.UITest.Android; +#endif + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + [Issue (IssueTracker.Github, 2241, "ScrollView content can become stuck on orientation change (iOS)", PlatformAffected.iOS)] + public class Issue2241 : TestContentPage + { + protected override void Init () + { + ScrollView scrollView = new ScrollView () { + HorizontalOptions = LayoutOptions.FillAndExpand, + VerticalOptions = LayoutOptions.FillAndExpand, + Padding = new Thickness (20), + Content = new BoxView () { + Color = Color.Red, + HeightRequest = 400, + HorizontalOptions = LayoutOptions.FillAndExpand + } + }; + + Content = scrollView; + } + +#if UITEST + [Test] + [Ignore("Fails intermittently on TestCloud")] + public void ChangeOrientationCheckScroll () + { + var isAndroid = RunningApp is AndroidApp; + var className = "Xamarin_Forms_Platform_iOS_BoxRenderer"; + if (isAndroid) { + className = "BoxRenderer"; + } + var box1 = RunningApp.Query (c => c.Class (className)) [0]; + RunningApp.SetOrientationLandscape (); + RunningApp.ScrollDown (); + RunningApp.SetOrientationPortrait (); + var box2 = RunningApp.Query (c => c.Class (className)) [0]; + RunningApp.Screenshot ("Did it resize ok? Do you see some white on the bottom?"); + if (!isAndroid) { + Assert.AreEqual (box1.Rect.CenterY, box2.Rect.CenterY); + } + } +#endif + } +} + + |