-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue6260.cs
83 lines (73 loc) · 1.62 KB
/
Issue6260.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
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
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, 6260, "[Android] infinite layout loop",
PlatformAffected.Android)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Button)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.UwpIgnore)]
#endif
public class Issue6260 : TestContentPage
{
const string text = "If this number keeps increasing test has failed: ";
static string success = text + "0";
protected override void Init()
{
int measurecount = 0;
var button = new Button()
{
Text = "Click me",
BackgroundColor = Color.Green,
};
var label = new Label()
{
Text = success
};
this.Appearing += (_, __) =>
{
button.ImageSource = "coffee.png";
Device.BeginInvokeOnMainThread(() =>
{
button.MeasureInvalidated += (___, ____) =>
{
measurecount++;
label.Text = text + measurecount.ToString();
};
});
};
Content = new StackLayout()
{
Children =
{
new Label()
{
Text = "Welcome to Xamarin.Forms!",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
},
new Entry(),
button,
label
}
};
}
#if UITEST
[Test]
public void ButtonImageInfiniteLayout()
{
RunningApp.WaitForElement(success);
}
#endif
}
}