зеркало из https://github.com/DeGsoft/maui-linux.git
Родитель
9d3ef85539
Коммит
95352c2bef
|
@ -11,7 +11,6 @@ using Xamarin.Forms.Core.UITests;
|
||||||
|
|
||||||
namespace Xamarin.Forms.Controls.Issues
|
namespace Xamarin.Forms.Controls.Issues
|
||||||
{
|
{
|
||||||
|
|
||||||
#if UITEST
|
#if UITEST
|
||||||
[NUnit.Framework.Category(UITestCategories.Navigation)]
|
[NUnit.Framework.Category(UITestCategories.Navigation)]
|
||||||
[NUnit.Framework.Category(UITestCategories.ManualReview)]
|
[NUnit.Framework.Category(UITestCategories.ManualReview)]
|
||||||
|
@ -21,6 +20,10 @@ namespace Xamarin.Forms.Controls.Issues
|
||||||
public class Bugzilla40005 : TestContentPage // or TestMasterDetailPage, etc ...
|
public class Bugzilla40005 : TestContentPage // or TestMasterDetailPage, etc ...
|
||||||
{
|
{
|
||||||
public const string GoToPage2 = "Go to Page 2";
|
public const string GoToPage2 = "Go to Page 2";
|
||||||
|
public const string PageOneLabel = "Page 1";
|
||||||
|
public const string PageTwoLabel = "Page 2";
|
||||||
|
public const string InsertedPageLabel = "Inserted page";
|
||||||
|
public const string TestInstructions = "Click " + GoToPage2 + " and you should still see a back bar button";
|
||||||
|
|
||||||
public Bugzilla40005()
|
public Bugzilla40005()
|
||||||
{
|
{
|
||||||
|
@ -37,7 +40,7 @@ namespace Xamarin.Forms.Controls.Issues
|
||||||
|
|
||||||
public Page1()
|
public Page1()
|
||||||
{
|
{
|
||||||
Button btn = new Button()
|
var btn = new Button()
|
||||||
{
|
{
|
||||||
Text = GoToPage2
|
Text = GoToPage2
|
||||||
};
|
};
|
||||||
|
@ -51,15 +54,17 @@ namespace Xamarin.Forms.Controls.Issues
|
||||||
VerticalOptions = LayoutOptions.Center,
|
VerticalOptions = LayoutOptions.Center,
|
||||||
Children =
|
Children =
|
||||||
{
|
{
|
||||||
new Label {
|
new Label
|
||||||
|
{
|
||||||
HorizontalTextAlignment = TextAlignment.Center,
|
HorizontalTextAlignment = TextAlignment.Center,
|
||||||
Text = "Page 1"
|
Text = PageOneLabel
|
||||||
},
|
},
|
||||||
btn,
|
btn,
|
||||||
new Label {
|
new Label
|
||||||
|
{
|
||||||
HorizontalTextAlignment = TextAlignment.Center,
|
HorizontalTextAlignment = TextAlignment.Center,
|
||||||
Text = $"Click {GoToPage2} and you should still see a back bar button"
|
Text = TestInstructions
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -76,12 +81,11 @@ namespace Xamarin.Forms.Controls.Issues
|
||||||
|
|
||||||
protected override bool OnBackButtonPressed()
|
protected override bool OnBackButtonPressed()
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Hardware BackButton Pressed on Page1");
|
Debug.WriteLine($"Hardware BackButton Pressed on {PageOneLabel}");
|
||||||
return base.OnBackButtonPressed();
|
return base.OnBackButtonPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class InsertedPage : ContentPage
|
public class InsertedPage : ContentPage
|
||||||
{
|
{
|
||||||
public InsertedPage()
|
public InsertedPage()
|
||||||
|
@ -89,18 +93,20 @@ namespace Xamarin.Forms.Controls.Issues
|
||||||
Content = new StackLayout
|
Content = new StackLayout
|
||||||
{
|
{
|
||||||
VerticalOptions = LayoutOptions.Center,
|
VerticalOptions = LayoutOptions.Center,
|
||||||
Children = {
|
Children =
|
||||||
new Label {
|
{
|
||||||
HorizontalTextAlignment = TextAlignment.Center,
|
new Label
|
||||||
Text = "Inserted page"
|
{
|
||||||
|
HorizontalTextAlignment = TextAlignment.Center,
|
||||||
|
Text = InsertedPageLabel
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnBackButtonPressed()
|
protected override bool OnBackButtonPressed()
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Hardware BackButton Pressed on InsertedPage");
|
Debug.WriteLine($"Hardware BackButton Pressed on {InsertedPageLabel}");
|
||||||
return base.OnBackButtonPressed();
|
return base.OnBackButtonPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,20 +118,34 @@ namespace Xamarin.Forms.Controls.Issues
|
||||||
Content = new StackLayout
|
Content = new StackLayout
|
||||||
{
|
{
|
||||||
VerticalOptions = LayoutOptions.Center,
|
VerticalOptions = LayoutOptions.Center,
|
||||||
Children = {
|
Children =
|
||||||
new Label {
|
{
|
||||||
HorizontalTextAlignment = TextAlignment.Center,
|
new Label
|
||||||
Text = "Page 2"
|
{
|
||||||
|
HorizontalTextAlignment = TextAlignment.Center,
|
||||||
|
Text = PageTwoLabel
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnBackButtonPressed()
|
protected override bool OnBackButtonPressed()
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Hardware BackButton Pressed on Page2");
|
Debug.WriteLine($"Hardware BackButton Pressed on {PageTwoLabel}");
|
||||||
return base.OnBackButtonPressed();
|
return base.OnBackButtonPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UITEST
|
||||||
|
[Test]
|
||||||
|
public void Bugzilla40005Test()
|
||||||
|
{
|
||||||
|
RunningApp.WaitForElement(q => q.Marked(PageOneLabel));
|
||||||
|
RunningApp.Tap(q => q.Marked(GoToPage2));
|
||||||
|
RunningApp.WaitForElement(q => q.Marked(PageTwoLabel));
|
||||||
|
RunningApp.Back();
|
||||||
|
RunningApp.WaitForElement(q => q.Marked(PageOneLabel));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
Загрузка…
Ссылка в новой задаче