Specifies style flags proxy information applied to text.
Inheritance: ObservableObject
Exemplo n.º 1
0
        public void Flags_On_Set_Notify_Events_Are_Raised()
        {
            var style = new FontStyle();
            var target = new PropertyChangedObserver(style);

            style.Flags = 
                FontStyleFlags.Regular 
                | FontStyleFlags.Bold 
                | FontStyleFlags.Italic
                | FontStyleFlags.Underline
                | FontStyleFlags.Strikeout;

            Assert.Equal(FontStyleFlags.Regular
                | FontStyleFlags.Bold
                | FontStyleFlags.Italic
                | FontStyleFlags.Underline
                | FontStyleFlags.Strikeout, style.Flags);
            Assert.Equal(6, target.PropertyNames.Count);

            var propertyNames = new string[]
            {
                nameof(FontStyle.Flags),
                nameof(FontStyle.Regular),
                nameof(FontStyle.Bold),
                nameof(FontStyle.Italic),
                nameof(FontStyle.Underline),
                nameof(FontStyle.Strikeout)
            };

            Assert.Equal(propertyNames, target.PropertyNames);
        }
Exemplo n.º 2
0
        public void Italic_Property()
        {
            var target = new FontStyle();

            target.Italic = true;
            Assert.Equal(FontStyleFlags.Italic, target.Flags);

            target.Italic = false;
            Assert.Equal(FontStyleFlags.Regular, target.Flags);
        }
Exemplo n.º 3
0
        public void Bold_Property()
        {
            var target = new FontStyle();

            target.Bold = true;
            Assert.Equal(FontStyleFlags.Bold, target.Flags);

            target.Bold = false;
            Assert.Equal(FontStyleFlags.Regular, target.Flags);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new <see cref="TextStyle"/> instance.
 /// </summary>
 /// <param name="name">The text style name.</param>
 /// <param name="fontName">The font name.</param>
 /// <param name="fontFile">The font file path.</param>
 /// <param name="fontSize">The font size.</param>
 /// <param name="fontStyle">The font style.</param>
 /// <param name="textHAlignment">The text horizontal alignment.</param>
 /// <param name="textVAlignment">The text vertical alignment.</param>
 /// <returns>The new instance of the <see cref="TextStyle"/> class.</returns>
 public static TextStyle Create(string name = "", string fontName = "Calibri", string fontFile = @"C:\Windows\Fonts\calibri.ttf", double fontSize = 12.0, FontStyle fontStyle = null, TextHAlignment textHAlignment = TextHAlignment.Center, TextVAlignment textVAlignment = TextVAlignment.Center)
 {
     return new TextStyle()
     {
         Name = name,
         FontName = fontName,
         FontFile = fontFile,
         FontSize = fontSize,
         FontStyle = fontStyle ?? FontStyle.Create(FontStyleFlags.Regular),
         TextHAlignment = textHAlignment,
         TextVAlignment = textVAlignment
     };
 }
Exemplo n.º 5
0
        public void Underline_Property()
        {
            var target = new FontStyle();

            target.Underline = true;
            Assert.Equal(FontStyleFlags.Underline, target.Flags);

            target.Underline = false;
            Assert.Equal(FontStyleFlags.Regular, target.Flags);
        }
Exemplo n.º 6
0
 public void Inherits_From_ObservableObject()
 {
     var target = new FontStyle();
     Assert.True(target is ObservableObject);
 }
Exemplo n.º 7
0
        public void Strikeout_Property()
        {
            var target = new FontStyle();

            target.Strikeout = true;
            Assert.Equal(FontStyleFlags.Strikeout, target.Flags);

            target.Strikeout = false;
            Assert.Equal(FontStyleFlags.Regular, target.Flags);
        }