public virtual void TestIncorrectFontWeight() { FontCharacteristics fontCharacteristics = new FontCharacteristics(); fontCharacteristics.SetFontWeight((short)0); NUnit.Framework.Assert.AreEqual(400, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined()); fontCharacteristics.SetFontWeight((short)-500); NUnit.Framework.Assert.AreEqual(400, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined()); }
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)); }
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( )); }
public virtual void TestPositiveFontWeight() { FontCharacteristics fontCharacteristics = new FontCharacteristics(); fontCharacteristics.SetFontWeight((short)50); NUnit.Framework.Assert.AreEqual(100, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined()); fontCharacteristics.SetFontWeight((short)120); NUnit.Framework.Assert.AreEqual(100, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined()); fontCharacteristics.SetFontWeight((short)340); NUnit.Framework.Assert.AreEqual(300, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined()); fontCharacteristics.SetFontWeight((short)550); NUnit.Framework.Assert.AreEqual(500, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined()); fontCharacteristics.SetFontWeight((short)885); NUnit.Framework.Assert.AreEqual(800, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined()); fontCharacteristics.SetFontWeight((short)20000); NUnit.Framework.Assert.AreEqual(900, fontCharacteristics.GetFontWeight()); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined()); }