summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla26171.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla26171.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla26171.cs98
1 files changed, 98 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla26171.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla26171.cs
new file mode 100644
index 00000000..6ad49179
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla26171.cs
@@ -0,0 +1,98 @@
+´╗┐using System;
+
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Maps;
+using System.Threading.Tasks;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 26171, "Xamarin.Forms.Maps is not updating VisibleRegion property when layout is changed")]
+ public class Bugzilla26171 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ protected override void Init ()
+ {
+ var map = MakeMap ();
+
+ var label = new Label { AutomationId = "lblValue" };
+
+ var buttonLayout = new Button { Text = "Change layout" };
+ buttonLayout.Clicked += async (a, e) => {
+ map.VerticalOptions = LayoutOptions.Start;
+ await Print (map,label);
+ };
+
+ var stack = new StackLayout {
+ Spacing = 0,
+ Padding = new Thickness (30, 0)
+ };
+
+ stack.Children.Add (label);
+ stack.Children.Add (map);
+ stack.Children.Add (buttonLayout);
+
+ Content = new ScrollView { Content = stack };
+
+ Appearing += async (sender, e) => await Print (map, label);
+
+ }
+
+ static async Task Print (Map map, Label label)
+ {
+ await Task.Delay(500);
+ if (map.VisibleRegion != null) {
+ label.Text = map.VisibleRegion.Radius.Kilometers.ToString ();
+ }
+ }
+
+ public static Map MakeMap ()
+ {
+ Pin colosseum = null;
+ Pin pantheon = null;
+ Pin chapel = null;
+
+ var map = new Map {
+ IsShowingUser = false,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HeightRequest = 100,
+ Pins = {
+ (colosseum = new Pin {
+ Type = PinType.Place,
+ Position = new Position (41.890202, 12.492049),
+ Label = "Colosseum",
+ Address = "Piazza del Colosseo, 00184 Rome, Province of Rome, Italy"
+ }),
+ (pantheon = new Pin {
+ Type = PinType.Place,
+ Position = new Position (41.898652, 12.476831),
+ Label = "Pantheon",
+ Address = "Piazza della Rotunda, 00186 Rome, Province of Rome, Italy"
+ }),
+ (chapel = new Pin {
+ Type = PinType.Place,
+ Position = new Position (41.903209, 12.454545),
+ Label = "Sistine Chapel",
+ Address = "Piazza della Rotunda, 00186 Rome, Province of Rome, Italy"
+ })
+ }
+ };
+
+ return map;
+ }
+
+#if UITEST
+ [Test]
+ public void Bugzilla26171Test ()
+ {
+ RunningApp.WaitForElement (q => q.Marked ("lblValue"));
+ var value = RunningApp.Query (q => q.Marked ("lblValue")) [0].Text;
+ RunningApp.Screenshot ("I see the Label");
+ }
+#endif
+ }
+}