зеркало из https://github.com/DeGsoft/maui-linux.git
Родитель
f30d5aec00
Коммит
a6c08d577e
|
@ -114,8 +114,14 @@ namespace Xamarin.Forms.Xaml
|
|||
var xfExtendedTypeConverter = xfTypeConverter as IExtendedTypeConverter;
|
||||
if (xfExtendedTypeConverter != null)
|
||||
return value = xfExtendedTypeConverter.ConvertFromInvariantString(str, serviceProvider);
|
||||
if (xfTypeConverter != null)
|
||||
return value = xfTypeConverter.ConvertFromInvariantString(str);
|
||||
if (xfTypeConverter != null) {
|
||||
try {
|
||||
return value = xfTypeConverter.ConvertFromInvariantString(str);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new XamlParseException("Type conversion failed", serviceProvider, e);
|
||||
}
|
||||
}
|
||||
var converterType = converter?.GetType();
|
||||
if (converterType != null)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Xamarin.Forms.Xaml.UnitTests.Gh5378_1">
|
||||
<Label Margin="1,2,3," />
|
||||
</ContentPage>
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Core.UnitTests;
|
||||
|
||||
namespace Xamarin.Forms.Xaml.UnitTests
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Skip)]
|
||||
public partial class Gh5378_1 : ContentPage
|
||||
{
|
||||
public Gh5378_1() => InitializeComponent();
|
||||
public Gh5378_1(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 ReportSyntaxError([Values(false, true)]bool useCompiledXaml)
|
||||
{
|
||||
if (useCompiledXaml)
|
||||
Assert.Throws<XamlParseException>(() => MockCompiler.Compile(typeof(Gh5378_1)));
|
||||
else
|
||||
Assert.Throws<XamlParseException>(() => new Gh5378_1(useCompiledXaml));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Xaml.UnitTests.Gh5378_2">
|
||||
<Button Clicked="{Binding FooBar}" />
|
||||
</ContentPage>
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Core.UnitTests;
|
||||
|
||||
namespace Xamarin.Forms.Xaml.UnitTests
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Skip)]
|
||||
public partial class Gh5378_2 : ContentPage
|
||||
{
|
||||
public Gh5378_2()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Gh5378_2(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 ReportSyntaxError([Values(false, true)]bool useCompiledXaml)
|
||||
{
|
||||
if (useCompiledXaml)
|
||||
Assert.Throws<XamlParseException>(() => MockCompiler.Compile(typeof(Gh5378_2)));
|
||||
else
|
||||
Assert.Throws<XamlParseException>(() => new Gh5378_2(useCompiledXaml));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче