maui-linux/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issu.../Bugzilla35733.cs

61 строка
1.5 KiB
C#
Исходник Обычный вид История

2016-03-22 23:02:25 +03:00
using System;
using Xamarin.Forms.CustomAttributes;
using System.Threading.Tasks;
using Xamarin.Forms.Internals;
2016-03-22 23:02:25 +03:00
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
2016-03-22 23:02:25 +03:00
{
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 35733, "iOS WebView crashes when loading an URL with encoded parameters", PlatformAffected.iOS)]
public class Bugzilla35733 : TestContentPage // or TestMasterDetailPage, etc ...
{
protected override void Init ()
{
var thisDoesNotWorkButton = new Button {
Text = "This will crash",
AutomationId = "btnGo"
};
thisDoesNotWorkButton.Clicked += async (object sender, EventArgs e) => await ShowLocation ("KÅRA");
Content = new StackLayout {
VerticalOptions = LayoutOptions.Center,
Children = {
thisDoesNotWorkButton
}
};
}
async Task ShowLocation(string locationString)
{
var stringUri = $"https://raw.githubusercontent.com/xamarin/Xamarin.Forms/master/README.md?l=en&px_location={Uri.EscapeDataString(locationString)}";
2016-03-22 23:02:25 +03:00
var uri = new Uri(stringUri);
var webPage = new ContentPage {
Title = "WebViewTest",
Content = new WebView {
Source = uri
}
};
await Navigation.PushAsync(webPage);
}
#if UITEST
[Test]
public void Bugzilla35733Test ()
{
RunningApp.WaitForElement (q => q.Marked ("btnGo"));
RunningApp.Tap (q => q.Marked ("btnGo"));
RunningApp.WaitForElement (q => q.Marked ("WebViewTest"));
RunningApp.Screenshot ("I didn't crash");
}
#endif
}
}