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
|
using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 34061, "RelativeLayout - First child added after page display does not appear")]
public class Bugzilla34061 : TestContentPage
{
readonly RelativeLayout _layout = new RelativeLayout ();
protected override void Init ()
{
var label = new Label { Text = "Some content goes here", HorizontalOptions = LayoutOptions.Center };
var addButton = new Button{ Text = "Add Popover", AutomationId = "btnAdd" };
addButton.Clicked += (s, ea) => AddPopover ();
var stack = new StackLayout {
Orientation = StackOrientation.Vertical,
Children = {
label,
addButton
},
};
_layout.Children.Add (stack,
Forms.Constraint.Constant (0),
Forms.Constraint.Constant (0),
Forms.Constraint.RelativeToParent (p => p.Width),
Forms.Constraint.RelativeToParent (p => p.Height));
Content = _layout;
}
void AddPopover ()
{
var newView = new Button {
BackgroundColor = Color.FromRgba (64, 64, 64, 64),
Text = "Remove Me",
AutomationId = "btnRemoveMe"
};
newView.Clicked += (s, ea) => RemovePopover (newView);
_layout.Children.Add (
newView,
Forms.Constraint.Constant (0),
Forms.Constraint.RelativeToParent (p => p.Height / 2),
Forms.Constraint.RelativeToParent (p => p.Width),
Forms.Constraint.RelativeToParent (p => p.Height / 2));
}
void RemovePopover (View view)
{
_layout.Children.Remove (view);
}
#if UITEST
[Test]
public void Bugzilla34061Test ()
{
RunningApp.Screenshot ("I am at Bugzilla34061 ");
RunningApp.WaitForElement (q => q.Marked ("btnAdd"));
RunningApp.Tap (q => q.Marked ("btnAdd"));
RunningApp.WaitForElement (q => q.Marked ("Remove Me"));
RunningApp.Screenshot ("I see the button");
}
#endif
}
}
|