-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue1601.cs
61 lines (54 loc) · 1.68 KB
/
Issue1601.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
using System;
using System.Collections.Generic;
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
{
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 1601, "Exception thrown when `Removing Content Using LayoutCompression", PlatformAffected.Android)]
public class Issue1601 : TestContentPage
{
protected override void Init()
{
var grid = new Grid();
Forms.CompressedLayout.SetIsHeadless(grid, true);
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
grid.RowDefinitions.Add(new RowDefinition { Height = 40 });
var boxView = new BoxView { BackgroundColor = Color.Red };
var backgroundContainer = new Grid();
Forms.CompressedLayout.SetIsHeadless(backgroundContainer, true);
backgroundContainer.Children.Add(boxView);
grid.Children.Add(backgroundContainer);
var stack = new StackLayout
{
Orientation = StackOrientation.Horizontal
};
Forms.CompressedLayout.SetIsHeadless(stack, true);
var button = new Button { Text = "CRASH!" };
stack.Children.Add(button);
grid.Children.Add(stack, 0, 1);
button.Clicked += (s, e) => Content = null;
Content = grid;
}
#if UITEST
[Test]
public void Issue1601Test()
{
RunningApp.Screenshot("Start G1601");
RunningApp.WaitForElement(q => q.Marked("CRASH!"));
RunningApp.Screenshot("I see the button");
RunningApp.Tap(q => q.Marked("CRASH!"));
RunningApp.Screenshot("Didn't crash!");
}
#endif
}
}