2016-03-22 23:02:25 +03:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using Xamarin.Forms.CustomAttributes;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Diagnostics;
|
2017-11-10 13:52:25 +03:00
|
|
|
|
|
2016-04-26 18:20:55 +03:00
|
|
|
|
using Xamarin.Forms.Internals;
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
|
|
|
|
#if UITEST
|
2017-11-10 13:52:25 +03:00
|
|
|
|
using Xamarin.Forms.Core.UITests;
|
2016-03-22 23:02:25 +03:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Xamarin.UITest;
|
|
|
|
|
using Xamarin.UITest.iOS;
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-11-17 00:07:30 +03:00
|
|
|
|
namespace Xamarin.Forms.Controls.Issues
|
2016-03-22 23:02:25 +03:00
|
|
|
|
{
|
|
|
|
|
[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; }
|
|
|
|
|
|
2016-05-11 17:21:41 +03:00
|
|
|
|
#if UITEST && __IOS__
|
2016-03-22 23:02:25 +03:00
|
|
|
|
[Test]
|
|
|
|
|
[Ignore("Fails sometimes on XTC")]
|
|
|
|
|
public void TestIsEnabledFalse ()
|
|
|
|
|
{
|
2016-05-11 17:21:41 +03:00
|
|
|
|
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);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
[Ignore("Fails sometimes on XTC")]
|
|
|
|
|
public void TestIsEnabledFalseContextActions ()
|
|
|
|
|
{
|
2016-05-11 17:21:41 +03:00
|
|
|
|
var disable1 = RunningApp.Query (c => c.Marked ("txtCellDisableContextActions1")) [0];
|
|
|
|
|
Assert.IsFalse (disable1.Enabled);
|
|
|
|
|
|
2017-11-10 13:52:25 +03:00
|
|
|
|
var screenBounds = RunningApp.RootViewRect();
|
2016-05-11 17:21:41 +03:00
|
|
|
|
|
|
|
|
|
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);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
[Ignore("Fails sometimes on XTC")]
|
|
|
|
|
public void TestIsEnabledTrue ()
|
|
|
|
|
{
|
2016-05-11 17:21:41 +03:00
|
|
|
|
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);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
[Ignore("Fails sometimes on XTC")]
|
|
|
|
|
public void TestIsEnabledTrueContextActions ()
|
|
|
|
|
{
|
2016-05-11 17:21:41 +03:00
|
|
|
|
var disable1 = RunningApp.Query (c => c.Marked ("txtCellEnabledContextActions1")) [0];
|
|
|
|
|
Assert.IsTrue (disable1.Enabled);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
2017-11-10 13:52:25 +03:00
|
|
|
|
var screenBounds = RunningApp.RootViewRect();
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
2016-05-11 17:21:41 +03:00
|
|
|
|
RunningApp.DragCoordinates (screenBounds.Width - 10, disable1.Rect.CenterY, 10, disable1.Rect.CenterY);
|
2016-03-22 23:02:25 +03:00
|
|
|
|
|
2016-05-11 17:21:41 +03:00
|
|
|
|
RunningApp.Screenshot ("Showing context menu");
|
|
|
|
|
RunningApp.WaitForElement (c => c.Marked ("More"));
|
2016-03-22 23:02:25 +03:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|