Skip to content

Commit 17cdd9b

Browse files
Move tables test to specific struct tree spec file
1 parent d04832a commit 17cdd9b

File tree

3 files changed

+29
-42
lines changed

3 files changed

+29
-42
lines changed

test/test_manifest.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,12 +1676,6 @@
16761676
"lastPage": 1,
16771677
"type": "eq"
16781678
},
1679-
{ "id": "issue20324",
1680-
"file": "pdfs/issue20324.pdf",
1681-
"md5": "13250232aa91444f983279581d9c02d6",
1682-
"rounds": 1,
1683-
"type": "eq"
1684-
},
16851679
{
16861680
"id": "issue13561_reduced",
16871681
"file": "pdfs/issue13561_reduced.pdf",

test/unit/api_spec.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5076,41 +5076,6 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
50765076
canvasFactory.destroy(canvasAndCtx);
50775077
await loadingTask.destroy();
50785078
});
5079-
5080-
it("should collect all list and table items in StructTree", async function() {
5081-
const findNodes = (node, check) => {
5082-
const results = [];
5083-
if (check(node)) {
5084-
results.push(node);
5085-
}
5086-
if (node.children) {
5087-
for (const child of node.children) {
5088-
results.push(...findNodes(child, check));
5089-
}
5090-
}
5091-
return results;
5092-
};
5093-
const loadingTask = getDocument(buildGetDocumentParams("issue20324.pdf"));
5094-
5095-
const pdfDoc = await loadingTask.promise;
5096-
const page = await pdfDoc.getPage(1);
5097-
const tree = await page.getStructTree({
5098-
includeMarkedContent: true,
5099-
});
5100-
const cells = findNodes(
5101-
tree,
5102-
node => node.role === "TD"
5103-
);
5104-
expect(cells.length).toEqual(4);
5105-
5106-
const listItems = findNodes(
5107-
tree,
5108-
node => node.role === "LI"
5109-
);
5110-
expect(listItems.length).toEqual(4);
5111-
5112-
await loadingTask.destroy();
5113-
});
51145079
});
51155080

51165081
describe("Multiple `getDocument` instances", function () {

test/unit/struct_tree_spec.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ describe("struct tree", function () {
258258
await loadingTask.destroy();
259259
});
260260

261-
it("parses structure with some MathML in MS Office specific entry", async function () {
261+
it("parses structure with some MathML in MS Office specific entry", async function() {
262262
const filename = "bug1937438_from_word.pdf";
263263
const params = buildGetDocumentParams(filename);
264264
const loadingTask = getDocument(params);
@@ -300,6 +300,34 @@ describe("struct tree", function () {
300300
},
301301
struct
302302
);
303+
});
304+
305+
it("should collect all list and table items in StructTree", async function () {
306+
const findNodes = (node, check) => {
307+
const results = [];
308+
if (check(node)) {
309+
results.push(node);
310+
}
311+
if (node.children) {
312+
for (const child of node.children) {
313+
results.push(...findNodes(child, check));
314+
}
315+
}
316+
return results;
317+
};
318+
const loadingTask = getDocument(buildGetDocumentParams("issue20324.pdf"));
319+
320+
const pdfDoc = await loadingTask.promise;
321+
const page = await pdfDoc.getPage(1);
322+
const tree = await page.getStructTree({
323+
includeMarkedContent: true,
324+
});
325+
const cells = findNodes(tree, node => node.role === "TD");
326+
expect(cells.length).toEqual(4);
327+
328+
const listItems = findNodes(tree, node => node.role === "LI");
329+
expect(listItems.length).toEqual(4);
330+
303331
await loadingTask.destroy();
304332
});
305333
});

0 commit comments

Comments
 (0)