summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xamarin.Forms.Core.UnitTests/LabelTests.cs26
-rw-r--r--Xamarin.Forms.Core/Label.cs1
2 files changed, 27 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/LabelTests.cs b/Xamarin.Forms.Core.UnitTests/LabelTests.cs
index f56f792d..5e2ffb53 100644
--- a/Xamarin.Forms.Core.UnitTests/LabelTests.cs
+++ b/Xamarin.Forms.Core.UnitTests/LabelTests.cs
@@ -46,6 +46,32 @@ namespace Xamarin.Forms.Core.UnitTests
}
[Test]
+ public void InvalidateMeasureWhenTextChanges ()
+ {
+ var label = new Label();
+
+ bool fired;
+ label.MeasureInvalidated += (sender, args) =>
+ {
+ fired = true;
+ };
+
+ fired = false;
+ label.Text = "Foo";
+ Assert.IsTrue (fired);
+
+ var fs = new FormattedString ();
+
+ fired = false;
+ label.FormattedText = fs;
+ Assert.IsTrue (fired);
+
+ fired = false;
+ fs.Spans.Add (new Span {Text = "bar"});
+ Assert.IsTrue (fired);
+ }
+
+ [Test]
public void AssignToFontStructUpdatesFontFamily (
[Values (NamedSize.Default, NamedSize.Large, NamedSize.Medium, NamedSize.Small, NamedSize.Micro)] NamedSize size,
[Values (FontAttributes.None, FontAttributes.Bold, FontAttributes.Italic, FontAttributes.Bold | FontAttributes.Italic)] FontAttributes attributes)
diff --git a/Xamarin.Forms.Core/Label.cs b/Xamarin.Forms.Core/Label.cs
index 1385b763..a6390b2d 100644
--- a/Xamarin.Forms.Core/Label.cs
+++ b/Xamarin.Forms.Core/Label.cs
@@ -253,6 +253,7 @@ namespace Xamarin.Forms
void OnFormattedTextChanged(object sender, PropertyChangedEventArgs e)
{
+ InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged);
OnPropertyChanged("FormattedText");
}