Skip to content

Commit

Permalink
Fix tests for PDFBox 3 object model
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzido committed Sep 5, 2023
1 parent 8fe2837 commit 82c6fd8
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 80 deletions.
3 changes: 1 addition & 2 deletions src/test/java/technology/tabula/TestCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public void testIsPlaceholder() {
public void testGetTextElements() {
Cell cell = new Cell(0, 0, 0, 0);
assertTrue(cell.getTextElements().isEmpty());

TextElement tElement = new TextElement(0, 0, 0, 0, PDType1Font.HELVETICA_BOLD, 10, "test", 5);
TextElement tElement = new TextElement(0, 0, 0, 0, UtilsForTesting.HELVETICA_BOLD, 10, "test", 5);
TextChunk tChunk = new TextChunk(tElement);
List<TextChunk> tList = new ArrayList<>();
tList.add(tChunk);
Expand Down
11 changes: 6 additions & 5 deletions src/test/java/technology/tabula/TestLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.List;

import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.pdmodel.font.Standard14Fonts;
import org.junit.Test;

public class TestLine {
Expand All @@ -14,7 +15,7 @@ public class TestLine {
public void testSetTextElements() {
Line line = new Line();

TextElement tElement = new TextElement(0, 0, 0, 0, PDType1Font.HELVETICA_BOLD, 10, "test", 5);
TextElement tElement = new TextElement(0, 0, 0, 0, new PDType1Font(Standard14Fonts.FontName.HELVETICA), 10, "test", 5);
TextChunk tChunk = new TextChunk(tElement);
List<TextChunk> tList = new ArrayList<>();
tList.add(tChunk);
Expand All @@ -28,7 +29,7 @@ public void testSetTextElements() {
public void testAddTextChunkIntTextChunk() {
Line line = new Line();

TextElement tElement = new TextElement(0, 0, 0, 0, PDType1Font.HELVETICA_BOLD, 10, "test", 5);
TextElement tElement = new TextElement(0, 0, 0, 0, new PDType1Font(Standard14Fonts.FontName.HELVETICA), 10, "test", 5);
TextChunk tChunk = new TextChunk(tElement);
line.addTextChunk(3, tChunk);

Expand All @@ -39,7 +40,7 @@ public void testAddTextChunkIntTextChunk() {
public void testLessThanAddTextChunkIntTextChunk() {
Line line = new Line();

TextElement tElement = new TextElement(0, 0, 0, 0, PDType1Font.HELVETICA_BOLD, 10, "test", 5);
TextElement tElement = new TextElement(0, 0, 0, 0, new PDType1Font(Standard14Fonts.FontName.HELVETICA), 10, "test", 5);
TextChunk tChunk = new TextChunk(tElement);
line.addTextChunk(0, tChunk);
line.addTextChunk(0, tChunk);
Expand All @@ -51,7 +52,7 @@ public void testLessThanAddTextChunkIntTextChunk() {
public void testErrorAddTextChunkIntTextChunk() {
Line line = new Line();

TextElement tElement = new TextElement(0, 0, 0, 0, PDType1Font.HELVETICA_BOLD, 10, "test", 5);
TextElement tElement = new TextElement(0, 0, 0, 0, new PDType1Font(Standard14Fonts.FontName.HELVETICA), 10, "test", 5);
TextChunk tChunk = new TextChunk(tElement);
line.addTextChunk(-1, tChunk);
}
Expand All @@ -60,7 +61,7 @@ public void testErrorAddTextChunkIntTextChunk() {
public void testToString() {
Line line = new Line();

TextElement tElement = new TextElement(0, 0, 0, 0, PDType1Font.HELVETICA_BOLD, 10, "test", 5);
TextElement tElement = new TextElement(0, 0, 0, 0, new PDType1Font(Standard14Fonts.FontName.HELVETICA), 10, "test", 5);
TextChunk tChunk = new TextChunk(tElement);
line.addTextChunk(0, tChunk);
line.addTextChunk(0, tChunk);
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/technology/tabula/TestProjectionProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public void setUpProjectionProfile() {
PDPage pdPage = new PDPage();
PDDocument pdDocument = new PDDocument();

TextElement textElement = new TextElement(5f, 15f, 10f, 20f, PDType1Font.HELVETICA, 1f, "test", 1f);
TextElement textElement2 = new TextElement(5f, 15f, 10f, 20f, PDType1Font.HELVETICA, 1f, "test", 1f);
TextElement textElement = new TextElement(5f, 15f, 10f, 20f, UtilsForTesting.HELVETICA, 1f, "test", 1f);
TextElement textElement2 = new TextElement(5f, 15f, 10f, 20f, UtilsForTesting.HELVETICA, 1f, "test", 1f);
List<TextElement> textList = new ArrayList<>();
textList.add(textElement);
textList.add(textElement2);
Expand Down
Loading

0 comments on commit 82c6fd8

Please sign in to comment.