예제 #1
0
        public virtual void TestIncorrectFontStyle()
        {
            FontCharacteristics fontCharacteristics = new FontCharacteristics();

            fontCharacteristics.SetFontStyle(null);
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined());
            fontCharacteristics.SetFontStyle("dsodkodkopsdkod");
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined());
            fontCharacteristics.SetFontStyle("");
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined());
            fontCharacteristics.SetFontStyle("-1");
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined());
            fontCharacteristics.SetFontStyle("bold");
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined());
        }
예제 #2
0
        public virtual void TestAllowedFontStyle()
        {
            FontCharacteristics fontCharacteristics = new FontCharacteristics();

            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined());
            fontCharacteristics = new FontCharacteristics();
            fontCharacteristics.SetFontStyle("normal");
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined());
            fontCharacteristics = new FontCharacteristics();
            fontCharacteristics.SetFontStyle("oblique");
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined());
            fontCharacteristics = new FontCharacteristics();
            fontCharacteristics.SetFontStyle("italic");
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsItalic());
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined());
        }
예제 #3
0
        public virtual void TestEquals()
        {
            FontCharacteristics fontCharacteristics = new FontCharacteristics();

            fontCharacteristics.SetFontStyle("italic");
            fontCharacteristics.SetFontWeight((short)300);
            FontCharacteristics sameFontCharacteristics = new FontCharacteristics();

            sameFontCharacteristics.SetFontStyle("italic");
            sameFontCharacteristics.SetFontWeight((short)300);
            NUnit.Framework.Assert.IsTrue(fontCharacteristics.Equals(sameFontCharacteristics));
            FontCharacteristics copyFontCharacteristics = new FontCharacteristics(fontCharacteristics);

            NUnit.Framework.Assert.IsTrue(fontCharacteristics.Equals(copyFontCharacteristics));
            FontCharacteristics diffFontCharacteristics = new FontCharacteristics();

            fontCharacteristics.SetBoldFlag(true);
            fontCharacteristics.SetFontWeight((short)800);
            NUnit.Framework.Assert.IsFalse(fontCharacteristics.Equals(diffFontCharacteristics));
        }
예제 #4
0
        public virtual void TestHashCode()
        {
            FontCharacteristics fontCharacteristics = new FontCharacteristics();

            fontCharacteristics.SetFontStyle("italic");
            fontCharacteristics.SetFontWeight((short)300);
            FontCharacteristics sameFontCharacteristics = new FontCharacteristics();

            sameFontCharacteristics.SetFontStyle("italic");
            sameFontCharacteristics.SetFontWeight((short)300);
            NUnit.Framework.Assert.AreEqual(fontCharacteristics.GetHashCode(), sameFontCharacteristics.GetHashCode());
            FontCharacteristics copyFontCharacteristics = new FontCharacteristics(fontCharacteristics);

            NUnit.Framework.Assert.AreEqual(fontCharacteristics.GetHashCode(), copyFontCharacteristics.GetHashCode());
            FontCharacteristics diffFontCharacteristics = new FontCharacteristics();

            fontCharacteristics.SetBoldFlag(true);
            fontCharacteristics.SetFontWeight((short)800);
            NUnit.Framework.Assert.AreNotEqual(fontCharacteristics.GetHashCode(), diffFontCharacteristics.GetHashCode(
                                                   ));
        }