@@ -45,6 +45,7 @@ This file is part of the iText (R) project.
45
45
import com .itextpdf .commons .utils .SystemUtil ;
46
46
import com .itextpdf .kernel .colors .Color ;
47
47
import com .itextpdf .kernel .colors .ColorConstants ;
48
+ import com .itextpdf .kernel .colors .DeviceRgb ;
48
49
import com .itextpdf .kernel .pdf .PdfDocument ;
49
50
import com .itextpdf .kernel .pdf .PdfWriter ;
50
51
import com .itextpdf .kernel .utils .CompareTool ;
@@ -54,8 +55,14 @@ This file is part of the iText (R) project.
54
55
import com .itextpdf .layout .element .Div ;
55
56
import com .itextpdf .layout .element .Paragraph ;
56
57
import com .itextpdf .layout .element .Table ;
58
+ import com .itextpdf .layout .properties .FloatPropertyValue ;
59
+ import com .itextpdf .layout .properties .OverflowPropertyValue ;
60
+ import com .itextpdf .layout .properties .Property ;
61
+ import com .itextpdf .layout .properties .UnitValue ;
57
62
import com .itextpdf .test .ExtendedITextTest ;
58
63
import com .itextpdf .test .annotations .type .IntegrationTest ;
64
+
65
+ import java .io .FileNotFoundException ;
59
66
import org .junit .Assert ;
60
67
import org .junit .BeforeClass ;
61
68
import org .junit .Test ;
@@ -155,4 +162,38 @@ public void deepNestingInlineBlocksTest01() throws IOException, InterruptedExcep
155
162
doc .close ();
156
163
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
157
164
}
165
+
166
+ @ Test
167
+ public void wrappingAfter100PercentWidthFloatTest () throws IOException , InterruptedException {
168
+ String name = "wrappingAfter100PercentWidthFloatTest.pdf" ;
169
+ String output = destinationFolder + name ;
170
+ String cmp = sourceFolder + "cmp_" + name ;
171
+
172
+ try (Document doc = new Document (new PdfDocument (new PdfWriter (output )))) {
173
+ Div floatingDiv = new Div ()
174
+ .setWidth (UnitValue .createPercentValue (100 ))
175
+ .setHeight (10 )
176
+ .setBorder (new SolidBorder (1 ))
177
+ .setBackgroundColor (ColorConstants .RED );
178
+ floatingDiv .setProperty (Property .FLOAT , FloatPropertyValue .RIGHT );
179
+ floatingDiv .setProperty (Property .OVERFLOW_X , OverflowPropertyValue .VISIBLE );
180
+ floatingDiv .setProperty (Property .OVERFLOW_Y , OverflowPropertyValue .VISIBLE );
181
+ Div inlineDiv = new Div ()
182
+ .setWidth (UnitValue .createPercentValue (100 ))
183
+ .setHeight (10 )
184
+ .setBorder (new SolidBorder (1 ))
185
+ // gold color
186
+ .setBackgroundColor (new DeviceRgb (255 , 215 , 0 ));
187
+ inlineDiv .setProperty (Property .OVERFLOW_X , OverflowPropertyValue .VISIBLE );
188
+ inlineDiv .setProperty (Property .OVERFLOW_Y , OverflowPropertyValue .VISIBLE );
189
+
190
+ doc .add (new Div ()
191
+ .add (floatingDiv )
192
+ .add (new Paragraph ().add (inlineDiv ))
193
+ );
194
+ }
195
+
196
+ // TODO DEVSIX-5796 inline-block should be wrapped to the next line
197
+ Assert .assertNull (new CompareTool ().compareByContent (output , cmp , destinationFolder ));
198
+ }
158
199
}
0 commit comments