Родитель
7c2cc59d2f
Коммит
cdbb9ee09d
|
@ -26,7 +26,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
md.IsStatic &&
|
||||
md.IsPublic &&
|
||||
md.Parameters.Count == 1 &&
|
||||
md.Parameters[0].ParameterType.InheritsFromOrImplements(module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"))), module).SingleOrDefault()?.Item1;
|
||||
md.Parameters[0].ParameterType.InheritsFromOrImplements(module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"))), module).FirstOrDefault()?.Item1;
|
||||
if (getter == null)
|
||||
throw new BuildException(BuildExceptionCode.BPName, iXmlLineInfo, null, bpName, bpRef.DeclaringType);
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
md.IsStatic &&
|
||||
md.IsPublic &&
|
||||
md.Parameters.Count == 1 &&
|
||||
md.Parameters[0].ParameterType.InheritsFromOrImplements(module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"))), module).SingleOrDefault()?.Item1;
|
||||
md.Parameters[0].ParameterType.InheritsFromOrImplements(module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"))), module).FirstOrDefault()?.Item1;
|
||||
|
||||
var attributes = new List<CustomAttribute>();
|
||||
if (property != null && property.HasCustomAttributes)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="using:Xamarin.Forms.Xaml.UnitTests"
|
||||
x:Class="Xamarin.Forms.Xaml.UnitTests.Gh12025"
|
||||
local:Gh12025NavPage.IconColor="HotPink">
|
||||
</ContentPage>
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Core.UnitTests;
|
||||
|
||||
namespace Xamarin.Forms.Xaml.UnitTests
|
||||
{
|
||||
public class Gh12025NavPage : NavigationPage
|
||||
{
|
||||
public static new readonly BindableProperty IconColorProperty = BindableProperty.CreateAttached("IconColor", typeof(Color), typeof(Page), Color.Default);
|
||||
public static void SetIconColor(Page page, Color barTintColor) => page.SetValue(IconColorProperty, barTintColor);
|
||||
public static Color GetIconColor(Page page) => (Color)page.GetValue(IconColorProperty);
|
||||
}
|
||||
|
||||
public partial class Gh12025 : ContentPage
|
||||
{
|
||||
public Gh12025() => InitializeComponent();
|
||||
public Gh12025(bool useCompiledXaml)
|
||||
{
|
||||
//this stub will be replaced at compile time
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
class Tests
|
||||
{
|
||||
[SetUp] public void Setup() => Device.PlatformServices = new MockPlatformServices();
|
||||
[TearDown] public void TearDown() => Device.PlatformServices = null;
|
||||
|
||||
[Test]
|
||||
public void FindMostDerivedABP([Values(false, true)] bool useCompiledXaml)
|
||||
{
|
||||
if (useCompiledXaml)
|
||||
Assert.DoesNotThrow(() => MockCompiler.Compile(typeof(Gh12025)));
|
||||
var layout = new Gh12025(useCompiledXaml);
|
||||
Assert.That(NavigationPage.GetIconColor(layout), Is.EqualTo(NavigationPage.IconColorProperty.DefaultValue));
|
||||
Assert.That(Gh12025NavPage.GetIconColor(layout), Is.EqualTo(Color.HotPink));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче