Skip to content

Commit 2ee81b9

Browse files
committed
Merge branch 'release/2.0.1'
2 parents 086d766 + 51e65c2 commit 2ee81b9

File tree

231 files changed

+3352
-214
lines changed

Some content is hidden

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

231 files changed

+3352
-214
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
[assembly: AssemblyConfiguration("")]
88
[assembly: AssemblyCompany("iText Group NV")]
99
[assembly: AssemblyProduct("iText")]
10-
[assembly: AssemblyCopyright("Copyright (c) 1998-2017 iText Group NV")]
10+
[assembly: AssemblyCopyright("Copyright (c) 1998-2018 iText Group NV")]
1111
[assembly: AssemblyTrademark("")]
1212
[assembly: AssemblyCulture("")]
1313

1414
[assembly: ComVisible(false)]
1515

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

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

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

itext.tests/itext.html2pdf.tests/itext.html2pdf.tests.netstandard.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdfa\itext.pdfa.netstandard.csproj" />
5454
<ProjectReference Include="..\..\..\itextcore\itext\itext.hyph\itext.hyph.netstandard.csproj" />
5555
<ProjectReference Include="..\..\..\itextcore\itext\itext.pdftest\itext.pdftest.netstandard.csproj" />
56-
<ProjectReference Include="..\..\..\typography\itext\itext.typography\itext.typography.netstandard.csproj" />
5756
<ProjectReference Include="..\..\itext\itext.html2pdf\itext.html2pdf.netstandard.csproj" />
5857
</ItemGroup>
5958
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/BorderRadiusTest.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,75 @@ public virtual void BorderRadius06Test() {
118118
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest06.pdf"
119119
, sourceFolder + "cmp_borderRadiusTest06.pdf", destinationFolder, "diff06_"));
120120
}
121+
122+
/// <exception cref="System.IO.IOException"/>
123+
/// <exception cref="System.Exception"/>
124+
[NUnit.Framework.Test]
125+
public virtual void BorderRadius07Test() {
126+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest07.html"), new FileInfo(destinationFolder
127+
+ "borderRadiusTest07.pdf"));
128+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest07.pdf"
129+
, sourceFolder + "cmp_borderRadiusTest07.pdf", destinationFolder, "diff07_"));
130+
}
131+
132+
/// <exception cref="System.IO.IOException"/>
133+
/// <exception cref="System.Exception"/>
134+
[NUnit.Framework.Test]
135+
public virtual void BorderRadius08Test() {
136+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest08.html"), new FileInfo(destinationFolder
137+
+ "borderRadiusTest08.pdf"));
138+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest08.pdf"
139+
, sourceFolder + "cmp_borderRadiusTest08.pdf", destinationFolder, "diff08_"));
140+
}
141+
142+
/// <exception cref="System.IO.IOException"/>
143+
/// <exception cref="System.Exception"/>
144+
[NUnit.Framework.Test]
145+
public virtual void BorderRadius09Test() {
146+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest09.html"), new FileInfo(destinationFolder
147+
+ "borderRadiusTest09.pdf"));
148+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest09.pdf"
149+
, sourceFolder + "cmp_borderRadiusTest09.pdf", destinationFolder, "diff09_"));
150+
}
151+
152+
/// <exception cref="System.IO.IOException"/>
153+
/// <exception cref="System.Exception"/>
154+
[NUnit.Framework.Test]
155+
public virtual void BorderRadius10Test() {
156+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest10.html"), new FileInfo(destinationFolder
157+
+ "borderRadiusTest10.pdf"));
158+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest10.pdf"
159+
, sourceFolder + "cmp_borderRadiusTest10.pdf", destinationFolder, "diff10_"));
160+
}
161+
162+
/// <exception cref="System.IO.IOException"/>
163+
/// <exception cref="System.Exception"/>
164+
[NUnit.Framework.Test]
165+
public virtual void BorderRadius11Test() {
166+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest11.html"), new FileInfo(destinationFolder
167+
+ "borderRadiusTest11.pdf"));
168+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest11.pdf"
169+
, sourceFolder + "cmp_borderRadiusTest11.pdf", destinationFolder, "diff11_"));
170+
}
171+
172+
/// <exception cref="System.IO.IOException"/>
173+
/// <exception cref="System.Exception"/>
174+
[NUnit.Framework.Test]
175+
public virtual void BorderRadius12Test() {
176+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest12.html"), new FileInfo(destinationFolder
177+
+ "borderRadiusTest12.pdf"));
178+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest12.pdf"
179+
, sourceFolder + "cmp_borderRadiusTest12.pdf", destinationFolder, "diff12_"));
180+
}
181+
182+
/// <exception cref="System.IO.IOException"/>
183+
/// <exception cref="System.Exception"/>
184+
[NUnit.Framework.Test]
185+
public virtual void BorderRadius13Test() {
186+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "borderRadiusTest13.html"), new FileInfo(destinationFolder
187+
+ "borderRadiusTest13.pdf"));
188+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "borderRadiusTest13.pdf"
189+
, sourceFolder + "cmp_borderRadiusTest13.pdf", destinationFolder, "diff13_"));
190+
}
121191
}
122192
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/CssInheritanceTest.cs

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ source product.
4646
using iText.IO.Util;
4747
using iText.Kernel.Utils;
4848
using iText.Test;
49+
using iText.Test.Attributes;
4950

