зеркало из https://github.com/DeGsoft/maui-linux.git
Merge branch '3.5.0'
This commit is contained in:
Коммит
e4a308a541
|
@ -3,13 +3,13 @@ using Xamarin.Forms.Internals;
|
|||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve (AllMembers = true)]
|
||||
[Issue (IssueTracker.Bugzilla, 33450, "[iOS] Cell with ContextAction has a different layout")]
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Bugzilla, 33450, "[iOS] Cell with ContextAction has a different layout")]
|
||||
public class Bugzilla33450 : TestContentPage // or TestMasterDetailPage, etc ...
|
||||
{
|
||||
protected override void Init ()
|
||||
protected override void Init()
|
||||
{
|
||||
var list = new ListView { ItemTemplate = new DataTemplate (typeof(MyImageCell)) };
|
||||
var list = new ListView { ItemTemplate = new DataTemplate(typeof(MyImageCell)) };
|
||||
|
||||
list.ItemsSource = new[] {
|
||||
"One",
|
||||
|
@ -24,10 +24,15 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
"Ten",
|
||||
};
|
||||
|
||||
Content = list;
|
||||
Content = new StackLayout
|
||||
{
|
||||
Children = {
|
||||
new Label { Text = "The following list contains cells with and without context actions, but all of the cells should be laid out identically. If the cells do not look identical, this test has failed." },
|
||||
list }
|
||||
};
|
||||
}
|
||||
|
||||
[Preserve (AllMembers = true)]
|
||||
[Preserve(AllMembers = true)]
|
||||
public class MyImageCell : ImageCell
|
||||
{
|
||||
static bool s_addContextAction = false;
|
||||
|
@ -36,8 +41,8 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
{
|
||||
ImageSource = "bank.png";
|
||||
SetBinding(TextProperty, new Binding("."));
|
||||
|
||||
if(s_addContextAction)
|
||||
|
||||
if (s_addContextAction)
|
||||
{
|
||||
ContextActions.Add(new MenuItem() { Text = "Delete" });
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
return page;
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public class Item2 : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
public string Name
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms.Core.UITests;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
|
@ -49,7 +56,7 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
{
|
||||
var label = new Label();
|
||||
label.SetBinding(Label.TextProperty, "Description");
|
||||
|
||||
label.AutomationId = "pandabear";
|
||||
var menu = new MenuItem { Text = "Remove" };
|
||||
menu.Command = new Command(() => ((ListItemViewModel)BindingContext).Remove.Execute((this, BindingContext)));
|
||||
ContextActions.Add(menu);
|
||||
|
@ -102,5 +109,41 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
public Command Remove =>
|
||||
new Command(() => MessagingCenter.Send(this, "Remove", this));
|
||||
}
|
||||
|
||||
#if UITEST && !__WINDOWS__
|
||||
[Test]
|
||||
public void TestRemovingContextMenuItems()
|
||||
{
|
||||
for(int i = 1; i <= 3; i++)
|
||||
{
|
||||
string searchFor = $"Remove me using the context menu. #{i}";
|
||||
RunningApp.WaitForElement(searchFor);
|
||||
|
||||
RunningApp.ActivateContextMenu(searchFor);
|
||||
RunningApp.WaitForElement(c => c.Marked("Remove"));
|
||||
RunningApp.Tap(c => c.Marked("Remove"));
|
||||
}
|
||||
|
||||
|
||||
for (int i = 4; i <= 6; i++)
|
||||
{
|
||||
RunningApp.Tap("Add an item");
|
||||
string searchFor = $"Remove me using the context menu. #{i}";
|
||||
|
||||
RunningApp.ActivateContextMenu(searchFor);
|
||||
RunningApp.WaitForElement(c => c.Marked("Remove"));
|
||||
RunningApp.Tap(c => c.Marked("Remove"));
|
||||
}
|
||||
|
||||
|
||||
for (int i = 1; i <= 6; i++)
|
||||
{
|
||||
string searchFor = $"Remove me using the context menu. #{i}";
|
||||
RunningApp.WaitForNoElement(c => c.Marked("Remove"));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
|
@ -142,6 +142,8 @@ namespace Xamarin.Forms.Platform.MacOS
|
|||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
|
||||
{
|
||||
_perfectSizeValid = false;
|
||||
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
e.OldElement.PropertyChanging -= ElementPropertyChanging;
|
||||
|
|
Загрузка…
Ссылка в новой задаче