From 02a1c1ed518b8a717bc2824d94f0aa05cdc0dac8 Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Thu, 11 Jan 2018 20:52:13 +0000 Subject: [PATCH] more tests for glyphlist --- .../Fonts/Encodings/GlyphListTests.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/UglyToad.PdfPig.Tests/Fonts/Encodings/GlyphListTests.cs b/src/UglyToad.PdfPig.Tests/Fonts/Encodings/GlyphListTests.cs index 430299dd..14f4fc40 100644 --- a/src/UglyToad.PdfPig.Tests/Fonts/Encodings/GlyphListTests.cs +++ b/src/UglyToad.PdfPig.Tests/Fonts/Encodings/GlyphListTests.cs @@ -1,5 +1,6 @@ namespace UglyToad.PdfPig.Tests.Fonts.Encodings { + using System.Collections.Generic; using PdfPig.Fonts.Encodings; using Xunit; @@ -32,5 +33,38 @@ Assert.Equal("O", result); } + + [Fact] + public void UnicodeToNameNotDefined() + { + var list = new GlyphList(new Dictionary()); + + var result = list.UnicodeCodePointToName(120); + + Assert.Equal(".notdef", result); + } + + [Fact] + public void NameToUnicodeNull() + { + var list = new GlyphList(new Dictionary()); + + var result = list.NameToUnicode(null); + + Assert.Null(result); + } + + [Fact] + public void NameToUnicodeRemovesSuffix() + { + var list = new GlyphList(new Dictionary + { + {"Boris", "B"} + }); + + var result = list.NameToUnicode("Boris.Special"); + + Assert.Equal("B", result); + } } }