blob: bd6abeb1ca58381111195d1dcbe3db59da13d1bc (
plain)
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
91
92
93
94
95
96
97
98
99
100
101
|
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using Xamarin.Forms.CustomAttributes;
using System.Windows.Input;
using System.Diagnostics;
using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.UITest.iOS;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Github, 2289, "TextCell IsEnabled property not disabling element in TableView", PlatformAffected.iOS)]
public partial class Issue2289 : TestContentPage
{
#if APP
public Issue2289 ()
{
InitializeComponent ();
}
#endif
protected override void Init ()
{
MoreCommand = new Command<MenuItem> ((menuItem) => {
Debug.WriteLine ("More! Command Called!");
});
DeleteCommand = new Command<MenuItem> ((menuItem) => {
Debug.WriteLine ("Delete Command Called!");
});
BindingContext = this;
}
public ICommand MoreCommand { get; protected set; }
public ICommand DeleteCommand { get; protected set; }
#if UITEST && __IOS__
[Test]
[Ignore("Fails sometimes on XTC")]
public void TestIsEnabledFalse ()
{
var disable1 = RunningApp.Query (c => c.Marked ("txtCellDisable1")) [0];
Assert.IsFalse (disable1.Enabled);
var disable2 = RunningApp.Query (c => c.Marked ("txtCellDisable2")) [0];
Assert.IsFalse (disable2.Enabled);
}
[Test]
[Ignore("Fails sometimes on XTC")]
public void TestIsEnabledFalseContextActions ()
{
var disable1 = RunningApp.Query (c => c.Marked ("txtCellDisableContextActions1")) [0];
Assert.IsFalse (disable1.Enabled);
var screenBounds = RunningApp.Query (q => q.Raw ("* index:0")) [0].Rect;
RunningApp.DragCoordinates (screenBounds.Width - 10, disable1.Rect.CenterY, 10, disable1.Rect.CenterY);
RunningApp.Screenshot ("Not showing context menu");
RunningApp.WaitForNoElement (c => c.Marked ("More"));
RunningApp.TapCoordinates (screenBounds.CenterX, screenBounds.CenterY);
}
[Test]
[Ignore("Fails sometimes on XTC")]
public void TestIsEnabledTrue ()
{
var disable1 = RunningApp.Query (c => c.Marked ("txtCellEnable1")) [0];
Assert.IsTrue (disable1.Enabled);
var disable2 = RunningApp.Query (c => c.Marked ("txtCellEnable2")) [0];
Assert.IsTrue (disable2.Enabled);
}
[Test]
[Ignore("Fails sometimes on XTC")]
public void TestIsEnabledTrueContextActions ()
{
var disable1 = RunningApp.Query (c => c.Marked ("txtCellEnabledContextActions1")) [0];
Assert.IsTrue (disable1.Enabled);
var screenBounds = RunningApp.Query (q => q.Raw ("* index:0")) [0].Rect;
RunningApp.DragCoordinates (screenBounds.Width - 10, disable1.Rect.CenterY, 10, disable1.Rect.CenterY);
RunningApp.Screenshot ("Showing context menu");
RunningApp.WaitForElement (c => c.Marked ("More"));
}
#endif
}
}
|