public virtual void ConvertGlyphToBytesWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); byte[] bytes = fontToTest.ConvertToBytes(E_GLYPH_FONT_SPECIFIC); NUnit.Framework.Assert.AreEqual(new byte[0], bytes); }
public virtual void ConvertToBytesWithNullEntry() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); byte[] bytes = fontToTest.ConvertToBytes((GlyphLine)null); NUnit.Framework.Assert.AreEqual(new byte[0], bytes); }
public virtual void ConvertGlyphToBytesWithCustomEncodingTest() { FontEncoding emptyFontEncoding = FontEncoding.CreateEmptyFontEncoding(); emptyFontEncoding.AddSymbol(E_CUSTOM_CODE, E_CODE); PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(emptyFontEncoding); byte[] bytes = fontToTest.ConvertToBytes(E_GLYPH_FONT_SPECIFIC); NUnit.Framework.Assert.AreEqual(new byte[] { E_CUSTOM_CODE }, bytes); }
public virtual void CreateGlyphLineWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); GlyphLine glyphLine = fontToTest.CreateGlyphLine("te"); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(E_GLYPH_CUSTOM_MAPPED); GlyphLine expected = new GlyphLine(glyphs, 0, 1); NUnit.Framework.Assert.AreEqual(expected, glyphLine); }
public virtual void CreateGlyphLineWithSpecificEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateFontSpecificEncoding ()); GlyphLine glyphLine = fontToTest.CreateGlyphLine("te"); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(T_GLYPH_FONT_SPECIFIC); glyphs.Add(E_GLYPH_FONT_SPECIFIC); GlyphLine expected = new GlyphLine(glyphs, 0, 2); NUnit.Framework.Assert.AreEqual(expected, glyphLine); }
public virtual void ConvertGlyphLineToBytesWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(T_GLYPH_FONT_SPECIFIC); glyphs.Add(E_GLYPH_FONT_SPECIFIC); GlyphLine glyphLine = new GlyphLine(glyphs, 0, 2); byte[] bytes = fontToTest.ConvertToBytes(glyphLine); NUnit.Framework.Assert.AreEqual(new byte[0], bytes); }
public virtual void AppendAnyGlyphWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); IList <Glyph> toAppend = new List <Glyph>(); int processed = fontToTest.AppendAnyGlyph("e ete", 0, toAppend); NUnit.Framework.Assert.AreEqual(1, processed); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(E_GLYPH_CUSTOM_MAPPED); NUnit.Framework.Assert.AreEqual(glyphs, toAppend); }
public virtual void AppendAnyGlyphWithSpecificEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateFontSpecificEncoding ()); IList <Glyph> toAppend = new List <Glyph>(); int processed = fontToTest.AppendAnyGlyph("te", 0, toAppend); NUnit.Framework.Assert.AreEqual(1, processed); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(T_GLYPH_FONT_SPECIFIC); NUnit.Framework.Assert.AreEqual(glyphs, toAppend); }
public virtual void WriteTextGlyphLineWithEmptyEncodingTest() { PdfSimpleFont <FontProgram> fontToTest = new PdfSimpleFontTest.TestSimpleFont(FontEncoding.CreateEmptyFontEncoding ()); IList <Glyph> glyphs = new List <Glyph>(); glyphs.Add(E_GLYPH_FONT_SPECIFIC); glyphs.Add(T_GLYPH_FONT_SPECIFIC); GlyphLine glyphLine = new GlyphLine(glyphs, 0, 2); MemoryStream bos = new MemoryStream(); using (PdfOutputStream pos = new PdfOutputStream(bos)) { fontToTest.WriteText(glyphLine, 0, 1, pos); } NUnit.Framework.Assert.AreEqual(new byte[] { OPEN_BRACKET_CODE, CLOSE_BRACKET_CODE }, bos.ToArray()); }