Skip to content

Commit b41f278

Browse files
committed
[RELEASE] Merge branch 'release/2.0.2'
2 parents 2ee81b9 + bc8c17e commit b41f278

File tree

971 files changed

+18248
-1146
lines changed

Some content is hidden

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

971 files changed

+18248
-1146
lines changed

itext.tests/itext.html2pdf.tests/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
[assembly: Guid("ae4e5743-0665-4705-9a33-07ea57cdd269")]
1717

18-
[assembly: AssemblyVersion("2.0.1.0")]
19-
[assembly: AssemblyFileVersion("2.0.1.0")]
20-
[assembly: AssemblyInformationalVersion("2.0.1")]
18+
[assembly: AssemblyVersion("2.0.2.0")]
19+
[assembly: AssemblyFileVersion("2.0.2.0")]
20+
[assembly: AssemblyInformationalVersion("2.0.2")]
2121

2222
#if !NETSTANDARD1_6
2323
[assembly: NUnit.Framework.Timeout(300000)]

itext.tests/itext.html2pdf.tests/itext/html2pdf/ResourceResolverTest.cs

Lines changed: 266 additions & 39 deletions
Large diffs are not rendered by default.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.IO;
3+
using iText.Html2pdf;
4+
using iText.Kernel.Utils;
5+
using iText.Test;
6+
7+
namespace iText.Html2pdf.Attach.Impl.Util {
8+
public class WhiteSpaceCollapsingAndTrimmingTest : ExtendedITextTest {
9+
private static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
10+
+ "/test/itext/html2pdf/attacher/impl/WhiteSpaceCollapsingAndTrimmingTest/";
11+
12+
private static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
13+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/attacher/impl/WhiteSpaceCollapsingAndTrimmingTest/";
14+
15+
[NUnit.Framework.OneTimeSetUp]
16+
public static void BeforeClass() {
17+
CreateOrClearDestinationFolder(destinationFolder);
18+
}
19+
20+
/// <exception cref="System.IO.IOException"/>
21+
/// <exception cref="System.Exception"/>
22+
[NUnit.Framework.Test]
23+
public virtual void EmptyElementsTest01() {
24+
RunTest("emptyElementsTest01");
25+
}
26+
27+
/// <exception cref="System.IO.IOException"/>
28+
/// <exception cref="System.Exception"/>
29+
[NUnit.Framework.Test]
30+
public virtual void EmptyElementsTest02() {
31+
RunTest("emptyElementsTest02");
32+
}
33+
34+
/// <exception cref="System.IO.IOException"/>
35+
/// <exception cref="System.Exception"/>
36+
[NUnit.Framework.Test]
37+
public virtual void EmptyElementsTest03() {
38+
RunTest("emptyElementsTest03");
39+
}
40+
41+
/// <exception cref="System.IO.IOException"/>
42+
/// <exception cref="System.Exception"/>
43+
[NUnit.Framework.Test]
44+
public virtual void FloatingInlineBlockInsideLinkTest01() {
45+
RunTest("floatingInlineBlockInsideLinkTest01");
46+
}
47+
48+
/// <exception cref="System.IO.IOException"/>
49+
/// <exception cref="System.Exception"/>
50+
private void RunTest(String name) {
51+
String htmlPath = sourceFolder + name + ".html";
52+
String pdfPath = destinationFolder + name + ".pdf";
53+
String cmpPdfPath = sourceFolder + "cmp_" + name + ".pdf";
54+
String diffPrefix = "diff_" + name + "_";
55+
HtmlConverter.ConvertToPdf(new FileInfo(htmlPath), new FileInfo(pdfPath));
56+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(pdfPath, cmpPdfPath, destinationFolder, diffPrefix
57+
));
58+
}
59+
}
60+
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/AbsolutePositionTest.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,16 @@ public virtual void AbsolutePositionTest17() {
233233
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "absolutePositionTest17.pdf"
234234
, sourceFolder + "cmp_absolutePositionTest17.pdf", destinationFolder, "diff17_"));
235235
}
236+
237+
/// <exception cref="System.IO.IOException"/>
238+
/// <exception cref="System.Exception"/>
239+
[NUnit.Framework.Ignore("DEVSIX-1818")]
240+
[NUnit.Framework.Test]
241+
public virtual void AbsolutePositionTest18() {
242+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "absolutePositionTest18.html"), new FileInfo(destinationFolder
243+
+ "absolutePositionTest18.pdf"));
244+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "absolutePositionTest18.pdf"
245+
, sourceFolder + "cmp_absolutePositionTest18.pdf", destinationFolder, "diff18_"));
246+
}
236247
}
237248
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
using System;
2+
using System.IO;
3+
using iText.Html2pdf;
4+
using iText.IO.Util;
5+
using iText.Kernel.Utils;
6+
using iText.Test;
7+
8+
namespace iText.Html2pdf.Css {
9+
public class BlockFormattingContextTest : ExtendedITextTest {
10+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
11+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/BlockFormattingContextTest/";
12+
13+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
14+
+ "/test/itext/html2pdf/css/BlockFormattingContextTest/";
15+
16+
[NUnit.Framework.OneTimeSetUp]
17+
public static void BeforeClass() {
18+
CreateOrClearDestinationFolder(destinationFolder);
19+
}
20+
21+
/// <exception cref="System.IO.IOException"/>
22+
/// <exception cref="System.Exception"/>
23+
[NUnit.Framework.Test]
24+
public virtual void BfcOwnerFloat_floatsAndClear() {
25+
RunTest("bfcOwnerFloat_floatsAndClear", "diff_");
26+
}
27+
28+
/// <exception cref="System.IO.IOException"/>
29+
/// <exception cref="System.Exception"/>
30+
[NUnit.Framework.Test]
31+
public virtual void BfcOwnerFloat_marginsCollapse() {
32+
RunTest("bfcOwnerFloat_marginsCollapse", "diff_");
33+
}
34+
35+
/// <exception cref="System.IO.IOException"/>
36+
/// <exception cref="System.Exception"/>
37+
[NUnit.Framework.Test]
38+
public virtual void BfcOwnerAbsolute_floatsAndClear() {
39+
// Positioning and handling floats and clearance is exactly correct,
40+
// however TODO absolutely positioned elements shall be drawn on the same z-level as floats.
41+
RunTest("bfcOwnerAbsolute_floatsAndClear", "diff_");
42+
}
43+
44+
/// <exception cref="System.IO.IOException"/>
45+
/// <exception cref="System.Exception"/>
46+
[NUnit.Framework.Test]
47+
public virtual void BfcOwnerAbsolute_marginsCollapse() {
48+
// Margins don't collapse here which is correct,
49+
// however absolute positioning works a bit wrong from css point of view.
50+
RunTest("bfcOwnerAbsolute_marginsCollapse", "diff_");
51+
}
52+
53+
/// <exception cref="System.IO.IOException"/>
54+
/// <exception cref="System.Exception"/>
55+
[NUnit.Framework.Test]
56+
public virtual void BfcOwnerInlineBlock_floatsAndClear() {
57+
RunTest("bfcOwnerInlineBlock_floatsAndClear", "diff_");
58+
}
59+
60+
/// <exception cref="System.IO.IOException"/>
61+
/// <exception cref="System.Exception"/>
62+
[NUnit.Framework.Test]
63+
public virtual void BfcOwnerInlineBlock_marginsCollapse() {
64+
RunTest("bfcOwnerInlineBlock_marginsCollapse", "diff_");
65+
}
66+
67+
/// <exception cref="System.IO.IOException"/>
68+
/// <exception cref="System.Exception"/>
69+
[NUnit.Framework.Test]
70+
public virtual void BfcOwnerOverflowHidden_floatsAndClear() {
71+
// TODO overflow:hidden with display:block behaves curiously: it completely moves away from float horizontally.
72+
// We don't handle it in such way and it's unclear right now, based on what it behaves like this.
73+
// How would it behave if it would have 100% width or width:auto?
74+
//
75+
// Now, we basically working incorrectly, since overflow:hidden requires it's inner floats to be placed
76+
// not taking into account any other floats outside parent. However right now this would result in
77+
// content overlap if we would behave like this.
78+
RunTest("bfcOwnerOverflowHidden_floatsAndClear", "diff_");
79+
}
80+
81+
/// <exception cref="System.IO.IOException"/>
82+
/// <exception cref="System.Exception"/>
83+
[NUnit.Framework.Test]
84+
public virtual void BfcOwnerOverflowHidden_marginsCollapse() {
85+
RunTest("bfcOwnerOverflowHidden_marginsCollapse", "diff_");
86+
}
87+
88+
/// <exception cref="System.IO.IOException"/>
89+
/// <exception cref="System.Exception"/>
90+
private void RunTest(String testName, String diff) {
91+
String htmlName = sourceFolder + testName + ".html";
92+
String outFileName = destinationFolder + testName + ".pdf";
93+
String cmpFileName = sourceFolder + "cmp_" + testName + ".pdf";
94+
HtmlConverter.ConvertToPdf(new FileInfo(htmlName), new FileInfo(outFileName));
95+
System.Console.Out.WriteLine("html: file:///" + UrlUtil.ToNormalizedURI(htmlName).AbsolutePath + "\n");
96+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
97+
, diff));
98+
}
99+
}
100+
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/BorderTest.cs

