Skip to content

Commit

Permalink
tests/font.spec.js: Add EmbeddedFont.embed() test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubdatawrapper authored and blikblum committed Mar 24, 2021
1 parent 923c495 commit 393734c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/unit/font.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});

0 comments on commit 393734c

Please sign in to comment.