|
37 | 37 | import org.apache.pdfbox.io.RandomAccessReadBuffer; |
38 | 38 | import org.apache.pdfbox.pdmodel.PDDocument; |
39 | 39 | import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDMarkedContent; |
| 40 | +import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDLayoutAttributeObject; |
| 41 | +import org.apache.pdfbox.pdmodel.documentinterchange.taggedpdf.PDTableAttributeObject; |
40 | 42 |
|
41 | 43 | import org.junit.jupiter.api.Test; |
42 | 44 |
|
@@ -88,6 +90,27 @@ void testClassMap() throws IOException |
88 | 90 | PDStructureTreeRoot structureTreeRoot = doc.getDocumentCatalog().getStructureTreeRoot(); |
89 | 91 | checkElement(structureTreeRoot.getK(), attributeSet, structureTreeRoot.getClassMap(), classSet); |
90 | 92 | } |
| 93 | + for (Revisions<PDAttributeObject> r : attributeSet) |
| 94 | + { |
| 95 | + // check a few that we know |
| 96 | + if (r.size() >= 2) |
| 97 | + { |
| 98 | + // e.g. in Root/StructTreeRoot/K/[2]/K/[14]/K/[5]/K/[0]/K/[2]/A |
| 99 | + // and Root/StructTreeRoot/K/[2]/K/[14]/K/[5]/K/[2]/K/[0]/A |
| 100 | + // and Root/StructTreeRoot/K/[2]/K/[14]/K/[5]/K/[2]/K/[2]/A |
| 101 | + PDTableAttributeObject obj0 = (PDTableAttributeObject) r.getObject(0); |
| 102 | + assertEquals("Table", obj0.getOwner()); |
| 103 | + assertEquals(2, obj0.getColSpan()); |
| 104 | + PDLayoutAttributeObject obj1 = (PDLayoutAttributeObject) r.getObject(1); |
| 105 | + assertEquals("Layout", obj1.getOwner()); |
| 106 | + assertTrue(((Float) obj1.getWidth()) == 166.375f || ((Float) obj1.getWidth()) == 246.75f); |
| 107 | + assertTrue(((Float) obj1.getHeight()) == 14f || ((Float) obj1.getHeight()) == 17f); |
| 108 | + assertEquals("Start", obj1.getInlineAlign()); |
| 109 | + assertTrue("After".equals(obj1.getBlockAlign()) || "Before".equals(obj1.getBlockAlign())); |
| 110 | + assertEquals(0, r.getRevisionNumber(0)); |
| 111 | + assertEquals(0, r.getRevisionNumber(1)); |
| 112 | + } |
| 113 | + } |
91 | 114 |
|
92 | 115 | // collect attributes and check their count. |
93 | 116 | assertEquals(72, attributeSet.size()); |
|
0 commit comments