tests/font.spec.js: Add EmbeddedFont.embed() test

This commit is contained in:
Jakub Valenta 2021-03-24 15:57:36 +01:00 committed by Luiz Américo
parent 923c495022
commit 393734cf18

View File

@ -33,4 +33,23 @@ describe('EmbeddedFont', () => {
expect(runSpy).toBeCalledTimes(4);
});
describe('emebed', () => {
test('sets BaseName based on font id and postscript name', () => {
const document = new PDFDocument();
const font = PDFFontFactory.open(
document,
'tests/fonts/Roboto-Regular.ttf',
undefined,
'F1099'
);
const dictionary = {
end: () => {},
};
font.dictionary = dictionary;
font.embed();
expect(dictionary.data.BaseFont).toBe('A@IIZZ+Roboto-Regular');
});
});
});