|
| 1 | +/* |
| 2 | + This file is part of the iText (R) project. |
| 3 | + Copyright (c) 1998-2024 Apryse Group NV |
| 4 | + Authors: Apryse Software. |
| 5 | +
|
| 6 | + This program is offered under a commercial and under the AGPL license. |
| 7 | + For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. |
| 8 | +
|
| 9 | + AGPL licensing: |
| 10 | + This program is free software: you can redistribute it and/or modify |
| 11 | + it under the terms of the GNU Affero General Public License as published by |
| 12 | + the Free Software Foundation, either version 3 of the License, or |
| 13 | + (at your option) any later version. |
| 14 | +
|
| 15 | + This program is distributed in the hope that it will be useful, |
| 16 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + GNU Affero General Public License for more details. |
| 19 | +
|
| 20 | + You should have received a copy of the GNU Affero General Public License |
| 21 | + along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 22 | + */ |
| 23 | +package com.itextpdf.html2pdf.css.grid; |
| 24 | + |
| 25 | +import com.itextpdf.html2pdf.ConverterProperties; |
| 26 | +import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest; |
| 27 | +import com.itextpdf.layout.exceptions.LayoutExceptionMessageConstant; |
| 28 | + |
| 29 | +import java.io.IOException; |
| 30 | +import org.junit.jupiter.api.Assertions; |
| 31 | +import org.junit.jupiter.api.BeforeAll; |
| 32 | +import org.junit.jupiter.api.Tag; |
| 33 | +import org.junit.jupiter.api.Test; |
| 34 | + |
| 35 | +@Tag("IntegrationTest") |
| 36 | +public class GridItemPlacementTest extends ExtendedHtmlConversionITextTest { |
| 37 | + public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/grid/GridItemPlacementTest/"; |
| 38 | + public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/grid/GridItemPlacementTest/"; |
| 39 | + |
| 40 | + @BeforeAll |
| 41 | + public static void beforeClass() { |
| 42 | + createOrClearDestinationFolder(DESTINATION_FOLDER); |
| 43 | + } |
| 44 | + |
| 45 | + @Test |
| 46 | + public void colStartEnd1Test() throws IOException, InterruptedException { |
| 47 | + runTest("colStartEnd1"); |
| 48 | + } |
| 49 | + |
| 50 | + @Test |
| 51 | + public void colStartEnd2Test() throws IOException, InterruptedException { |
| 52 | + runTest("colStartEnd2"); |
| 53 | + } |
| 54 | + |
| 55 | + @Test |
| 56 | + public void colStartEnd3Test() throws IOException, InterruptedException { |
| 57 | + runTest("colStartEnd3"); |
| 58 | + } |
| 59 | + |
| 60 | + @Test |
| 61 | + public void colStartEnd4Test() throws IOException, InterruptedException { |
| 62 | + runTest("colStartEnd4"); |
| 63 | + } |
| 64 | + |
| 65 | + @Test |
| 66 | + public void colStartEnd5Test() throws IOException, InterruptedException { |
| 67 | + runTest("colStartEnd5"); |
| 68 | + } |
| 69 | + |
| 70 | + @Test |
| 71 | + public void fewCellsPlacement1Test() throws IOException, InterruptedException { |
| 72 | + runTest("fewCellsPlacement1"); |
| 73 | + } |
| 74 | + |
| 75 | + @Test |
| 76 | + public void fewCellsPlacement2Test() throws IOException, InterruptedException { |
| 77 | + runTest("fewCellsPlacement2"); |
| 78 | + } |
| 79 | + |
| 80 | + @Test |
| 81 | + public void fewCellsPlacement3Test() throws IOException, InterruptedException { |
| 82 | + runTest("fewCellsPlacement3"); |
| 83 | + } |
| 84 | + |
| 85 | + @Test |
| 86 | + public void fewCellsPlacement4Test() throws IOException, InterruptedException { |
| 87 | + runTest("fewCellsPlacement4"); |
| 88 | + } |
| 89 | + |
| 90 | + @Test |
| 91 | + public void fewCellsPlacement5Test() { |
| 92 | + Exception e = Assertions.assertThrows(IllegalArgumentException.class, () -> runTest("fewCellsPlacement5")); |
| 93 | + Assertions.assertEquals(LayoutExceptionMessageConstant.INVALID_CELL_INDEXES, e.getMessage()); |
| 94 | + } |
| 95 | + |
| 96 | + @Test |
| 97 | + public void fewCellsPlacement6Test() throws IOException, InterruptedException { |
| 98 | + runTest("fewCellsPlacement6"); |
| 99 | + } |
| 100 | + |
| 101 | + @Test |
| 102 | + public void rowStartEnd1Test() throws IOException, InterruptedException { |
| 103 | + runTest("rowStartEnd1"); |
| 104 | + } |
| 105 | + |
| 106 | + @Test |
| 107 | + public void rowStartEnd2Test() throws IOException, InterruptedException { |
| 108 | + runTest("rowStartEnd2"); |
| 109 | + } |
| 110 | + |
| 111 | + @Test |
| 112 | + public void rowStartEnd3Test() throws IOException, InterruptedException { |
| 113 | + runTest("rowStartEnd3"); |
| 114 | + } |
| 115 | + |
| 116 | + @Test |
| 117 | + // TODO |
| 118 | + public void rowStartEnd4Test() throws IOException, InterruptedException { |
| 119 | + runTest("rowStartEnd4"); |
| 120 | + } |
| 121 | + |
| 122 | + @Test |
| 123 | + public void twoColumnSpans1Test() throws IOException, InterruptedException { |
| 124 | + runTest("twoColumnSpans1"); |
| 125 | + } |
| 126 | + |
| 127 | + @Test |
| 128 | + public void twoColumnSpans2Test() throws IOException, InterruptedException { |
| 129 | + runTest("twoColumnSpans2"); |
| 130 | + } |
| 131 | + |
| 132 | + @Test |
| 133 | + public void twoColumnSpans3Test() throws IOException, InterruptedException { |
| 134 | + runTest("twoColumnSpans3"); |
| 135 | + } |
| 136 | + |
| 137 | + @Test |
| 138 | + public void twoRowSpans1Test() throws IOException, InterruptedException { |
| 139 | + runTest("twoRowSpans1"); |
| 140 | + } |
| 141 | + |
| 142 | + @Test |
| 143 | + public void twoRowSpans2Test() throws IOException, InterruptedException { |
| 144 | + runTest("twoRowSpans2"); |
| 145 | + } |
| 146 | + |
| 147 | + @Test |
| 148 | + public void twoRowSpans3Test() throws IOException, InterruptedException { |
| 149 | + runTest("twoRowSpans3"); |
| 150 | + } |
| 151 | + |
| 152 | + @Test |
| 153 | + public void invalid1Test() throws IOException, InterruptedException { |
| 154 | + runTest("invalid1"); |
| 155 | + } |
| 156 | + |
| 157 | + @Test |
| 158 | + public void invalid2Test() throws IOException, InterruptedException { |
| 159 | + runTest("invalid2"); |
| 160 | + } |
| 161 | + |
| 162 | + @Test |
| 163 | + public void invalid3Test() throws IOException, InterruptedException { |
| 164 | + runTest("invalid3"); |
| 165 | + } |
| 166 | + |
| 167 | + @Test |
| 168 | + public void invalid4Test() throws IOException, InterruptedException { |
| 169 | + runTest("invalid4"); |
| 170 | + } |
| 171 | + |
| 172 | + @Test |
| 173 | + public void invalid5Test() throws IOException, InterruptedException { |
| 174 | + runTest("invalid5"); |
| 175 | + } |
| 176 | + |
| 177 | + @Test |
| 178 | + public void noTemplate1Test() throws IOException, InterruptedException { |
| 179 | + runTest("noTemplate1"); |
| 180 | + } |
| 181 | + |
| 182 | + @Test |
| 183 | + public void noTemplate2Test() throws IOException, InterruptedException { |
| 184 | + runTest("noTemplate2"); |
| 185 | + } |
| 186 | + |
| 187 | + private void runTest(String testName) throws IOException, InterruptedException { |
| 188 | + convertToPdfAndCompare(testName, SOURCE_FOLDER, DESTINATION_FOLDER, false, |
| 189 | + new ConverterProperties().setBaseUri(SOURCE_FOLDER).setCssGridEnabled(true)); |
| 190 | + } |
| 191 | +} |
0 commit comments