public virtual void SplitSentenceFitMaxWidthTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); char[] words = GetSentence(3, 3); String wordsAsString = new String(words); double width = 6 * font.GetWidth(PdfFontUnitTest.TestFont.SIMPLE_GLYPH, FONT_SIZE); IList <String> result = font.SplitString(wordsAsString, FONT_SIZE, (float)width + 0.01f); NUnit.Framework.Assert.AreEqual(1, result.Count); NUnit.Framework.Assert.AreEqual(wordsAsString, result[0]); }
public virtual void SplitSentenceWithLineBreakTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); char[] words = new char[] { (char)PdfFontUnitTest.TestFont.SIMPLE_GLYPH, '\n', (char)PdfFontUnitTest.TestFont .SIMPLE_GLYPH }; String wordsAsString = new String(words); double width = 10 * font.GetWidth(PdfFontUnitTest.TestFont.SIMPLE_GLYPH, FONT_SIZE); IList <String> result = font.SplitString(wordsAsString, FONT_SIZE, (float)width + 0.01f); NUnit.Framework.Assert.AreEqual(2, result.Count); NUnit.Framework.Assert.AreEqual(new String(GetSentence(1)), result[0]); NUnit.Framework.Assert.AreEqual(new String(GetSentence(1)), result[1]); }
public virtual void SplitSentenceWordDoesNotFitMaxWidthCase_PartIsCombinedWithTheFollowingWordTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); char[] words = GetSentence(3, 4, 2); String wordsAsString = new String(words); double width = 3 * font.GetWidth(PdfFontUnitTest.TestFont.SIMPLE_GLYPH, FONT_SIZE); IList <String> result = font.SplitString(wordsAsString, FONT_SIZE, (float)width + 0.01f); NUnit.Framework.Assert.AreEqual(3, result.Count); NUnit.Framework.Assert.AreEqual(new String(GetSentence(3)), result[0]); NUnit.Framework.Assert.AreEqual(new String(GetSentence(3)), result[1]); NUnit.Framework.Assert.AreEqual(new String(GetSentence(1, 2)), result[2]); }
public virtual void SplitSentenceSymbolDoesNotFitLineTest() { PdfFontUnitTest.TestFont font = new PdfFontUnitTest.TestFont(); char[] words = GetSentence(3); String wordsAsString = new String(words); double width = font.GetWidth(PdfFontUnitTest.TestFont.SIMPLE_GLYPH, FONT_SIZE) / 2.0; IList <String> result = font.SplitString(wordsAsString, FONT_SIZE, (float)width + 0.01f); NUnit.Framework.Assert.AreEqual(4, result.Count); NUnit.Framework.Assert.AreEqual(new String(GetSentence(1)), result[0]); NUnit.Framework.Assert.AreEqual(new String(GetSentence(1)), result[1]); NUnit.Framework.Assert.AreEqual(new String(GetSentence(1)), result[2]); NUnit.Framework.Assert.AreEqual(new String(GetSentence(0)), result[3]); }