|
| 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.forms.logs.FormsLogMessageConstants; |
| 26 | +import com.itextpdf.html2pdf.ConverterProperties; |
| 27 | +import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest; |
| 28 | +import com.itextpdf.html2pdf.logs.Html2PdfLogMessageConstant; |
| 29 | +import com.itextpdf.io.logs.IoLogMessageConstant; |
| 30 | +import com.itextpdf.test.annotations.LogMessage; |
| 31 | +import com.itextpdf.test.annotations.LogMessages; |
| 32 | + |
| 33 | +import java.io.IOException; |
| 34 | +import org.junit.jupiter.api.BeforeAll; |
| 35 | +import org.junit.jupiter.api.Tag; |
| 36 | +import org.junit.jupiter.api.Test; |
| 37 | + |
| 38 | +@Tag("IntegrationTest") |
| 39 | +public class GridTemplateNestedTest extends ExtendedHtmlConversionITextTest { |
| 40 | + public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/grid" |
| 41 | + + "/GridTemplateNestedTest/"; |
| 42 | + public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/grid" |
| 43 | + + "/GridTemplateNestedTest/"; |
| 44 | + |
| 45 | + //TODO DEVSIX-3340 change cmp files when GRID LAYOUT is supported |
| 46 | + |
| 47 | + @BeforeAll |
| 48 | + public static void beforeClass() { |
| 49 | + createOrClearDestinationFolder(DESTINATION_FOLDER); |
| 50 | + } |
| 51 | + |
| 52 | + |
| 53 | + @Test |
| 54 | + public void templateNestedAreasTest() throws IOException, InterruptedException { |
| 55 | + runTest("grid-nested-areas"); |
| 56 | + } |
| 57 | + |
| 58 | + @Test |
| 59 | + public void templateNestedArticlesTest() throws IOException, InterruptedException { |
| 60 | + runTest("grid-nested-articles"); |
| 61 | + } |
| 62 | + |
| 63 | + @Test |
| 64 | + public void templateNestedFormsTest() throws IOException, InterruptedException { |
| 65 | + runTest("grid-nested-forms"); |
| 66 | + } |
| 67 | + |
| 68 | + @Test |
| 69 | + public void templateNestedGridTest() throws IOException, InterruptedException { |
| 70 | + runTest("grid-nested-grid"); |
| 71 | + } |
| 72 | + |
| 73 | + @Test |
| 74 | + public void templateNestedListsTest() throws IOException, InterruptedException { |
| 75 | + runTest("grid-nested-lists"); |
| 76 | + } |
| 77 | + |
| 78 | + @Test |
| 79 | + public void templateNestedListsOddEvenTest() throws IOException, InterruptedException { |
| 80 | + runTest("grid-nested-lists-odd-even"); |
| 81 | + } |
| 82 | + |
| 83 | + @Test |
| 84 | + public void templateNestedMixedContentTest() throws IOException, InterruptedException { |
| 85 | + runTest("grid-nested-mixed-content"); |
| 86 | + } |
| 87 | + |
| 88 | + @Test |
| 89 | + public void templateNestedParagraphsTest() throws IOException, InterruptedException { |
| 90 | + runTest("grid-nested-paragraphs"); |
| 91 | + } |
| 92 | + |
| 93 | + @Test |
| 94 | + public void templateNestedImagesTest() throws IOException, InterruptedException { |
| 95 | + runTest("grid-nested-images"); |
| 96 | + } |
| 97 | + |
| 98 | + @Test |
| 99 | + public void templateNestedTableTest() throws IOException, InterruptedException { |
| 100 | + runTest("grid-nested-table"); |
| 101 | + } |
| 102 | + |
| 103 | + @LogMessages(messages = @LogMessage( |
| 104 | + messageTemplate = IoLogMessageConstant.TABLE_WIDTH_IS_MORE_THAN_EXPECTED_DUE_TO_MIN_WIDTH, count = 2)) |
| 105 | + @Test |
| 106 | + public void templateNestedTableNestedGridTest() throws IOException, InterruptedException { |
| 107 | + runTest("grid-nested-table-nested-grid"); |
| 108 | + } |
| 109 | + |
| 110 | + @Test |
| 111 | + public void templateNestedTableMixedContentTest() throws IOException, InterruptedException { |
| 112 | + runTest("grid-nested-table-with-mixed-content"); |
| 113 | + } |
| 114 | + |
| 115 | + @Test |
| 116 | + public void templateNested2LevelsWithAreasTest() throws IOException, InterruptedException { |
| 117 | + runTest("grid-nested-2-levels-areas"); |
| 118 | + } |
| 119 | + |
| 120 | + @LogMessages(messages = { |
| 121 | + @LogMessage(messageTemplate = IoLogMessageConstant.CLIP_ELEMENT, count = 5) |
| 122 | + }) |
| 123 | + @Test |
| 124 | + public void templateNested3LevelsFormsTest() throws IOException, InterruptedException { |
| 125 | + runTest("grid-nested-3-forms"); |
| 126 | + } |
| 127 | + |
| 128 | + @Test |
| 129 | + public void templateNested3LevelsTest() throws IOException, InterruptedException { |
| 130 | + runTest("grid-nested-3-levels"); |
| 131 | + } |
| 132 | + |
| 133 | + @Test |
| 134 | + public void templateNested3LevelsMultipleTest() throws IOException, InterruptedException { |
| 135 | + runTest("grid-nested-3-levels-multiple"); |
| 136 | + } |
| 137 | + |
| 138 | + @Test |
| 139 | + public void templateNested3LevelsTablesTest() throws IOException, InterruptedException { |
| 140 | + runTest("grid-nested-3-levels-tables"); |
| 141 | + } |
| 142 | + |
| 143 | + |
| 144 | + private void runTest(String testName) throws IOException, InterruptedException { |
| 145 | + convertToPdfAndCompare(testName, |
| 146 | + SOURCE_FOLDER, DESTINATION_FOLDER, false, |
| 147 | + new ConverterProperties().setBaseUri(SOURCE_FOLDER).setCssGridEnabled(true)); |
| 148 | + } |
| 149 | +} |
0 commit comments