@@ -50,11 +50,14 @@ This file is part of the iText (R) project.
50
50
import com .itextpdf .kernel .pdf .PdfWriter ;
51
51
import com .itextpdf .kernel .pdf .canvas .PdfCanvasConstants ;
52
52
import com .itextpdf .kernel .utils .CompareTool ;
53
+ import com .itextpdf .layout .borders .SolidBorder ;
53
54
import com .itextpdf .layout .element .AreaBreak ;
54
55
import com .itextpdf .layout .element .Paragraph ;
55
56
import com .itextpdf .layout .element .Text ;
57
+ import com .itextpdf .layout .property .FloatPropertyValue ;
56
58
import com .itextpdf .layout .property .OverflowPropertyValue ;
57
59
import com .itextpdf .layout .property .Property ;
60
+ import com .itextpdf .layout .property .UnitValue ;
58
61
import com .itextpdf .test .ExtendedITextTest ;
59
62
import com .itextpdf .test .annotations .type .IntegrationTest ;
60
63
import org .junit .Assert ;
@@ -69,6 +72,7 @@ public class TextWritingTest extends ExtendedITextTest {
69
72
70
73
public static final String sourceFolder = "./src/test/resources/com/itextpdf/layout/TextWritingTest/" ;
71
74
public static final String destinationFolder = "./target/test/com/itextpdf/layout/TextWritingTest/" ;
75
+ public static final String fontsFolder = "./src/test/resources/com/itextpdf/layout/fonts/" ;
72
76
73
77
@ BeforeClass
74
78
public static void beforeClass () {
@@ -376,4 +380,28 @@ public void lineThroughTest() throws IOException, InterruptedException {
376
380
377
381
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff_" ));
378
382
}
383
+
384
+ @ Test
385
+ // TODO: update cmp file after fixing DEVSIX-4604
386
+ public void leadingAndFloatInTextTest () throws IOException , InterruptedException {
387
+ String outFileName = destinationFolder + "leadingAndFloatInText.pdf" ;
388
+ String cmpFileName = sourceFolder + "cmp_leadingAndFloatInText.pdf" ;
389
+
390
+ PdfDocument pdfDocument = new PdfDocument (new PdfWriter (outFileName ));
391
+
392
+ Document document = new Document (pdfDocument );
393
+
394
+ Paragraph p = new Paragraph ().setFixedLeading (30 ).setBorder (new SolidBorder (ColorConstants .RED , 2 ));
395
+ p .add ("First text" );
396
+
397
+ Text text = new Text ("Second text with float " );
398
+ text .setProperty (Property .FLOAT , FloatPropertyValue .LEFT );
399
+
400
+ p .add (text );
401
+
402
+ document .add (p );
403
+ document .close ();
404
+
405
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder ));
406
+ }
379
407
}
0 commit comments