Skip to content

Commit 96a31cb

Browse files
introfogiText-CI
authored andcommitted
Add test for page counter + keep together case
DEVSIX-7785 Autoported commit. Original commit hash: [c807c7f3a]
1 parent cddeb74 commit 96a31cb

File tree

4 files changed

+475
-11
lines changed

4 files changed

+475
-11
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/CounterTest.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,55 +22,65 @@ You should have received a copy of the GNU Affero General Public License
2222
*/
2323
using System;
2424
using iText.Html2pdf;
25+
using iText.Layout.Logs;
26+
using iText.Test;
27+
using iText.Test.Attributes;
2528

2629
namespace iText.Html2pdf.Css {
2730
[NUnit.Framework.Category("IntegrationTest")]
2831
public class CounterTest : ExtendedHtmlConversionITextTest {
29-
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
32+
public static readonly String SOURCE_FOLDER = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3033
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/CounterTest/";
3134

32-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
35+
public static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory
3336
+ "/test/itext/html2pdf/css/CounterTest/";
3437

3538
[NUnit.Framework.OneTimeSetUp]
3639
public static void BeforeClass() {
37-
CreateOrClearDestinationFolder(destinationFolder);
40+
CreateOrClearDestinationFolder(DESTINATION_FOLDER);
3841
}
3942

4043
[NUnit.Framework.Test]
4144
public virtual void Counter01Test() {
42-
ConvertToPdfAndCompare("counter01", sourceFolder, destinationFolder);
45+
ConvertToPdfAndCompare("counter01", SOURCE_FOLDER, DESTINATION_FOLDER);
4346
}
4447

4548
[NUnit.Framework.Test]
4649
public virtual void PageCounter01Test() {
47-
ConvertToPdfAndCompare("page_counter01", sourceFolder, destinationFolder);
50+
ConvertToPdfAndCompare("page_counter01", SOURCE_FOLDER, DESTINATION_FOLDER);
4851
}
4952

5053
[NUnit.Framework.Test]
5154
public virtual void PageCounter02Test() {
52-
ConvertToPdfAndCompare("page_counter02", sourceFolder, destinationFolder);
55+
ConvertToPdfAndCompare("page_counter02", SOURCE_FOLDER, DESTINATION_FOLDER);
5356
}
5457

5558
[NUnit.Framework.Test]
5659
public virtual void PageCounter03Test() {
57-
ConvertToPdfAndCompare("page_counter03", sourceFolder, destinationFolder);
60+
ConvertToPdfAndCompare("page_counter03", SOURCE_FOLDER, DESTINATION_FOLDER);
5861
}
5962

6063
[NUnit.Framework.Test]
6164
public virtual void PageCounter04Test() {
62-
ConvertToPdfAndCompare("page_counter04", sourceFolder, destinationFolder);
65+
ConvertToPdfAndCompare("page_counter04", SOURCE_FOLDER, DESTINATION_FOLDER);
6366
}
6467

6568
[NUnit.Framework.Test]
6669
public virtual void PageCounterSpacesInDeclarationTest() {
67-
ConvertToPdfAndCompare("page_counter_spaces_in_declaration", sourceFolder, destinationFolder);
70+
ConvertToPdfAndCompare("page_counter_spaces_in_declaration", SOURCE_FOLDER, DESTINATION_FOLDER);
71+
}
72+
73+
[NUnit.Framework.Test]
74+
[LogMessage(LayoutLogMessageConstant.ELEMENT_DOES_NOT_FIT_AREA, Count = 2, LogLevel = LogLevelConstants.WARN
75+
)]
76+
public virtual void PageCounterAndKeepTogetherTest() {
77+
ConvertToPdfAndCompare("pageCounterAndKeepTogetherTest", SOURCE_FOLDER, DESTINATION_FOLDER);
6878
}
6979

7080
[NUnit.Framework.Test]
7181
public virtual void PageCounterWithTrimmedLastPageTest() {
7282
// TODO fix cmp after DEVSIX-5509 is done; currently total page count is incorrect
73-
ConvertToPdfAndCompare("page_counter_with_trimmed_last_page", sourceFolder, destinationFolder);
83+
ConvertToPdfAndCompare("page_counter_with_trimmed_last_page", SOURCE_FOLDER, DESTINATION_FOLDER);
7484
}
7585
}
7686
}

0 commit comments

Comments
 (0)