diff options
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Issues/Issue1250.xaml.cs')
-rw-r--r-- | Xamarin.Forms.Xaml.UnitTests/Issues/Issue1250.xaml.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1250.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1250.xaml.cs new file mode 100644 index 00000000..8f4cdb7d --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue1250.xaml.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +using NUnit.Framework; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public class Issue1250AspectRatioContainer : ContentView + { + protected override SizeRequest OnSizeRequest(double widthConstraint, double heightConstraint) + { + return new SizeRequest(new Size(widthConstraint, widthConstraint * AspectRatio)); + } + + public double AspectRatio { get; set; } + } + + public partial class Issue1250 : ContentPage + { + public Issue1250 () + { + InitializeComponent (); + } + + public Issue1250 (bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + public class Tests + { + [TestCase (false)] + [TestCase (true)] + public void AddCustomElementInCollection (bool useCompiledXaml) + { + var page = new Issue1250 (useCompiledXaml); + var stack = page.stack; + + Assert.AreEqual (3, stack.Children.Count); + Assert.That (stack.Children [0], Is.TypeOf<Label> ()); + Assert.That (stack.Children [1], Is.TypeOf<Issue1250AspectRatioContainer> ()); + Assert.That (stack.Children [2], Is.TypeOf<Label> ()); + } + } + } +}
\ No newline at end of file |