Lines changed: 97 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ source product.
4545
using iText.Html2pdf;
4646
using iText.Kernel.Utils;
4747
using iText.Test;
48+
using iText.Test.Attributes;
4849

4950
namespace iText.Html2pdf.Css {
5051
public class BorderTest : ExtendedITextTest {
@@ -63,30 +64,114 @@ public static void BeforeClass() {
6364
/// <exception cref="System.Exception"/>
6465
[NUnit.Framework.Test]
6566
public virtual void Border01Test() {
66-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "border01.html"), new FileInfo(destinationFolder +
67-
"border01.pdf"));
68-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "border01.pdf", sourceFolder
69-
+ "cmp_border01.pdf", destinationFolder, "diff01_"));
67+
RunTest("border01");
7068
}
7169

7270
/// <exception cref="System.IO.IOException"/>
7371
/// <exception cref="System.Exception"/>
7472
[NUnit.Framework.Test]
73+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 4)]
7574
public virtual void Border02Test() {
76-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "border02.html"), new FileInfo(destinationFolder +
77-
"border02.pdf"));
78-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "border02.pdf", sourceFolder
79-
+ "cmp_border02.pdf", destinationFolder, "diff02_"));
75+
RunTest("border02");
8076
}
8177

8278
/// <exception cref="System.IO.IOException"/>
8379
/// <exception cref="System.Exception"/>
8480
[NUnit.Framework.Test]
8581
public virtual void Border03Test() {
86-
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "border03.html"), new FileInfo(destinationFolder +
87-
"border03.pdf"));
88-
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "border03.pdf", sourceFolder
89-
+ "cmp_border03.pdf", destinationFolder, "diff03_"));
82+
RunTest("border03");
83+
}
84+
85+
/// <exception cref="System.IO.IOException"/>
86+
/// <exception cref="System.Exception"/>
87+
[NUnit.Framework.Test]
88+
public virtual void Border04Test() {
89+
RunTest("border04");
90+
}
91+
92+
/// <exception cref="System.IO.IOException"/>
93+
/// <exception cref="System.Exception"/>
94+
[NUnit.Framework.Test]
95+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 2)]
96+
public virtual void Border05Test() {
97+
RunTest("border05");
98+
}
99+
100+
/// <exception cref="System.IO.IOException"/>
101+
/// <exception cref="System.Exception"/>
102+
[NUnit.Framework.Test]
103+
public virtual void Border06Test() {
104+
RunTest("border06");
105+
}
106+
107+
/// <exception cref="System.IO.IOException"/>
108+
/// <exception cref="System.Exception"/>
109+
[NUnit.Framework.Test]
110+
public virtual void Border07Test() {
111+
RunTest("border07");
112+
}
113+
114+
/// <exception cref="System.IO.IOException"/>
115+
/// <exception cref="System.Exception"/>
116+
[NUnit.Framework.Test]
117+
public virtual void Border08Test() {
118+
RunTest("border08");
119+
}
120+
121+
/// <exception cref="System.IO.IOException"/>
122+
/// <exception cref="System.Exception"/>
123+
[NUnit.Framework.Test]
124+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 2)]
125+
public virtual void Border09Test() {
126+
RunTest("border09");
127+
}
128+
129+
/// <exception cref="System.IO.IOException"/>
130+
/// <exception cref="System.Exception"/>
131+
[NUnit.Framework.Test]
132+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 2)]
133+
public virtual void Border10Test() {
134+
RunTest("border10");
135+
}
136+
137+
/// <exception cref="System.IO.IOException"/>
138+
/// <exception cref="System.Exception"/>
139+
[NUnit.Framework.Test]
140+
public virtual void Border3DTest01() {
141+
RunTest("border3DTest01");
142+
}
143+
144+
/// <exception cref="System.IO.IOException"/>
145+
/// <exception cref="System.Exception"/>
146+
[NUnit.Framework.Test]
147+
public virtual void Border3DTest02() {
148+
RunTest("border3DTest02");
149+
}
150+
151+
/// <exception cref="System.IO.IOException"/>
152+
/// <exception cref="System.Exception"/>
153+
[NUnit.Framework.Test]
154+
public virtual void BorderTransparencyTest01() {
155+
RunTest("borderTransparencyTest01");
156+
}
157+
158+
/// <exception cref="System.IO.IOException"/>
159+
/// <exception cref="System.Exception"/>
160+
[NUnit.Framework.Test]
161+
public virtual void BorderTransparencyTest02() {
162+
RunTest("borderTransparencyTest02");
163+
}
164+
165+
/// <exception cref="System.IO.IOException"/>
166+
/// <exception cref="System.Exception"/>
167+
private void RunTest(String name) {
168+
String htmlPath = sourceFolder + name + ".html";
169+
String pdfPath = destinationFolder + name + ".pdf";
170+
String cmpPdfPath = sourceFolder + "cmp_" + name + ".pdf";
171+
String diffPrefix = "diff_" + name + "_";
172+
HtmlConverter.ConvertToPdf(new FileInfo(htmlPath), new FileInfo(pdfPath));
173+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(pdfPath, cmpPdfPath, destinationFolder, diffPrefix
174+
));
90175
}
91176
}
92177
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/CssCollapsingMarginsTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,22 @@ public virtual void CollapsingMarginsFloatTest07() {
444444
Test("collapsingMarginsFloatTest07.html", "collapsingMarginsFloatTest07.pdf", "diff_");
445445
}
446446

