|
| 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 | +using System; |
| 24 | +using iText.Html2pdf; |
| 25 | +using iText.Test.Attributes; |
| 26 | + |
| 27 | +namespace iText.Html2pdf.Css.Grid { |
| 28 | + [NUnit.Framework.Category("IntegrationTest")] |
| 29 | + public class GridTemplateNestedTest : ExtendedHtmlConversionITextTest { |
| 30 | + public static readonly String SOURCE_FOLDER = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext |
| 31 | + .CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/grid" + "/GridTemplateNestedTest/"; |
| 32 | + |
| 33 | + public static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory |
| 34 | + + "/test/itext/html2pdf/css/grid" + "/GridTemplateNestedTest/"; |
| 35 | + |
| 36 | + //TODO DEVSIX-3340 change cmp files when GRID LAYOUT is supported |
| 37 | + [NUnit.Framework.OneTimeSetUp] |
| 38 | + public static void BeforeClass() { |
| 39 | + CreateOrClearDestinationFolder(DESTINATION_FOLDER); |
| 40 | + } |
| 41 | + |
| 42 | + [NUnit.Framework.Test] |
| 43 | + public virtual void TemplateNestedAreasTest() { |
| 44 | + RunTest("grid-nested-areas"); |
| 45 | + } |
| 46 | + |
| 47 | + [NUnit.Framework.Test] |
| 48 | + public virtual void TemplateNestedArticlesTest() { |
| 49 | + RunTest("grid-nested-articles"); |
| 50 | + } |
| 51 | + |
| 52 | + [NUnit.Framework.Test] |
| 53 | + public virtual void TemplateNestedFormsTest() { |
| 54 | + RunTest("grid-nested-forms"); |
| 55 | + } |
| 56 | + |
| 57 | + [NUnit.Framework.Test] |
| 58 | + public virtual void TemplateNestedGridTest() { |
| 59 | + RunTest("grid-nested-grid"); |
| 60 | + } |
| 61 | + |
| 62 | + [NUnit.Framework.Test] |
| 63 | + public virtual void TemplateNestedListsTest() { |
| 64 | + RunTest("grid-nested-lists"); |
| 65 | + } |
| 66 | + |
| 67 | + [NUnit.Framework.Test] |
| 68 | + public virtual void TemplateNestedListsOddEvenTest() { |
| 69 | + RunTest("grid-nested-lists-odd-even"); |
| 70 | + } |
| 71 | + |
| 72 | + [NUnit.Framework.Test] |
| 73 | + public virtual void TemplateNestedMixedContentTest() { |
| 74 | + RunTest("grid-nested-mixed-content"); |
| 75 | + } |
| 76 | + |
| 77 | + [NUnit.Framework.Test] |
| 78 | + public virtual void TemplateNestedParagraphsTest() { |
| 79 | + RunTest("grid-nested-paragraphs"); |
| 80 | + } |
| 81 | + |
| 82 | + [NUnit.Framework.Test] |
| 83 | + public virtual void TemplateNestedImagesTest() { |
| 84 | + RunTest("grid-nested-images"); |
| 85 | + } |
| 86 | + |
| 87 | + [NUnit.Framework.Test] |
| 88 | + public virtual void TemplateNestedTableTest() { |
| 89 | + RunTest("grid-nested-table"); |
| 90 | + } |
| 91 | + |
| 92 | + [LogMessage(iText.IO.Logs.IoLogMessageConstant.TABLE_WIDTH_IS_MORE_THAN_EXPECTED_DUE_TO_MIN_WIDTH, Count = |
| 93 | + 2)] |
| 94 | + [NUnit.Framework.Test] |
| 95 | + public virtual void TemplateNestedTableNestedGridTest() { |
| 96 | + RunTest("grid-nested-table-nested-grid"); |
| 97 | + } |
| 98 | + |
| 99 | + [NUnit.Framework.Test] |
| 100 | + public virtual void TemplateNestedTableMixedContentTest() { |
| 101 | + RunTest("grid-nested-table-with-mixed-content"); |
| 102 | + } |
| 103 | + |
| 104 | + [NUnit.Framework.Test] |
| 105 | + public virtual void TemplateNested2LevelsWithAreasTest() { |
| 106 | + RunTest("grid-nested-2-levels-areas"); |
| 107 | + } |
| 108 | + |
| 109 | + [LogMessage(iText.IO.Logs.IoLogMessageConstant.CLIP_ELEMENT, Count = 5)] |
| 110 | + [NUnit.Framework.Test] |
| 111 | + public virtual void TemplateNested3LevelsFormsTest() { |
| 112 | + RunTest("grid-nested-3-forms"); |
| 113 | + } |
| 114 | + |
| 115 | + [NUnit.Framework.Test] |
| 116 | + public virtual void TemplateNested3LevelsTest() { |
| 117 | + RunTest("grid-nested-3-levels"); |
| 118 | + } |
| 119 | + |
| 120 | + [NUnit.Framework.Test] |
| 121 | + public virtual void TemplateNested3LevelsMultipleTest() { |
| 122 | + RunTest("grid-nested-3-levels-multiple"); |
| 123 | + } |
| 124 | + |
| 125 | + [NUnit.Framework.Test] |
| 126 | + public virtual void TemplateNested3LevelsTablesTest() { |
| 127 | + RunTest("grid-nested-3-levels-tables"); |
| 128 | + } |
| 129 | + |
| 130 | + private void RunTest(String testName) { |
| 131 | + ConvertToPdfAndCompare(testName, SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().SetBaseUri |
| 132 | + (SOURCE_FOLDER).SetCssGridEnabled(true)); |
| 133 | + } |
| 134 | + } |
| 135 | +} |
0 commit comments