Skip to content

Commit c176a2c

Browse files
committed
Fix positioning of floating elements outside block formatting context
DEVSIX-5135
1 parent 0980bca commit c176a2c

19 files changed

+255
-20
lines changed

src/test/java/com/itextpdf/html2pdf/css/ClearTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,22 @@ public void imgWideBorderFloatAmongParaWithSpanTest() throws IOException, Interr
140140
public void imgWideBorderClearAndDisplayBlockParaFloatTest() throws IOException, InterruptedException {
141141
convertToPdfAndCompare("imgWideBorderClearAndDisplayBlockParaFloat", sourceFolder, destinationFolder);
142142
}
143+
144+
@Test
145+
public void floatsPositioningOutsideDivWithClearTest() throws IOException, InterruptedException {
146+
// TODO DEVSIX-7602 Css right and left clear property is processed incorrectly if floats "intersect" by x
147+
convertToPdfAndCompare("floatsPositioningOutsideDivWithClear", sourceFolder, destinationFolder);
148+
}
149+
150+
@Test
151+
public void wideFloatsPositioningOutsideDivWithClearTest() throws IOException, InterruptedException {
152+
// TODO DEVSIX-7602 Css right and left clear property is processed incorrectly for wide floats
153+
convertToPdfAndCompare("wideFloatsPositioningOutsideDivWithClear", sourceFolder, destinationFolder);
154+
}
155+
156+
@Test
157+
public void floatsWithClearInsideFlexElementTest() throws IOException, InterruptedException {
158+
// TODO DEVSIX-7602 Flex element width is incorrect in case clear property is applied to floats inside it
159+
convertToPdfAndCompare("floatsWithClearInsideFlexElement", sourceFolder, destinationFolder);
160+
}
143161
}

src/test/java/com/itextpdf/html2pdf/css/FloatAndFlexTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ public void floatAtFlexItemNestedTest() throws IOException, InterruptedException
8989

9090
@Test
9191
public void floatsPositioningInsideAndOutsideFlexTest() throws IOException, InterruptedException {
92-
// TODO DEVSIX-5135 floating elements inside flex container are incorrectly positioned
9392
convertToPdfAndCompare("floatsPositioningInsideAndOutsideFlex", SOURCE_FOLDER, DESTINATION_FOLDER);
9493
}
94+
95+
@Test
96+
public void floatFlexContainerTest() throws IOException, InterruptedException {
97+
// TODO DEVSIX-7603 Flex container float property is ignored, so width is incorrect
98+
convertToPdfAndCompare("floatFlexContainer", SOURCE_FOLDER, DESTINATION_FOLDER);
99+
}
95100
}

src/test/java/com/itextpdf/html2pdf/css/FloatTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,11 @@ public void floatLeftWithPaddingInLiTest() throws IOException, InterruptedExcept
758758
runTest("floatLeftWithPaddingInLi", "diff_floatLeftWithPaddingInLi_");
759759
}
760760

761+
@Test
762+
public void floatsPositioningOutsideBfcTest() throws IOException, InterruptedException {
763+
runTest("floatsPositioningOutsideBfc", "diff_floatsPositioningOutsideBfc_");
764+
}
765+
761766
private void runTest(String testName, String diff) throws IOException, InterruptedException {
762767
String htmlName = SOURCE_FOLDER + testName + ".html";
763768
String outFileName = DESTINATION_FOLDER + testName + ".pdf";

src/test/java/com/itextpdf/html2pdf/css/w3c/css_flexbox/FlexWrapHoriz002Test.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ This file is part of the iText (R) project.
2222
*/
2323
package com.itextpdf.html2pdf.css.w3c.css_flexbox;
2424

25-
import com.itextpdf.html2pdf.logs.Html2PdfLogMessageConstant;
2625
import com.itextpdf.html2pdf.css.w3c.W3CCssTest;
27-
import com.itextpdf.test.annotations.LogMessage;
28-
import com.itextpdf.test.annotations.LogMessages;
2926

30-
//TODO DEVSIX-5135 flex container width shall be different according to float properties
27+
// TODO DEVSIX-7603 Flex container float property is ignored, width shall be different according to float properties
3128
public class FlexWrapHoriz002Test extends W3CCssTest {
3229
@Override
3330
protected String getHtmlFileName() {

src/test/java/com/itextpdf/html2pdf/css/w3c/css_flexbox/SizingVert001Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ This file is part of the iText (R) project.
2727
import com.itextpdf.test.annotations.LogMessage;
2828
import com.itextpdf.test.annotations.LogMessages;
2929

30-
//TODO DEVSIX-5096 support flex-direction: column
31-
//TODO DEVSIX-5135 Flex item with nested floating element processed incorrectly
30+
// TODO DEVSIX-5096 support flex-direction: column
31+
// TODO DEVSIX-7603 Flex container float property is ignored
3232
@LogMessages(messages = @LogMessage(messageTemplate = Html2PdfLogMessageConstant.FLEX_PROPERTY_IS_NOT_SUPPORTED_YET, count = 9))
3333
public class SizingVert001Test extends W3CCssTest {
3434
@Override

src/test/java/com/itextpdf/html2pdf/css/w3c/css_flexbox/SizingVert002Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This file is part of the iText (R) project.
2424

2525
import com.itextpdf.html2pdf.css.w3c.W3CCssTest;
2626

27-
//TODO DEVSIX-5135 Flex item with nested floating element processed incorrectly
27+
// TODO DEVSIX-7603 Flex container float property is ignored
2828
public class SizingVert002Test extends W3CCssTest {
2929
@Override
3030
protected String getHtmlFileName() {
Binary file not shown.

0 commit comments

Comments
 (0)