mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-05-31 07:11:00 +02:00
Merge pull request #21161 from Snuffleupagus/getPageIndex-more-tests
Improve unit-testing for the `PDFDocumentProxy.prototype.getPageIndex` method
This commit is contained in:
commit
4aed8fd01b
@ -1258,6 +1258,22 @@ describe("api", function () {
|
||||
expect(pageIndex).toEqual(1);
|
||||
});
|
||||
|
||||
it("gets page index, for a non-cached page", async function () {
|
||||
const loadingTask = getDocument(
|
||||
buildGetDocumentParams("pdf.pdf", {
|
||||
disableAutoFetch: true,
|
||||
disableStream: true,
|
||||
})
|
||||
);
|
||||
const pdfDoc = await loadingTask.promise;
|
||||
|
||||
const ref = { num: 1427, gen: 0 }; // Reference to 500th page.
|
||||
const pageIndex = await pdfDoc.getPageIndex(ref);
|
||||
expect(pageIndex).toEqual(499);
|
||||
|
||||
await pdfDoc.destroy();
|
||||
});
|
||||
|
||||
it("gets invalid page index", async function () {
|
||||
const pageRefs = [
|
||||
/* fontRef = */ { num: 3, gen: 0 },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user