This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not return false on CanAdd if all that's required is boxing. - fixes #11620
- Loading branch information
1 parent
62b5928
commit 62a7dc8
Showing
3 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?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.Gh11620"> | ||
<ContentPage.Resources> | ||
<x:Array x:Key="myArray" Type="{x:Type x:Object}"> | ||
<x:String>Some string</x:String> | ||
<x:Int32>69</x:Int32> | ||
<x:Int32>32</x:Int32> | ||
</x:Array> | ||
</ContentPage.Resources> | ||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using Xamarin.Forms; | ||
using Xamarin.Forms.Core.UnitTests; | ||
|
||
namespace Xamarin.Forms.Xaml.UnitTests | ||
{ | ||
public partial class Gh11620 : ContentPage | ||
{ | ||
public Gh11620() => InitializeComponent(); | ||
public Gh11620(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 BoxOnAdd([Values(false, true)] bool useCompiledXaml) | ||
{ | ||
var layout = new Gh11620(useCompiledXaml); | ||
var arr = layout.Resources["myArray"]; | ||
Assert.That(arr, Is.TypeOf<object[]>()); | ||
Assert.That(((object[])arr).Length, Is.EqualTo(3)); | ||
Assert.That(((object[])arr)[2], Is.EqualTo(32)); | ||
} | ||
} | ||
} | ||
} |