Skip to content

Commit 131fe4b

Browse files
rnadvodnypavel-alay
authored andcommitted
Fix handling of max-dimensions and auto dimensions and calculating of max-height attribute. Add tests for max dimensions
Update cmp-s for edge-case tests Use util class for parse attributes value. Update tests Add two more edge-case tests Add some tests for min-dimensions DEVSIX-2388 Autoported commit. Original commit hash: [71ffae64]
1 parent f0ace52 commit 131fe4b

File tree

66 files changed

+1999
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1999
-112
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/media/page/PageMarginBoxIntegrationTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using iText.Html2pdf;
3+
using iText.Test.Attributes;
34

45
namespace iText.Html2pdf.Css.Media.Page {
56
public class PageMarginBoxIntegrationTests : ExtendedHtmlConversionITextTest {
@@ -330,8 +331,23 @@ public virtual void SmallFixedTopLeftRightTest() {
330331
/// <exception cref="System.IO.IOException"/>
331332
/// <exception cref="System.Exception"/>
332333
[NUnit.Framework.Test]
334+
[LogMessage(iText.IO.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES, Count = 4)]
333335
public virtual void LargeFixedCenterRegularSidesLeftRightTest() {
334336
ConvertToPdfAndCompare("largeFixedCenterRegularSidesLeftRightTest", sourceFolder, destinationFolder);
335337
}
338+
339+
/// <exception cref="System.IO.IOException"/>
340+
/// <exception cref="System.Exception"/>
341+
[NUnit.Framework.Test]
342+
public virtual void LargeFixedAllLeftRightTest() {
343+
ConvertToPdfAndCompare("largeFixedAllLeftRightTest", sourceFolder, destinationFolder);
344+
}
345+
346+
/// <exception cref="System.IO.IOException"/>
347+
/// <exception cref="System.Exception"/>
348+
[NUnit.Framework.Test]
349+
public virtual void LargeFixedAllTopBottomTest() {
350+
ConvertToPdfAndCompare("largeFixedAllTopBottomTest", sourceFolder, destinationFolder);
351+
}
336352
}
337353
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
using System;
2+
using iText.Html2pdf;
3+
4+
namespace iText.Html2pdf.Css.Media.Page.Max_dimension {
5+
public class PageMarginBoxMaxDimensionTests : ExtendedHtmlConversionITextTest {
6+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
7+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/max_dimension/";
8+
9+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
10+
+ "/test/itext/html2pdf/css/media/page/max_dimension/";
11+
12+
[NUnit.Framework.OneTimeSetUp]
13+
public static void BeforeClass() {
14+
CreateOrClearDestinationFolder(destinationFolder);
15+
}
16+
17+
// Top margin box tests
18+
/// <exception cref="System.IO.IOException"/>
19+
/// <exception cref="System.Exception"/>
20+
[NUnit.Framework.Test]
21+
public virtual void TopOnlyMaxLeftTest() {
22+
ConvertToPdfAndCompare("topOnlyMaxLeft", sourceFolder, destinationFolder);
23+
}
24+
25+
/// <exception cref="System.IO.IOException"/>
26+
/// <exception cref="System.Exception"/>
27+
[NUnit.Framework.Test]
28+
public virtual void TopOnlyMaxRightTest() {
29+
ConvertToPdfAndCompare("topOnlyMaxRight", sourceFolder, destinationFolder);
30+
}
31+
32+
/// <exception cref="System.IO.IOException"/>
33+
/// <exception cref="System.Exception"/>
34+
[NUnit.Framework.Test]
35+
public virtual void TopOnlyMaxCenterTest() {
36+
ConvertToPdfAndCompare("topOnlyMaxCenter", sourceFolder, destinationFolder);
37+
}
38+
39+
/// <exception cref="System.IO.IOException"/>
40+
/// <exception cref="System.Exception"/>
41+
[NUnit.Framework.Test]
42+
public virtual void TopMaxCenterAndRightTest() {
43+
ConvertToPdfAndCompare("topMaxCenterAndRight", sourceFolder, destinationFolder);
44+
}
45+
46+
/// <exception cref="System.IO.IOException"/>
47+
/// <exception cref="System.Exception"/>
48+
[NUnit.Framework.Test]
49+
public virtual void TopMaxLeftAndCenterTest() {
50+
ConvertToPdfAndCompare("topMaxLeftAndCenter", sourceFolder, destinationFolder);
51+
}
52+
53+
/// <exception cref="System.IO.IOException"/>
54+
/// <exception cref="System.Exception"/>
55+
[NUnit.Framework.Test]
56+
public virtual void TopMaxLeftAndRight() {
57+
ConvertToPdfAndCompare("topMaxLeftAndRight", sourceFolder, destinationFolder);
58+
}
59+
60+
/// <exception cref="System.IO.IOException"/>
61+
/// <exception cref="System.Exception"/>
62+
[NUnit.Framework.Test]
63+
public virtual void TopMaxLeftAndMaxCenterAndMaxRight() {
64+
ConvertToPdfAndCompare("topMaxLeftAndMaxCenterAndMaxRight", sourceFolder, destinationFolder);
65+
}
66+
67+
//Left margin box tests
68+
/// <exception cref="System.IO.IOException"/>
69+
/// <exception cref="System.Exception"/>
70+
[NUnit.Framework.Test]
71+
public virtual void LeftOnlyMaxTopTest() {
72+
ConvertToPdfAndCompare("leftOnlyMaxTop", sourceFolder, destinationFolder);
73+
}
74+
75+
/// <exception cref="System.IO.IOException"/>
76+
/// <exception cref="System.Exception"/>
77+
[NUnit.Framework.Test]
78+
public virtual void LeftOnlyMaxCenterTest() {
79+
ConvertToPdfAndCompare("leftOnlyMaxCenter", sourceFolder, destinationFolder);
80+
}
81+
82+
/// <exception cref="System.IO.IOException"/>
83+
/// <exception cref="System.Exception"/>
84+
[NUnit.Framework.Test]
85+
public virtual void LeftOnlyMaxBottomTest() {
86+
ConvertToPdfAndCompare("leftOnlyMaxBottom", sourceFolder, destinationFolder);
87+
}
88+
89+
/// <exception cref="System.IO.IOException"/>
90+
/// <exception cref="System.Exception"/>
91+
[NUnit.Framework.Test]
92+
public virtual void LeftTopAndMaxCenterTest() {
93+
ConvertToPdfAndCompare("leftTopAndMaxCenter", sourceFolder, destinationFolder);
94+
}
95+
96+
/// <exception cref="System.IO.IOException"/>
97+
/// <exception cref="System.Exception"/>
98+
[NUnit.Framework.Test]
99+
public virtual void LeftTopAndMaxBottomTest() {
100+
ConvertToPdfAndCompare("leftTopAndMaxBottom", sourceFolder, destinationFolder);
101+
}
102+
103+
/// <exception cref="System.IO.IOException"/>
104+
/// <exception cref="System.Exception"/>
105+
[NUnit.Framework.Test]
106+
public virtual void LeftMaxCenterAndBottomTest() {
107+
ConvertToPdfAndCompare("leftMaxCenterAndBottom", sourceFolder, destinationFolder);
108+
}
109+
110+
/// <exception cref="System.IO.IOException"/>
111+
/// <exception cref="System.Exception"/>
112+
[NUnit.Framework.Test]
113+
public virtual void LeftMaxTopAndMaxCenterAndBottomTest() {
114+
ConvertToPdfAndCompare("leftMaxTopAndMaxCenterAndBottom", sourceFolder, destinationFolder);
115+
}
116+
}
117+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using System;
2+
using iText.Html2pdf;
3+
4+
namespace iText.Html2pdf.Css.Media.Page.Min_dimension {
5+
public class PageMarginBoxMinDimensionTests : ExtendedHtmlConversionITextTest {
6+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
7+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/min_dimension/";
8+
9+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
10+
+ "/test/itext/html2pdf/css/media/page/min_dimension/";
11+
12+
[NUnit.Framework.OneTimeSetUp]
13+
public static void BeforeClass() {
14+
CreateOrClearDestinationFolder(destinationFolder);
15+
}
16+
17+
// Top margin box tests
18+
/// <exception cref="System.IO.IOException"/>
19+
/// <exception cref="System.Exception"/>
20+
[NUnit.Framework.Test]
21+
public virtual void TopOnlyMinLeftTest() {
22+
ConvertToPdfAndCompare("topOnlyMinLeft", sourceFolder, destinationFolder);
23+
}
24+
25+
/// <exception cref="System.IO.IOException"/>
26+
/// <exception cref="System.Exception"/>
27+
[NUnit.Framework.Test]
28+
public virtual void TopMinCenterAndRightTest() {
29+
ConvertToPdfAndCompare("topMinCenterAndRight", sourceFolder, destinationFolder);
30+
}
31+
32+
/// <exception cref="System.IO.IOException"/>
33+
/// <exception cref="System.Exception"/>
34+
[NUnit.Framework.Test]
35+
[NUnit.Framework.Ignore("TODO DEVSIX-2389: Change test files after decision")]
36+
public virtual void TopMinLeftAndCenterTest() {
37+
ConvertToPdfAndCompare("topMinLeftAndCenter", sourceFolder, destinationFolder);
38+
}
39+
40+
/// <exception cref="System.IO.IOException"/>
41+
/// <exception cref="System.Exception"/>
42+
[NUnit.Framework.Test]
43+
public virtual void TopMinLeftAndRight() {
44+
ConvertToPdfAndCompare("topMinLeftAndRight", sourceFolder, destinationFolder);
45+
}
46+
47+
/// <exception cref="System.IO.IOException"/>
48+
/// <exception cref="System.Exception"/>
49+
[NUnit.Framework.Test]
50+
public virtual void TopMinLeftAndMinCenterAndMinRight() {
51+
ConvertToPdfAndCompare("topMinLeftAndMinCenterAndMinRight", sourceFolder, destinationFolder);
52+
}
53+
54+
//Left margin box tests
55+
/// <exception cref="System.IO.IOException"/>
56+
/// <exception cref="System.Exception"/>
57+
[NUnit.Framework.Test]
58+
public virtual void LeftOnlyMinTopTest() {
59+
ConvertToPdfAndCompare("leftOnlyMinTop", sourceFolder, destinationFolder);
60+
}
61+
62+
/// <exception cref="System.IO.IOException"/>
63+
/// <exception cref="System.Exception"/>
64+
[NUnit.Framework.Test]
65+
public virtual void LeftTopAndMinCenterTest() {
66+
ConvertToPdfAndCompare("leftTopAndMinCenter", sourceFolder, destinationFolder);
67+
}
68+
69+
/// <exception cref="System.IO.IOException"/>
70+
/// <exception cref="System.Exception"/>
71+
[NUnit.Framework.Test]
72+
public virtual void LeftTopAndMinBottomTest() {
73+
ConvertToPdfAndCompare("leftTopAndMinBottom", sourceFolder, destinationFolder);
74+
}
75+
76+
/// <exception cref="System.IO.IOException"/>
77+
/// <exception cref="System.Exception"/>
78+
[NUnit.Framework.Test]
79+
public virtual void LeftMinCenterAndBottomTest() {
80+
ConvertToPdfAndCompare("leftMinCenterAndBottom", sourceFolder, destinationFolder);
81+
}
82+
83+
/// <exception cref="System.IO.IOException"/>
84+
/// <exception cref="System.Exception"/>
85+
[NUnit.Framework.Test]
86+
public virtual void LeftMinTopAndMinCenterAndBottomTest() {
87+
ConvertToPdfAndCompare("leftMinTopAndMinCenterAndBottom", sourceFolder, destinationFolder);
88+
}
89+
}
90+
}

0 commit comments

Comments
 (0)