Skip to content

Commit

Permalink
PDFBOX-5879: add test for rotationMagic
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1920735 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Sep 17, 2024
1 parent c36cb74 commit 8e64f10
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tools/src/test/java/org/apache/pdfbox/tools/TestExtractText.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class TestExtractText
PrintStream printStream = null;
static final String testfile1 = "src/test/resources/org/apache/pdfbox/testPDFPackage.pdf";
static final String testfile2 = "src/test/resources/org/apache/pdfbox/hello3.pdf";
static final String testfile3 = "src/test/resources/org/apache/pdfbox/AngledExample.pdf";
static String filename1 = null;
static String filename2 = null;

Expand Down Expand Up @@ -243,4 +244,35 @@ void testPDFBoxRepeatableSubcommandAddFileNameOutfileAppend(@TempDir Path tempDi
assertTrue(result.contains("PDF file: " + filename2));
}

/**
* Simple test to check that the rotationMagic feature works.
*
* @param tempDir
* @throws Exception
*/
@Test
void testRotationMagic(@TempDir Path tempDir) throws Exception
{
Path path = null;

try
{
path = tempDir.resolve("outfile.txt");
Files.deleteIfExists(path);
}
catch (InvalidPathException ipe)
{
System.err.println(
"Error creating temporary test file in " + this.getClass().getSimpleName());
}
assertNotNull(path);

PDFBox.main(new String[] { "export:text", "-rotationMagic", "-i", testfile3,
"-o", path.toString() });

String result = new String(Files.readAllBytes(path), "UTF-8");
assertTrue(result.contains("Horizontal Text"), result);
assertTrue(result.contains("Vertical Text"), result);
}

}
Binary file not shown.

0 comments on commit 8e64f10

Please sign in to comment.