public virtual void GetDescentOfGlyphWithoutBBoxTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); font.SetFontProgram(new PdfFontUnitTest.TestFontProgram()); int expectedValue = (int)(FONT_METRICS_DESCENT * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION); NUnit.Framework.Assert.AreEqual(expectedValue, font.GetDescent(PdfFontUnitTest.TestFont.SIMPLE_GLYPH_WITHOUT_BBOX , FONT_SIZE)); }
public virtual void GetDescentOfGlyphTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); int expectedDescent = font.GetGlyph(PdfFontUnitTest.TestFont.SIMPLE_GLYPH).GetBbox()[1]; int expectedValue = (int)(expectedDescent * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION); NUnit.Framework.Assert.AreEqual(expectedValue, font.GetDescent(PdfFontUnitTest.TestFont.SIMPLE_GLYPH, FONT_SIZE )); }
public virtual void GetDescentOfTextWithGlyphWithoutBBoxTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); font.SetFontProgram(new PdfFontUnitTest.TestFontProgram()); char[] text = new char[] { (char)PdfFontUnitTest.TestFont.SIMPLE_GLYPH, (char)PdfFontUnitTest.TestFont.SIMPLE_GLYPH_WITHOUT_BBOX }; String textAsString = new String(text); int expectedMinDescent = Math.Min(font.GetGlyph(PdfFontUnitTest.TestFont.SIMPLE_GLYPH).GetBbox()[1], FONT_METRICS_DESCENT ); int expectedValue = (int)(expectedMinDescent * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION); NUnit.Framework.Assert.AreEqual(expectedValue, font.GetDescent(textAsString, FONT_SIZE)); }
public virtual void GetDescentOfTextTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); char[] text = new char[] { (char)PdfFontUnitTest.TestFont.SIMPLE_GLYPH, PdfFontUnitTest.TestFont.COMPLEX_GLYPH_AS_CHARS [0], PdfFontUnitTest.TestFont.COMPLEX_GLYPH_AS_CHARS[1] }; String textAsString = new String(text); int expectedMinDescent = Math.Min(font.GetGlyph(PdfFontUnitTest.TestFont.SIMPLE_GLYPH).GetBbox()[1], font. GetGlyph(PdfFontUnitTest.TestFont.COMPLEX_GLYPH).GetBbox()[1]); int expectedValue = (int)(expectedMinDescent * FONT_SIZE / (double)FontProgram.UNITS_NORMALIZATION); NUnit.Framework.Assert.AreEqual(expectedValue, font.GetDescent(textAsString, FONT_SIZE)); }
public virtual void GetDescentOfUnknownGlyphTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); NUnit.Framework.Assert.AreEqual(0, font.GetDescent(111, 50)); }
public virtual void DescentCannotBePositiveTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); NUnit.Framework.Assert.AreEqual(0, font.GetDescent(PdfFontUnitTest.TestFont.SIMPLE_GLYPH_WITH_POSITIVE_DESCENT , 50)); }