-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue5831.cs
81 lines (72 loc) · 2.32 KB
/
Issue5831.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
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Controls;
using System;
using System.Collections.Generic;
#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.ManualReview)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 5831, "Navigating away from CollectionView and coming back leaves weird old items", PlatformAffected.iOS)]
public class Issue5831 : TestShell
{
const string flyoutMainTitle = "Main";
const string flyoutOtherTitle = "Other Page";
protected override void Init()
{
#if APP
Device.SetFlags(new List<string>(Device.Flags ?? new List<string>()) { "CollectionView_Experimental" });
Tab otherFlyoutItem = new Tab();
Tab mainFlyoutItem = new Tab();
string[] items = {
"Baboon",
"Capuchin Monkey",
"Blue Monkey",
"Squirrel Monkey",
"Golden Lion Tamarin",
"Howler Monkey",
"Japanese Macaque",
};
var collectionView = new CollectionView() { VerticalOptions = LayoutOptions.FillAndExpand };
collectionView.ItemTemplate = new DataTemplate(() =>
{
var label = new Label();
label.SetBinding(Label.TextProperty, ".");
return label;
});
collectionView.ItemsSource = items;
var stackLayout = new StackLayout() { VerticalOptions = LayoutOptions.FillAndExpand };
stackLayout.Children.Add(new Label { Text = "Go to the other page via the flyout, then come back. The items in the collection view should look identical when you return to this page." });
stackLayout.Children.Add(collectionView);
var collectionViewPage = new ContentPage { Content = stackLayout, BindingContext = this };
mainFlyoutItem.Items.Add(collectionViewPage);
otherFlyoutItem.Items.Add(new ContentPage { Content = new Label { Text = "Go back to main page via the flyout" } });
Items.Add(new FlyoutItem
{
Title = flyoutMainTitle,
Items = { mainFlyoutItem }
});
Items.Add(new FlyoutItem
{
Title = flyoutOtherTitle,
Items = { otherFlyoutItem }
});
#endif
}
#if UITEST && __SHELL__
[Test]
public void CollectionViewRenderingWhenLeavingAndReturningViaFlyout()
{
TapInFlyout(flyoutOtherTitle);
TapInFlyout(flyoutMainTitle);
}
#endif
}
}