@@ -50,11 +50,14 @@ This file is part of the iText (R) project.
5050import com .itextpdf .kernel .pdf .PdfWriter ;
5151import com .itextpdf .kernel .pdf .canvas .PdfCanvasConstants ;
5252import com .itextpdf .kernel .utils .CompareTool ;
53+ import com .itextpdf .layout .borders .SolidBorder ;
5354import com .itextpdf .layout .element .AreaBreak ;
5455import com .itextpdf .layout .element .Paragraph ;
5556import com .itextpdf .layout .element .Text ;
57+ import com .itextpdf .layout .property .FloatPropertyValue ;
5658import com .itextpdf .layout .property .OverflowPropertyValue ;
5759import com .itextpdf .layout .property .Property ;
60+ import com .itextpdf .layout .property .UnitValue ;
5861import com .itextpdf .test .ExtendedITextTest ;
5962import com .itextpdf .test .annotations .type .IntegrationTest ;
6063import org .junit .Assert ;
@@ -69,6 +72,7 @@ public class TextWritingTest extends ExtendedITextTest {
6972
7073 public static final String sourceFolder = "./src/test/resources/com/itextpdf/layout/TextWritingTest/" ;
7174 public static final String destinationFolder = "./target/test/com/itextpdf/layout/TextWritingTest/" ;
75+ public static final String fontsFolder = "./src/test/resources/com/itextpdf/layout/fonts/" ;
7276
7377 @ BeforeClass
7478 public static void beforeClass () {
@@ -376,4 +380,28 @@ public void lineThroughTest() throws IOException, InterruptedException {
376380
377381 Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff_" ));
378382 }
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+ }
379407}
0 commit comments