Isolate the TemplatedView check inside Platform.cs to just RadioButton until we can provide a more generalized fix (#13279)
* UI Test * - Hack fix for now * - fiix UI Test wording * - apply to UWP * - add UI Test for RB Templates * - fix categories
This commit is contained in:
Родитель
3763db8d1b
Коммит
cfd463fc4f
|
@ -18,7 +18,19 @@ namespace Xamarin.Forms.ControlGallery.Android
|
|||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
Console.WriteLine("Issue12484 Test passed.");
|
||||
if(e.NewElement.Children[0] is Issue12484CustomView.Issue12484Template t &&
|
||||
t.Content is StackLayout g)
|
||||
{
|
||||
var label = new Label
|
||||
{
|
||||
AutomationId = "Success",
|
||||
Text = "Success",
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
VerticalOptions = LayoutOptions.Center
|
||||
};
|
||||
|
||||
g.Children.Add(label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,17 +49,16 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
{
|
||||
public Issue12484Template()
|
||||
{
|
||||
var label = new Label
|
||||
var content = new StackLayout()
|
||||
{
|
||||
AutomationId = "Success",
|
||||
Text = "If this text appear, the test has passed.",
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
VerticalOptions = LayoutOptions.Center
|
||||
Children =
|
||||
{
|
||||
new Label()
|
||||
{
|
||||
Text = "If a label with text `Success` does not show up this test has failed"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var content = new Grid();
|
||||
content.Children.Add(label);
|
||||
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.Forms.Core.UITests;
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
#if UITEST
|
||||
[Category(UITestCategories.RadioButton)]
|
||||
#endif
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.None, 0, "RadioButton: Template From Style", PlatformAffected.All)]
|
||||
public class RadioButtonTemplateFromStyle : TestNavigationPage
|
||||
{
|
||||
protected override void Init()
|
||||
{
|
||||
#if APP
|
||||
PushAsync(new GalleryPages.RadioButtonGalleries.TemplateFromStyle());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UITEST
|
||||
[Test]
|
||||
public void ContentRenderers()
|
||||
{
|
||||
RunningApp.WaitForElement("A");
|
||||
RunningApp.WaitForElement("B");
|
||||
RunningApp.WaitForElement("C");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)CollectionViewGroupTypeIssue.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue11214.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue13109.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)RadioButtonTemplateFromStyle.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ShellWithCustomRendererDisabledAnimations.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ShellFlyoutContent.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue4720.cs" />
|
||||
|
|
|
@ -339,11 +339,23 @@ namespace Xamarin.Forms.Platform.Android
|
|||
|
||||
internal static IVisualElementRenderer CreateRenderer(VisualElement element, Context context)
|
||||
{
|
||||
IVisualElementRenderer renderer = Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(element, context)
|
||||
?? new DefaultRenderer(context);
|
||||
IVisualElementRenderer renderer = null;
|
||||
|
||||
// temporary hack to fix the following issues
|
||||
// https://github.com/xamarin/Xamarin.Forms/issues/13261
|
||||
// https://github.com/xamarin/Xamarin.Forms/issues/12484
|
||||
if (element is RadioButton tv && tv.ResolveControlTemplate() != null)
|
||||
{
|
||||
renderer = new DefaultRenderer(context);
|
||||
}
|
||||
|
||||
if (renderer == null)
|
||||
{
|
||||
renderer = Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(element, context)
|
||||
?? new DefaultRenderer(context);
|
||||
}
|
||||
|
||||
renderer.SetElement(element);
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,10 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
|
||||
IVisualElementRenderer renderer = null;
|
||||
|
||||
if (element is TemplatedView tv && tv.ResolveControlTemplate() != null)
|
||||
// temporary hack to fix the following issues
|
||||
// https://github.com/xamarin/Xamarin.Forms/issues/13261
|
||||
// https://github.com/xamarin/Xamarin.Forms/issues/12484
|
||||
if (element is RadioButton tv && tv.ResolveControlTemplate() != null)
|
||||
{
|
||||
renderer = new DefaultRenderer();
|
||||
}
|
||||
|
|
|
@ -222,9 +222,21 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
public static IVisualElementRenderer CreateRenderer(VisualElement element)
|
||||
{
|
||||
IVisualElementRenderer renderer = Internals.Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(element)
|
||||
?? new DefaultRenderer();
|
||||
|
||||
IVisualElementRenderer renderer = null;
|
||||
|
||||
// temporary hack to fix the following issues
|
||||
// https://github.com/xamarin/Xamarin.Forms/issues/13261
|
||||
// https://github.com/xamarin/Xamarin.Forms/issues/12484
|
||||
if (element is RadioButton tv && tv.ResolveControlTemplate() != null)
|
||||
{
|
||||
renderer = new DefaultRenderer();
|
||||
}
|
||||
|
||||
if (renderer == null)
|
||||
{
|
||||
renderer = Internals.Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(element) ?? new DefaultRenderer();
|
||||
}
|
||||
|
||||
renderer.SetElement(element);
|
||||
|
||||
return renderer;
|
||||
|
|
Загрузка…
Ссылка в новой задаче