Exemple #1
0
        public void AddStyleTest()
        {
            var wordStyle = new TextStyle
            {
                Foreground    = Brushes.Blue,
                Display       = true,
                FontWeight    = FontWeights.ExtraBold,
                TextAlign     = TextAlignment.Justify,
                VerticalAlign = VerticalAlignment.Center,
                HyperRef      = "test:url"
            };

            var newStyle = new TextStyle
            {
                Foreground = Brushes.Red,
                Display    = false
            };

            wordStyle.AddStyle(newStyle); // override style2 by style

            Assert.IsNotNull(wordStyle);
            Assert.AreEqual(FlowDirection.RightToLeft, wordStyle.Direction);
            Assert.IsFalse(wordStyle.Display);
            Assert.IsTrue(wordStyle.IsRtl);
            Assert.AreEqual(TextStyle.RtlCulture, wordStyle.Language);
            Assert.AreEqual(Brushes.Red, wordStyle.Foreground);
            Assert.AreEqual(0, wordStyle.Width);
            Assert.AreEqual(0, wordStyle.Height);
            Assert.AreEqual(0, wordStyle.FontSize);
            Assert.AreEqual(0, wordStyle.MarginBottom);
            Assert.AreEqual(0, wordStyle.MarginTop);
            Assert.AreEqual(0, wordStyle.MarginRight);
            Assert.AreEqual(0, wordStyle.MarginLeft);
            Assert.AreEqual(FontWeights.Normal, wordStyle.FontWeight);
            Assert.AreEqual(TextAlignment.Justify, wordStyle.TextAlign);
            Assert.AreEqual(VerticalAlignment.Center, wordStyle.VerticalAlign);
            Assert.IsNull(wordStyle.Image);
            Assert.IsNotNull(wordStyle.HyperRef);
        }