diff options
author | Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> | 2016-08-17 03:05:42 +0900 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-08-16 11:05:42 -0700 |
commit | 966683a807f68f302e8f121279387109f2a4a73b (patch) | |
tree | 72ad57bdd02545d5c2741fc0a8e0bf606afb0368 /Xamarin.Forms.Core.UnitTests | |
parent | 414e5d1ec3712c526e8e527df948338d447f1ba1 (diff) | |
download | xamarin-forms-966683a807f68f302e8f121279387109f2a4a73b.tar.gz xamarin-forms-966683a807f68f302e8f121279387109f2a4a73b.tar.bz2 xamarin-forms-966683a807f68f302e8f121279387109f2a4a73b.zip |
Invalidate measure of Label when FormattedText changes (#303)
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/LabelTests.cs | 26 |
1 files changed, 26 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) |