You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2018/10/20 12:59:28 UTC
svn commit: r1844416 - in /pdfbox/branches/2.0/pdfbox/src/test:
java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java
resources/org/apache/pdfbox/pdmodel/fdf/xfdf-test-document-annotations.xml
Author: tilman
Date: Sat Oct 20 12:59:28 2018
New Revision: 1844416
URL: http://svn.apache.org/viewvc?rev=1844416&view=rev
Log:
PDFBOX-3646, PDFBOX-4345: add test based on XML by Kai Keggenhoff
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java
pdfbox/branches/2.0/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/fdf/xfdf-test-document-annotations.xml
Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java?rev=1844416&r1=1844415&r2=1844416&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java Sat Oct 20 12:59:28 2018
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -39,7 +40,31 @@ public class FDFAnnotationTest
File f = new File(FDFAnnotationTest.class.getResource("xfdf-test-document-annotations.xml").toURI());
FDFDocument fdfDoc = FDFDocument.loadXFDF(f);
List<FDFAnnotation> fdfAnnots = fdfDoc.getCatalog().getFDF().getAnnotations();
- assertEquals(17, fdfAnnots.size());
+ assertEquals(18, fdfAnnots.size());
+
+ // test PDFBOX-4345 and PDFBOX-3646
+ boolean testedPDFBox4345andPDFBox3646 = false;
+ for (FDFAnnotation ann : fdfAnnots)
+ {
+ if (ann instanceof FDFAnnotationFreeText)
+ {
+ FDFAnnotationFreeText annotationFreeText = (FDFAnnotationFreeText) ann;
+ if ("P&1 P&2 P&3".equals(annotationFreeText.getContents()))
+ {
+ testedPDFBox4345andPDFBox3646 = true;
+ System.out.println(annotationFreeText.getRichContents());
+ Assert.assertEquals("<body style=\"font:12pt Helvetica; "
+ + "color:#D66C00;\" xfa:APIVersion=\"Acrobat:7.0.8\" "
+ + "xfa:spec=\"2.0.2\" xmlns=\"http://www.w3.org/1999/xhtml\" "
+ + "xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\">\n"
+ + " <p dir=\"ltr\">P&1 <span style=\"text-"
+ + "decoration:word;font-family:Helvetica\">P&2</span> "
+ + "P&3</p>\n"
+ + " </body>", annotationFreeText.getRichContents().trim());
+ }
+ }
+ }
+ Assert.assertTrue(testedPDFBox4345andPDFBox3646);
fdfDoc.close();
}
}
\ No newline at end of file
Modified: pdfbox/branches/2.0/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/fdf/xfdf-test-document-annotations.xml
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/fdf/xfdf-test-document-annotations.xml?rev=1844416&r1=1844415&r2=1844416&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/fdf/xfdf-test-document-annotations.xml (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/resources/org/apache/pdfbox/pdmodel/fdf/xfdf-test-document-annotations.xml Sat Oct 20 12:59:28 2018
@@ -65,5 +65,16 @@
<link width="0" page="3" rect="345.110000,457.870000,499.680000,471.040000" opacity="1" rotation="0" actiontype="URI" target="https://www.dropbox.com/help/26" />
<link width="0" page="3" rect="158.240000,205.870000,273.730000,219.040000" opacity="1" rotation="0" actiontype="URI" target="http://www.dropbox.com/anywhere" />
<link width="0" page="3" rect="105.110000,187.870000,217.190000,201.040000" opacity="1" rotation="0" actiontype="URI" target="http://www.dropbox.com" />
+<!-- the following one only to test PDFBOX-4345 and PDFBOX-3646. Might appear over another -->
+ <freetext page="0" date="D:20150415150448+00'00'" title="weblogic" rect="400.430000,487.270000,562.980000,571.310000" flags="print" name="88D147A8-CC51-4178-8102-8C63E2C90F09" creationdate="D:20150415150432+00'00'" opacity="1" rotation="0" width="2" style="solid" justification="left">
+ <contents-richtext>
+ <body
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" style="font:12pt Helvetica; color:#D66C00;" xfa:APIVersion="Acrobat:7.0.8" xfa:spec="2.0.2">
+ <p dir="ltr">P&1 <span style="text-decoration:word;font-family:Helvetica">P&2</span> P&3</p>
+ </body>
+ </contents-richtext>
+ <defaultappearance>/Helvetica 12 Tf 0.842 0.424 0.000 rg</defaultappearance>
+ </freetext>
</annots>
</xfdf>
\ No newline at end of file