Correct old test cases

pull/283/head
Fakabbir Amin 2019-08-10 11:03:28 +05:30
parent 5b210981c9
commit 3125d3634a
1 changed files with 37 additions and 3 deletions

View File

@ -3,7 +3,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import nose, logging, os import nose, logging, os
from pdfminer.cmapdb import IdentityCMap, CMap from pdfminer.cmapdb import IdentityCMap, CMap, IdentityCMapByte
from pdfminer.pdffont import PDFCIDFont from pdfminer.pdffont import PDFCIDFont
from pdfminer.pdftypes import PDFStream from pdfminer.pdftypes import PDFStream
from pdfminer.psparser import PSLiteral from pdfminer.psparser import PSLiteral
@ -14,13 +14,13 @@ class TestPDFEncoding():
stream = PDFStream({'CMapName': PSLiteral('OneByteIdentityV')}, '') stream = PDFStream({'CMapName': PSLiteral('OneByteIdentityV')}, '')
spec = {'Encoding': stream} spec = {'Encoding': stream}
font = PDFCIDFont(None, spec) font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, CMap) assert isinstance(font.cmap, IdentityCMapByte)
def test_cmapname_onebyteidentityH(self): def test_cmapname_onebyteidentityH(self):
stream = PDFStream({'CMapName': PSLiteral('OneByteIdentityH')}, '') stream = PDFStream({'CMapName': PSLiteral('OneByteIdentityH')}, '')
spec = {'Encoding': stream} spec = {'Encoding': stream}
font = PDFCIDFont(None, spec) font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, CMap) assert isinstance(font.cmap, IdentityCMapByte)
def test_cmapname_V(self): def test_cmapname_V(self):
stream = PDFStream({'CMapName': PSLiteral('V')}, '') stream = PDFStream({'CMapName': PSLiteral('V')}, '')
@ -68,6 +68,40 @@ class TestPDFEncoding():
font = PDFCIDFont(None, spec) font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, IdentityCMap) assert isinstance(font.cmap, IdentityCMap)
def test_encoding_DLIdentH(self):
spec = {'Encoding': PSLiteral('DLIdent-H')}
font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, IdentityCMap)
def test_encoding_DLIdentV(self):
spec = {'Encoding': PSLiteral('DLIdent-V')}
font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, IdentityCMap)
def test_encoding_DLIdentH_as_PSLiteral_stream(self):
stream = PDFStream({'CMapName':PSLiteral('DLIdent-H')}, '')
spec = {'Encoding': stream}
font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, IdentityCMap)
def test_encoding_DLIdentH_as_PSLiteral_stream(self):
stream = PDFStream({'CMapName':PSLiteral('DLIdent-V')}, '')
spec = {'Encoding': stream}
font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, IdentityCMap)
def test_encoding_DLIdentH_as_stream(self):
stream = PDFStream({'CMapName':'DLIdent-H'}, '')
spec = {'Encoding': stream}
font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, IdentityCMap)
def test_encoding_DLIdentV_as_stream(self):
stream = PDFStream({'CMapName':'DLIdent-V'}, '')
spec = {'Encoding': stream}
font = PDFCIDFont(None, spec)
assert isinstance(font.cmap, IdentityCMap)
def test_font_without_spec(self): def test_font_without_spec(self):
font = PDFCIDFont(None, {}) font = PDFCIDFont(None, {})
assert isinstance(font.cmap, CMap) assert isinstance(font.cmap, CMap)