summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue342.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue342.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue342.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue342.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue342.cs
new file mode 100644
index 00000000..792d9711
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue342.cs
@@ -0,0 +1,85 @@
+´╗┐using System;
+using System.Linq;
+
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using NUnit.Framework;
+using Xamarin.UITest;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers=true)]
+ [Issue (IssueTracker.Github, 342, "NRE when Image is not assigned source", PlatformAffected.WinPhone)]
+ public class Issue342NoSource : TestContentPage
+ {
+ protected override void Init ()
+ {
+ Title = "Issue 342";
+ Content = new StackLayout {
+ Children = {
+ new Label {
+ Text = "Uninitialized image"
+ },
+ new Image ()
+ }
+ };
+ }
+
+ // Should not throw exception when user does not include image
+
+#if UITEST
+ [Test]
+ public void Issue342NoSourceTestsLablePresentNoImage ()
+ {
+ RunningApp.WaitForElement (q => q.Marked ("Uninitialized image"), "Cannot see label");
+ RunningApp.Screenshot ("All elements present");
+ }
+#endif
+ }
+
+ [Preserve (AllMembers=true)]
+ [Issue (IssueTracker.Github, 342, "NRE when Image is delayed source", PlatformAffected.WinPhone)]
+ public class Issue342DelayedSource : TestContentPage
+ {
+ protected override void Init ()
+ {
+ Title = "Issue 342";
+
+ _image = new Image ();
+
+ Content = new StackLayout {
+ Children = {
+ new Label {
+ Text = "Delayed image"
+ },
+ _image
+ }
+ };
+
+ AddSourceAfterDelay ();
+ }
+
+ // Should not throw exception when user does not include image
+ Image _image;
+
+ void AddSourceAfterDelay ()
+ {
+ Device.StartTimer (TimeSpan.FromSeconds (2), () => {
+ _image.Source = "cover1.jpg";
+ return false;
+ });
+ }
+
+#if UITEST
+ [Test]
+ [Category ("ManualReview")]
+ public void Issue342DelayedLoadTestsImageLoads ()
+ {
+ RunningApp.Screenshot ("Should not crash");
+ Assert.Inconclusive ("Manual review");
+ }
+#endif
+ }
+}