summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36788.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 13:02:25 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-22 16:13:41 -0700
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36788.cs
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36788.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36788.cs122
1 files changed, 122 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36788.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36788.cs
new file mode 100644
index 00000000..76dbbda7
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla36788.cs
@@ -0,0 +1,122 @@
+using System;
+using System.Threading.Tasks;
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 36788, "Truncation Issues with Relative Layouts")]
+ public class Bugzilla36788 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ Label _resultLabel;
+ Label _testLabel;
+ View _container;
+
+ protected override void Init ()
+ {
+ // Initialize ui here instead of ctor
+ var stackLayout = new StackLayout {
+ Spacing = 8
+ };
+
+ var longString = "Very long text in single line to be truncated at tail. Adding extra text to make sure it gets truncated.";
+
+ var contentView = new ContentView {
+ Padding = 16,
+ BackgroundColor = Color.Gray,
+ Content = new Label {
+ BackgroundColor = Color.Aqua,
+ Text = longString,
+ LineBreakMode = LineBreakMode.TailTruncation
+ }
+ };
+
+ stackLayout.Children.Add (contentView);
+
+ contentView = new ContentView {
+ Padding = 16,
+ BackgroundColor = Color.Gray,
+ Content = new RelativeLayout {
+ BackgroundColor = Color.Navy,
+ Children = {
+ {new Label {
+ BackgroundColor = Color.Blue,
+ Text = longString,
+ LineBreakMode = LineBreakMode.TailTruncation
+ }, Forms.Constraint.Constant (0)},
+ {new Label {
+ BackgroundColor = Color.Fuchsia,
+ Text = longString,
+ LineBreakMode = LineBreakMode.TailTruncation
+ }, Forms.Constraint.Constant (0), Forms.Constraint.Constant (40)},
+ {new Label {
+ BackgroundColor = Color.Fuchsia,
+ Text = longString,
+ LineBreakMode = LineBreakMode.TailTruncation
+ }, Forms.Constraint.Constant (10), Forms.Constraint.Constant (80)},
+ }
+ }
+ };
+
+ stackLayout.Children.Add (contentView);
+
+ contentView = new ContentView {
+ Padding = 16,
+ BackgroundColor = Color.Gray,
+ IsClippedToBounds = true,
+ Content = _container = new RelativeLayout {
+ IsClippedToBounds = true,
+ BackgroundColor = Color.Navy,
+ Children = {
+ {_testLabel = new Label {
+ BackgroundColor = Color.Blue,
+ Text = longString,
+ LineBreakMode = LineBreakMode.TailTruncation
+ }, Forms.Constraint.Constant (0)},
+ {new Label {
+ BackgroundColor = Color.Fuchsia,
+ Text = longString,
+ LineBreakMode = LineBreakMode.TailTruncation
+ }, Forms.Constraint.Constant (0), Forms.Constraint.Constant (40)},
+ {new Label {
+ BackgroundColor = Color.Fuchsia,
+ Text = longString,
+ LineBreakMode = LineBreakMode.TailTruncation
+ }, Forms.Constraint.Constant (10), Forms.Constraint.Constant (80)},
+ }
+ }
+ };
+
+ stackLayout.Children.Add (contentView);
+
+ _resultLabel = new Label ();
+ stackLayout.Children.Add (_resultLabel);
+
+ Content = stackLayout;
+ }
+
+ protected override async void OnAppearing ()
+ {
+ base.OnAppearing ();
+ await Task.Delay (200);
+
+ double fuzzFactor = 15; // labels sometimes overflow slightly, thanks hinting
+
+ if (Math.Abs (_testLabel.Width - _container.Width) < fuzzFactor)
+ _resultLabel.Text = "Passed";
+ }
+
+#if UITEST
+ [Test]
+ public void Bugzilla36788Test ()
+ {
+ RunningApp.WaitForElement (q => q.Marked ("Passed"));
+ }
+#endif
+ }
+}