447+
/// <exception cref="System.IO.IOException"/>
448+
/// <exception cref="System.Exception"/>
449+
[NUnit.Framework.Test]
450+
public virtual void CollapsingMarginsFloatTest08() {
451+
// TODO DEVSIX-1820: on floats positioning collapsing margins of parent and first child is not taken into account
452+
Test("collapsingMarginsFloatTest08.html", "collapsingMarginsFloatTest08.pdf", "diff_");
453+
}
454+
455+
/// <exception cref="System.IO.IOException"/>
456+
/// <exception cref="System.Exception"/>
457+
[NUnit.Framework.Test]
458+
public virtual void CollapsingMarginsFloatTest09() {
459+
// TODO DEVSIX-1820: on floats positioning collapsing margins of parent and first child is not taken into account
460+
Test("collapsingMarginsFloatTest09.html", "collapsingMarginsFloatTest09.pdf", "diff_");
461+
}
462+
447463
/// <exception cref="System.IO.IOException"/>
448464
/// <exception cref="System.Exception"/>
449465
private void Test(String @in, String @out, String diff) {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.IO;
3+
using iText.Html2pdf;
4+
using iText.IO.Util;
5+
using iText.Kernel.Utils;
6+
using iText.Test;
7+
8+
namespace iText.Html2pdf.Css {
9+
public class CssEmptySelectorTest : ExtendedITextTest {
10+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
11+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/CssEmptySelectorTest/";
12+
13+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
14+
+ "/test/itext/html2pdf/css/CssEmptySelectorTest/";
15+
16+
[NUnit.Framework.OneTimeSetUp]
17+
public static void BeforeClass() {
18+
CreateOrClearDestinationFolder(destinationFolder);
19+
}
20+
21+
/// <exception cref="System.IO.IOException"/>
22+
/// <exception cref="System.Exception"/>
23+
[NUnit.Framework.Test]
24+
public virtual void CssEmptyNotEmptyNestedNodesTest() {
25+
RunTest("cssEmptyNotEmptyNestedNodesTest", "diff01_");
26+
}
27+
28+
/// <exception cref="System.IO.IOException"/>
29+
/// <exception cref="System.Exception"/>
30+
private void RunTest(String testName, String diff) {
31+
String htmlName = sourceFolder + testName + ".html";
32+
String outFileName = destinationFolder + testName + ".pdf";
33+
String cmpFileName = sourceFolder + "cmp_" + testName + ".pdf";
34+
System.Console.Out.WriteLine("html: file:///" + UrlUtil.ToNormalizedURI(htmlName).AbsolutePath + "\n");
35+
HtmlConverter.ConvertToPdf(new FileInfo(htmlName), new FileInfo(outFileName));
36+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
37+
, diff));
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)