@@ -31,16 +31,8 @@ This file is part of the iText (R) project.
31
31
import com .itextpdf .layout .Document ;
32
32
import com .itextpdf .layout .Style ;
33
33
import com .itextpdf .layout .borders .SolidBorder ;
34
- import com .itextpdf .layout .element .AreaBreak ;
35
- import com .itextpdf .layout .element .Div ;
36
- import com .itextpdf .layout .element .FlexContainer ;
37
- import com .itextpdf .layout .element .IElement ;
38
- import com .itextpdf .layout .element .Image ;
39
- import com .itextpdf .layout .element .List ;
40
- import com .itextpdf .layout .element .Paragraph ;
41
- import com .itextpdf .layout .element .Table ;
42
- import com .itextpdf .layout .property .Background ;
43
34
import com .itextpdf .layout .property .AlignmentPropertyValue ;
35
+ import com .itextpdf .layout .property .Background ;
44
36
import com .itextpdf .layout .property .JustifyContent ;
45
37
import com .itextpdf .layout .property .ListNumberingType ;
46
38
import com .itextpdf .layout .property .OverflowPropertyValue ;
@@ -50,13 +42,15 @@ This file is part of the iText (R) project.
50
42
import com .itextpdf .test .annotations .LogMessage ;
51
43
import com .itextpdf .test .annotations .LogMessages ;
52
44
import com .itextpdf .test .annotations .type .IntegrationTest ;
45
+
46
+ import java .io .IOException ;
47
+ import java .util .Arrays ;
53
48
import org .junit .Assert ;
54
49
import org .junit .BeforeClass ;
55
50
import org .junit .Test ;
56
51
import org .junit .experimental .categories .Category ;
57
52
import org .junit .runner .RunWith ;
58
53
import org .junit .runners .Parameterized ;
59
-
60
54
import java .io .IOException ;
61
55
import java .util .Arrays ;
62
56
@@ -870,6 +864,69 @@ public void respectFlexContainersWidthTest() throws IOException, InterruptedExce
870
864
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
871
865
}
872
866
867
+ @ Test
868
+ public void flexItemsMinHeightShouldBeOverriddenTest () throws IOException , InterruptedException {
869
+ String outFileName = destinationFolder + "flexItemsMinHeightShouldBeOverriddenTest" + testNumber + ".pdf" ;
870
+ String cmpFileName = sourceFolder + "cmp_flexItemsMinHeightShouldBeOverriddenTest" + testNumber + ".pdf" ;
871
+ PdfDocument pdfDocument = new PdfDocument (new PdfWriter (outFileName ));
872
+
873
+ Document document = new Document (pdfDocument );
874
+
875
+ Div flexContainer = createFlexContainer ();
876
+
877
+ flexContainer .add (new Div ().setWidth (100 ).setBackgroundColor (ColorConstants .BLUE ).setHeight (100 ));
878
+ flexContainer .add (new Div ().setWidth (100 ).setBackgroundColor (ColorConstants .YELLOW ).setMinHeight (20 ));
879
+ document .add (flexContainer );
880
+
881
+ document .close ();
882
+
883
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
884
+ }
885
+
886
+ @ Test
887
+ public void linesMinHeightShouldBeRespectedTest () throws IOException , InterruptedException {
888
+ String outFileName = destinationFolder + "linesMinHeightShouldBeRespectedTest" + testNumber + ".pdf" ;
889
+ String cmpFileName = sourceFolder + "cmp_linesMinHeightShouldBeRespectedTest" + testNumber + ".pdf" ;
890
+ PdfDocument pdfDocument = new PdfDocument (new PdfWriter (outFileName ));
891
+
892
+ Document document = new Document (pdfDocument );
893
+
894
+ Div flexContainer = createFlexContainer ();
895
+ flexContainer .setMinHeight (100 );
896
+
897
+ Div child = new Div ().setWidth (100 ).setBackgroundColor (ColorConstants .BLUE );
898
+ child .add (new Paragraph ().setWidth (100 ).setBackgroundColor (ColorConstants .YELLOW ));
899
+ flexContainer .add (child );
900
+
901
+ document .add (flexContainer );
902
+
903
+ document .close ();
904
+
905
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
906
+ }
907
+
908
+ @ Test
909
+ public void linesMaxHeightShouldBeRespectedTest () throws IOException , InterruptedException {
910
+ String outFileName = destinationFolder + "linesMaxHeightShouldBeRespectedTest" + testNumber + ".pdf" ;
911
+ String cmpFileName = sourceFolder + "cmp_linesMaxHeightShouldBeRespectedTest" + testNumber + ".pdf" ;
912
+ PdfDocument pdfDocument = new PdfDocument (new PdfWriter (outFileName ));
913
+
914
+ Document document = new Document (pdfDocument );
915
+
916
+ Div flexContainer = createFlexContainer ();
917
+ flexContainer .setMaxHeight (100 );
918
+
919
+ Div child = new Div ().setWidth (100 ).setBackgroundColor (ColorConstants .BLUE ).setHeight (150 );
920
+ child .add (new Paragraph ().setWidth (100 ).setBackgroundColor (ColorConstants .YELLOW ));
921
+ flexContainer .add (child );
922
+
923
+ document .add (flexContainer );
924
+
925
+ document .close ();
926
+
927
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , "diff" ));
928
+ }
929
+
873
930
private Div getFlexContainer (OverflowPropertyValue overflowX , Style style ) {
874
931
FlexContainer flexContainer = createFlexContainer ();
875
932
flexContainer
0 commit comments