-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue342.cs
90 lines (79 loc) · 1.82 KB
/
Issue342.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
84
85
86
87
88
89
90
using System;
using System.Linq;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[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
{
AutomationId = "TestReady",
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(UITestCategories.ManualReview)]
public void Issue342DelayedLoadTestsImageLoads()
{
RunningApp.WaitForElement("TestReady");
RunningApp.Screenshot("Should not crash");
}
#endif
}
}