Add tests for weight and italic extraction
This commit is contained in:
parent
b162611016
commit
9c9b37a58e
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -752,3 +752,4 @@
|
||||
!bug1937438_af_from_latex.pdf
|
||||
!bug1937438_from_word.pdf
|
||||
!bug1937438_mml_from_latex.pdf
|
||||
!translated_fonts_weight.pdf
|
||||
BIN
test/pdfs/translated_fonts_weight.pdf
Normal file
BIN
test/pdfs/translated_fonts_weight.pdf
Normal file
Binary file not shown.
@ -3309,6 +3309,46 @@ describe("api", function () {
|
||||
await loadingTask.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Fonts", function () {
|
||||
it("set black/bold/italic properties to translated fonts", async function () {
|
||||
const loadingTask = getDocument(
|
||||
buildGetDocumentParams("translated_fonts_weight.pdf")
|
||||
);
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
const page = await pdfDoc.getPage(1);
|
||||
await page.getOperatorList();
|
||||
|
||||
const fontsMap = Array.from(page.commonObjs);
|
||||
const fonts = fontsMap.map(entry => entry[1]);
|
||||
|
||||
expect(fonts[0].black).toEqual(undefined);
|
||||
expect(fonts[0].bold).toEqual(undefined);
|
||||
expect(fonts[0].italic).toEqual(undefined);
|
||||
|
||||
expect(fonts[1].black).toEqual(undefined);
|
||||
expect(fonts[1].bold).toEqual(true);
|
||||
expect(fonts[1].italic).toEqual(undefined);
|
||||
|
||||
expect(fonts[2].black).toEqual(undefined);
|
||||
expect(fonts[2].bold).toEqual(undefined);
|
||||
expect(fonts[2].italic).toEqual(true);
|
||||
|
||||
expect(fonts[3].black).toEqual(undefined);
|
||||
expect(fonts[3].bold).toEqual(true);
|
||||
expect(fonts[3].italic).toEqual(true);
|
||||
|
||||
expect(fonts[4].black).toEqual(true);
|
||||
expect(fonts[4].bold).toEqual(undefined);
|
||||
expect(fonts[4].italic).toEqual(undefined);
|
||||
|
||||
expect(fonts[5].black).toEqual(true);
|
||||
expect(fonts[5].bold).toEqual(undefined);
|
||||
expect(fonts[5].italic).toEqual(true);
|
||||
|
||||
await loadingTask.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Page", function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user