5051
namespace iText.Html2pdf.Css {
5152
public class CssInheritanceTest : ExtendedITextTest {
@@ -60,9 +61,9 @@ public static void BeforeClass() {
6061
CreateDestinationFolder(destinationFolder);
6162
}
6263

64+
//em value inherited
6365
/// <exception cref="System.IO.IOException"/>
6466
/// <exception cref="System.Exception"/>
65-
[NUnit.Framework.Ignore("DEVSIX-1578")]
6667
[NUnit.Framework.Test]
6768
public virtual void CssInheritanceTest01() {
6869
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "cssInheritance01.html"), new FileInfo(destinationFolder
@@ -72,5 +73,71 @@ public virtual void CssInheritanceTest01() {
7273
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "cssInheritance01.pdf"
7374
, sourceFolder + "cmp_cssInheritance01.pdf", destinationFolder, "diff01_"));
7475
}
76+
77+
//ex value inherited
78+
/// <exception cref="System.IO.IOException"/>
79+
/// <exception cref="System.Exception"/>
80+
[LogMessage(iText.Html2pdf.LogMessageConstant.DEFAULT_VALUE_OF_CSS_PROPERTY_UNKNOWN)]
81+
[NUnit.Framework.Test]
82+
public virtual void CssInheritanceTest02() {
83+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "cssInheritance02.html"), new FileInfo(destinationFolder
84+
+ "cssInheritance02.pdf"));
85+
System.Console.Out.WriteLine("html: file:///" + UrlUtil.ToNormalizedURI(sourceFolder + "cssInheritance02.html"
86+
).AbsolutePath + "\n");
87+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "cssInheritance02.pdf"
88+
, sourceFolder + "cmp_cssInheritance02.pdf", destinationFolder, "diff02_"));
89+
}
90+
91+
//rem value inherited, shorthand
92+
/// <exception cref="System.IO.IOException"/>
93+
/// <exception cref="System.Exception"/>
94+
[NUnit.Framework.Test]
95+
public virtual void CssInheritanceTest03() {
96+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "cssInheritance03.html"), new FileInfo(destinationFolder
97+
+ "cssInheritance03.pdf"));
98+
System.Console.Out.WriteLine("html: file:///" + UrlUtil.ToNormalizedURI(sourceFolder + "cssInheritance03.html"
99+
).AbsolutePath + "\n");
100+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "cssInheritance03.pdf"
101+
, sourceFolder + "cmp_cssInheritance03.pdf", destinationFolder, "diff03_"));
102+
}
103+
104+
//% value inherited, font-size dependent
105+
/// <exception cref="System.IO.IOException"/>
106+
/// <exception cref="System.Exception"/>
107+
[NUnit.Framework.Test]
108+
public virtual void CssInheritanceTest04() {
109+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "cssInheritance04.html"), new FileInfo(destinationFolder
110+
+ "cssInheritance04.pdf"));
111+
System.Console.Out.WriteLine("html: file:///" + UrlUtil.ToNormalizedURI(sourceFolder + "cssInheritance04.html"
112+
).AbsolutePath + "\n");
113+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "cssInheritance04.pdf"
114+
, sourceFolder + "cmp_cssInheritance04.pdf", destinationFolder, "diff04_"));
115+
}
116+
117+
//% value inherited, layout dependent
118+
/// <exception cref="System.IO.IOException"/>
119+
/// <exception cref="System.Exception"/>
120+
[NUnit.Framework.Test]
121+
public virtual void CssInheritanceTest05() {
122+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "cssInheritance05.html"), new FileInfo(destinationFolder
123+
+ "cssInheritance05.pdf"));
124+
System.Console.Out.WriteLine("html: file:///" + UrlUtil.ToNormalizedURI(sourceFolder + "cssInheritance05.html"
125+
).AbsolutePath + "\n");
126+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "cssInheritance05.pdf"
127+
, sourceFolder + "cmp_cssInheritance05.pdf", destinationFolder, "diff05_"));
128+
}
129+
130+
//smaller value inherited
131+
/// <exception cref="System.IO.IOException"/>
132+
/// <exception cref="System.Exception"/>
133+
[NUnit.Framework.Test]
134+
public virtual void CssInheritanceTest06() {
135+
HtmlConverter.ConvertToPdf(new FileInfo(sourceFolder + "cssInheritance06.html"), new FileInfo(destinationFolder
136+
+ "cssInheritance06.pdf"));
137+
System.Console.Out.WriteLine("html: file:///" + UrlUtil.ToNormalizedURI(sourceFolder + "cssInheritance06.html"
138+
).AbsolutePath + "\n");
139+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "cssInheritance06.pdf"
140+
, sourceFolder + "cmp_cssInheritance06.pdf", destinationFolder, "diff06_"));
141+
}
75142
}
76143
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/DisplayTest.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,5 +331,24 @@ public virtual void DisplayInlineBlock17Test() {
331331
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "display_inline-block17.pdf"
332332
, sourceFolder + "cmp_display_inline-block17.pdf", destinationFolder, "diff19_"));
333333
}
334+
335+
/// <exception cref="System.IO.IOException"/>
336+
/// <exception cref="System.Exception"/>
337+
[NUnit.Framework.Test]
338+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 7)]
339+
public virtual void InlineBlockInsideTableCellTest() {
340+
// IO setup
341+
PdfWriter writer = new PdfWriter(new FileInfo(destinationFolder + "inlineBlockInsideTableCellTest.pdf"));
342+
PdfDocument pdfDocument = new PdfDocument(writer);
343+
pdfDocument.SetDefaultPageSize(new PageSize(1000f, 1450f));
344+
// properties
345+
ConverterProperties props = new ConverterProperties();
346+
props.SetBaseUri(sourceFolder);
347+
HtmlConverter.ConvertToPdf(new FileStream(sourceFolder + "inlineBlockInsideTableCellTest.html", FileMode.Open
348+
, FileAccess.Read), pdfDocument, props);
349+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + "inlineBlockInsideTableCellTest.pdf"
350+
, sourceFolder + "cmp_inlineBlockInsideTableCell.pdf", destinationFolder, "diffinlineBlockInsideTableCellTest_"
351+
));
352+
}
334353
}
335354
}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
using System;
2+
using System.IO;
3+
using iText.Html2pdf;
4+
using iText.Kernel.Utils;
5+
using iText.Test;
6+
using iText.Test.Attributes;
7+
8+
namespace iText.Html2pdf.Css {
9+
public class FloatAndAlignmentTest : ExtendedITextTest {
10+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
11+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/FloatAndAlignmentTest/";
12+
13+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
14+
+ "/test/itext/html2pdf/css/FloatAndAlignmentTest/";
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+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 2)]
25+
public virtual void SingleBlockSingleParagraphRight() {
26+
/* this test shows different combinations of float values blocks and paragraph align RIGHT within div container
27+
*/
28+
//TODO: update test after ticket DEVSIX-1720 fix (WARN Invalid css property declaration: float: initial)
29+
//TODO: update cmp file after ticket DEVSIX-1268 fix (Float property...)
30+
RunTest("singleBlockSingleParagraphRight", "diffRight01_");
31+
}
32+
33+
/// <exception cref="System.IO.IOException"/>
34+
/// <exception cref="System.Exception"/>
35+
[NUnit.Framework.Test]
36+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 2)]
37+
public virtual void SingleBlockSingleParagraphLeft() {
38+
//TODO: update test after ticket DEVSIX-1720 fix (WARN Invalid css property declaration: float: initial)
39+
//TODO: update cmp file after ticket DEVSIX-1268 fix (Float property...)
40+
RunTest("singleBlockSingleParagraphLeft", "diffLeft01_");
41+
}
42+
43+
/// <exception cref="System.IO.IOException"/>
44+
/// <exception cref="System.Exception"/>
45+
[NUnit.Framework.Test]
46+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 2)]
47+
public virtual void SingleBlockSingleParagraphJustify() {
48+
//TODO: update test after ticket DEVSIX-1720 fix (WARN Invalid css property declaration: float: initial)
49+
//TODO: update cmp file after ticket DEVSIX-1268 fix (Float property...)
50+
RunTest("singleBlockSingleParagraphJustify", "diffJust01_");
51+
}
52+
53+
/// <exception cref="System.IO.IOException"/>
54+
/// <exception cref="System.Exception"/>
55+
[NUnit.Framework.Test]
56+
[LogMessage(iText.Html2pdf.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION, Count = 2)]
57+
public virtual void SingleBlockSingleParagraphCenter() {
58+
//TODO: update test after ticket DEVSIX-1720 fix (WARN Invalid css property declaration: float: initial)
59+
//TODO: update cmp file after ticket DEVSIX-1268 fix (Float property...)
60+
RunTest("singleBlockSingleParagraphCenter", "diffCent01_");
61+
}
62+
63+
/// <exception cref="System.IO.IOException"/>
64+
/// <exception cref="System.Exception"/>
65+
[NUnit.Framework.Test]
66+
public virtual void SeveralBlocksSingleParagraph() {
67+
/* this test shows different combinations of 3 float values blocks and 1 paragraph aligns within div container
68+
*/
69+
//TODO: update cmp file after ticket DEVSIX-1268 fix (Float property...)
70+
RunTest("severalBlocksSingleParagraph", "diffSev01_");
71+
}
72+
73+
/// <exception cref="System.IO.IOException"/>
74+
/// <exception cref="System.Exception"/>
75+
[NUnit.Framework.Test]
76+
public virtual void BlocksInsideParagraph() {
77+
/* this test shows different combinations of 3 float values blocks and 1 paragraph aligns within div container
78+
* now it points not only incorrect alignment vs float positioning, but also incorrect float area
79+
*/
80+
//TODO: update cmp file after ticket DEVSIX-1268 fix (Float property...)
81+
//TODO: update after DEVSIX-1437 fix (Fix edge cases for floats splitting)
82+
RunTest("blocksInsideParagraph", "diffInside01_");
83+
}
84+
85+
/// <exception cref="System.IO.IOException"/>
86+
/// <exception cref="System.Exception"/>
87+
[NUnit.Framework.Test]
88+
[NUnit.Framework.Ignore("DEVSIX-1732")]
89+
public virtual void InlineBlocksInsideParagraph() {
90+
RunTest("inlineBlocksInsideParagraph", "diffInlineInside01_");
91+
}
92+
93+
/// <exception cref="System.IO.IOException"/>
94+
/// <exception cref="System.Exception"/>
95+
[NUnit.Framework.Test]
96+
[NUnit.Framework.Ignore("DEVSIX-1732: floating element shall not be moved along with text when text alignment is applied."
97+
)]
98+
public virtual void InlineFloatsWithTextAlignmentTest01() {
99+
RunTest("inlineFloatsWithTextAlignmentTest01", "diffInlineFloat01_");
100+
}
101+
102+
/// <exception cref="System.IO.IOException"/>
103+
/// <exception cref="System.Exception"/>
104+
[NUnit.Framework.Test]
105+
[NUnit.Framework.Ignore("DEVSIX-1732: justification is broken when floating element is inline along with text."
106+
)]
107+
public virtual void InlineFloatsWithTextAlignmentTest02() {
108+
RunTest("inlineFloatsWithTextAlignmentTest02", "diffInlineFloat02_");
109+
}
110+
111+
/// <exception cref="System.IO.IOException"/>
112+
/// <exception cref="System.Exception"/>
113+
private void RunTest(String testName, String diff) {
114+
String htmlName = sourceFolder + testName + ".html";
115+
String outFileName = destinationFolder + testName + ".pdf";
116+
String cmpFileName = sourceFolder + "cmp_" + testName + ".pdf";
117+
HtmlConverter.ConvertToPdf(new FileInfo(htmlName), new FileInfo(outFileName));
118+
NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
119+
, diff));
120+
}
121+
}
122+
}

0 commit comments

Comments
 (0)