Skip to content

Commit decd255

Browse files
introfogiText-CI
authored andcommitted
Support grid-gap, grid-column-gap and grid-row-gap and log unsupported properties
DEVSIX-8376 Fix per code review, part 1 Autoported commit. Original commit hash: [d16c1ad06]
1 parent 32bafd7 commit decd255

30 files changed

+349
-18
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/apply/util/GridApplierUtilTest.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,18 @@ public virtual void ContainerGapValuesTest() {
439439
NUnit.Framework.Assert.AreEqual(30, element.GetProperty<float?>(Property.ROW_GAP));
440440
}
441441

442+
[NUnit.Framework.Test]
443+
public virtual void ContainerGridGapValuesTest() {
444+
IDictionary<String, String> cssProps = new Dictionary<String, String>();
445+
cssProps.Put(CssConstants.GRID_COLUMN_GAP, "11px");
446+
cssProps.Put(CssConstants.GRID_ROW_GAP, "30%");
447+
IElement element = new Div();
448+
GridApplierUtil.ApplyGridContainerProperties(cssProps, element, new ProcessorContext(new ConverterProperties
449+
()));
450+
NUnit.Framework.Assert.AreEqual(8.25f, element.GetProperty<float?>(Property.COLUMN_GAP));
451+
NUnit.Framework.Assert.AreEqual(30, element.GetProperty<float?>(Property.ROW_GAP));
452+
}
453+
442454
[NUnit.Framework.Test]
443455
public virtual void ColumnFlowTest() {
444456
IDictionary<String, String> cssProps = new Dictionary<String, String>();

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/grid/GridGapTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,31 @@ public virtual void SmallValuesGapTest() {
173173
RunTest("small_values_gap");
174174
}
175175

176+
[NUnit.Framework.Test]
177+
public virtual void DifferentRowsColsGapTest() {
178+
RunTest("different_rows_cols_gap");
179+
}
180+
181+
[NUnit.Framework.Test]
182+
public virtual void GridGapTest1() {
183+
RunTest("gridGapTest1");
184+
}
185+
186+
[NUnit.Framework.Test]
187+
public virtual void GridGapTest2() {
188+
RunTest("gridGapTest2");
189+
}
190+
191+
[NUnit.Framework.Test]
192+
public virtual void GridColumnGapTest() {
193+
RunTest("gridColumnGapTest");
194+
}
195+
196+
[NUnit.Framework.Test]
197+
public virtual void GridRowGapTest() {
198+
RunTest("gridRowGapTest");
199+
}
200+
176201
private void RunTest(String testName) {
177202
ConvertToPdfAndCompare(testName, SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().SetBaseUri
178203
(SOURCE_FOLDER));

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/grid/GridTemplatesTest.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,8 @@ public virtual void AutoFitRepeatWithFlexMinMaxTest() {
547547
RunTest("autoFitRepeatWithFlexMinMaxTest");
548548
}
549549

550+
[LogMessage(Html2PdfLogMessageConstant.GRID_TEMPLATE_WAS_NOT_RECOGNISED, LogLevel = LogLevelConstants.WARN
551+
)]
550552
[NUnit.Framework.Test]
551553
public virtual void RepeatInsideMinMaxTest() {
552554
RunTest("repeatInsideMinMaxTest");
@@ -626,13 +628,35 @@ public virtual void MaxHeightFlexRowsTest2() {
626628
RunTest("maxHeightFlexRowsTest2");
627629
}
628630

629-
[NUnit.Framework.Test]
630631
[LogMessage(Html2PdfLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, LogLevel = LogLevelConstants.WARN
631632
)]
633+
[NUnit.Framework.Test]
632634
public virtual void DivNestingTest() {
633635
RunTest("divNestingTest");
634636
}
635637

638+
[LogMessage(Html2PdfLogMessageConstant.SUBGRID_VALUE_IS_NOT_SUPPORTED, LogLevel = LogLevelConstants.WARN)]
639+
[LogMessage(Html2PdfLogMessageConstant.GRID_TEMPLATE_WAS_NOT_RECOGNISED, LogLevel = LogLevelConstants.WARN
640+
)]
641+
[NUnit.Framework.Test]
642+
public virtual void SubgridTest() {
643+
RunTest("subgridTest");
644+
}
645+
646+
[LogMessage(Html2PdfLogMessageConstant.GRID_TEMPLATE_WAS_NOT_RECOGNISED, LogLevel = LogLevelConstants.WARN
647+
)]
648+
[NUnit.Framework.Test]
649+
public virtual void InvalidTemplateColumns() {
650+
RunTest("invalidTemplateColumns");
651+
}
652+
653+
[LogMessage(Html2PdfLogMessageConstant.GRID_TEMPLATE_WAS_NOT_RECOGNISED, LogLevel = LogLevelConstants.WARN
654+
)]
655+
[NUnit.Framework.Test]
656+
public virtual void InvalidTemplateRows() {
657+
RunTest("invalidTemplateRows");
658+
}
659+
636660
private void RunTest(String testName) {
637661
ConvertToPdfAndCompare(testName, SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().SetBaseUri
638662
(SOURCE_FOLDER));

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/w3c/css_flexbox/FlexboxColumnRowGap001Test.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ You should have received a copy of the GNU Affero General Public License
2626
using iText.Test.Attributes;
2727

2828
namespace iText.Html2pdf.Css.W3c.Css_flexbox {
29-
//TODO DEVSIX-7554 change after column-gap is supported
3029
//TODO DEVSIX-7616 change after row-gap is supported
3130
//TODO DEVSIX-5164 change after align-content: space-around is supported
3231
//TODO DEVSIX-5163 change after more complex justify-content values are supported

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/w3c/css_flexbox/FlexboxColumnRowGap002Test.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ You should have received a copy of the GNU Affero General Public License
2626
using iText.Test.Attributes;
2727

2828
namespace iText.Html2pdf.Css.W3c.Css_flexbox {
29-
//TODO DEVSIX-7554 change after column-gap is supported
3029
//TODO DEVSIX-7616 change after row-gap is supported
3130
//TODO DEVSIX-5164 change after align-content: flex-start is supported
3231
[LogMessage(Html2PdfLogMessageConstant.FLEX_PROPERTY_IS_NOT_SUPPORTED_YET, Count = 6)]

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/w3c/css_flexbox/FlexboxColumnRowGap003Test.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ You should have received a copy of the GNU Affero General Public License
2626
using iText.Test.Attributes;
2727

2828
namespace iText.Html2pdf.Css.W3c.Css_flexbox {
29-
//TODO DEVSIX-7554 change after column-gap is supported
3029
//TODO DEVSIX-7616 change after row-gap is supported
3130
//TODO DEVSIX-5164 change after align-content: space-around is supported
3231
//TODO DEVSIX-5163 change after more complex justify-content values are supported

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/w3c/css_flexbox/FlexboxColumnRowGap004Test.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ You should have received a copy of the GNU Affero General Public License
2626
using iText.Test.Attributes;
2727

2828
namespace iText.Html2pdf.Css.W3c.Css_flexbox {
29-
//TODO DEVSIX-7554 change after column-gap is supported
3029
//TODO DEVSIX-7616 change after row-gap is supported
3130
//TODO DEVSIX-5164 change after align-content: start is supported
3231
[LogMessage(Html2PdfLogMessageConstant.FLEX_PROPERTY_IS_NOT_SUPPORTED_YET, Count = 12)]

0 commit comments

Comments
 (0)