-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue3318.cs
87 lines (72 loc) · 2.39 KB
/
Issue3318.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 3318, "[MAC] ScrollTo method is not working in Xamarin.Forms for mac platform", PlatformAffected.macOS)]
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
#endif
public class Issue3318 : TestContentPage
{
protected override void Init()
{
var stackLayout = new StackLayout();
var list = Enumerable.Range(0, 40).Select(c => $"Item {c}").ToArray();
var listview = new ListView { ItemsSource = list };
var swShouldAnimate = new Switch();
var lblShouldAnimate = new Label { Text = "Should Animate?" };
var btnMakeVisible = new Button { Text = "Make Visible" };
btnMakeVisible.Clicked += (s, e) =>
{
listview.ScrollTo(list[19], ScrollToPosition.MakeVisible, swShouldAnimate.IsToggled);
};
var btnCenter = new Button { Text = "Center" };
btnCenter.Clicked += (s, e) =>
{
listview.ScrollTo(list[19], ScrollToPosition.Center, swShouldAnimate.IsToggled);
};
var btnStart = new Button { Text = "Start" };
btnStart.Clicked += (s, e) =>
{
listview.ScrollTo(list[19], ScrollToPosition.Start, swShouldAnimate.IsToggled);
};
var btnEnd = new Button { Text = "End" };
btnEnd.Clicked += (s, e) =>
{
listview.ScrollTo(list[19], ScrollToPosition.End, swShouldAnimate.IsToggled);
};
stackLayout.Children.Add(btnMakeVisible);
stackLayout.Children.Add(btnCenter);
stackLayout.Children.Add(btnStart);
stackLayout.Children.Add(btnEnd);
var shouldAnimateContainer = new StackLayout { Orientation = StackOrientation.Horizontal };
shouldAnimateContainer.Children.Add(swShouldAnimate);
shouldAnimateContainer.Children.Add(lblShouldAnimate);
stackLayout.Children.Add(shouldAnimateContainer);
stackLayout.Children.Add(listview);
Content = stackLayout;
}
#if UITEST
[Test]
public void Issue3318Test()
{
RunningApp.WaitForElement(q => q.Marked("End"));
RunningApp.Tap(q => q.Marked("End"));
RunningApp.WaitForElement(q => q.Marked("Item 19"));
RunningApp.Back();
}
#endif
}
}