Skip to content

Commit 9c03972

Browse files
Samuel Huylebroeckpavel-alay
authored andcommitted
Implement skeleton for algorithm. Add tests
Implement single A or C have content Implement A and C have content Top margin boxes width calculation Add bottom tests Support bottom margin boxes Height distribution implementation. Top and bottom test cleanup Wrap up left calculation Implement calculation for right margin boxes. Add html test files Handle width, height, min-width and min-height attributes DEVSIX-2380 DEVSIX-2381 DEVSIX-1050 Autoported commit. Original commit hash: [bfde028b]
1 parent 210ef83 commit 9c03972

File tree

184 files changed

+4075
-3
lines changed

Some content is hidden

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

184 files changed

+4075
-3
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
using System;
2+
using iText.Html2pdf;
3+
4+
namespace iText.Html2pdf.Css.Media.Page {
5+
public class PageMarginBoxIntegrationTests : ExtendedHtmlConversionITextTest {
6+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
7+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/PageMarginBoxIntegrationTests/";
8+
9+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
10+
+ "/test/itext/html2pdf/css/media/page/PageMarginBoxIntegrationTests/";
11+
12+
[NUnit.Framework.OneTimeSetUp]
13+
public static void BeforeClass() {
14+
CreateOrClearDestinationFolder(destinationFolder);
15+
}
16+
17+
/// <exception cref="System.IO.IOException"/>
18+
/// <exception cref="System.Exception"/>
19+
[NUnit.Framework.Test]
20+
public virtual void HeaderFooterTest() {
21+
ConvertToPdfAndCompare("headerFooter", sourceFolder, destinationFolder);
22+
}
23+
24+
/// <exception cref="System.IO.IOException"/>
25+
/// <exception cref="System.Exception"/>
26+
[NUnit.Framework.Test]
27+
public virtual void PageWidthContentTest() {
28+
ConvertToPdfAndCompare("css-page-width-content", sourceFolder, destinationFolder);
29+
}
30+
31+
/// <exception cref="System.IO.IOException"/>
32+
/// <exception cref="System.Exception"/>
33+
[NUnit.Framework.Test]
34+
public virtual void PageWidthElementTest() {
35+
ConvertToPdfAndCompare("css-page-width-element", sourceFolder, destinationFolder);
36+
}
37+
38+
// Top margin box tests
39+
/// <exception cref="System.IO.IOException"/>
40+
/// <exception cref="System.Exception"/>
41+
[NUnit.Framework.Test]
42+
public virtual void TopOnlyLeftTest() {
43+
ConvertToPdfAndCompare("topOnlyLeft", sourceFolder, destinationFolder);
44+
}
45+
46+
/// <exception cref="System.IO.IOException"/>
47+
/// <exception cref="System.Exception"/>
48+
[NUnit.Framework.Test]
49+
public virtual void TopOnlyRightTest() {
50+
ConvertToPdfAndCompare("topOnlyRight", sourceFolder, destinationFolder);
51+
}
52+
53+
/// <exception cref="System.IO.IOException"/>
54+
/// <exception cref="System.Exception"/>
55+
[NUnit.Framework.Test]
56+
public virtual void TopOnlyCenterTest() {
57+
ConvertToPdfAndCompare("topOnlyCenter", sourceFolder, destinationFolder);
58+
}
59+
60+
/// <exception cref="System.IO.IOException"/>
61+
/// <exception cref="System.Exception"/>
62+
[NUnit.Framework.Test]
63+
public virtual void TopCenterAndRight() {
64+
ConvertToPdfAndCompare("topCenterAndRight", sourceFolder, destinationFolder);
65+
}
66+
67+
/// <exception cref="System.IO.IOException"/>
68+
/// <exception cref="System.Exception"/>
69+
[NUnit.Framework.Test]
70+
public virtual void TopLeftAndCenter() {
71+
ConvertToPdfAndCompare("topLeftAndCenter", sourceFolder, destinationFolder);
72+
}
73+
74+
/// <exception cref="System.IO.IOException"/>
75+
/// <exception cref="System.Exception"/>
76+
[NUnit.Framework.Test]
77+
public virtual void TopLeftAndRight() {
78+
ConvertToPdfAndCompare("topLeftAndRight", sourceFolder, destinationFolder);
79+
}
80+
81+
/// <exception cref="System.IO.IOException"/>
82+
/// <exception cref="System.Exception"/>
83+
[NUnit.Framework.Test]
84+
public virtual void TopLeftAndCenterAndRight() {
85+
ConvertToPdfAndCompare("topLeftAndCenterAndRight", sourceFolder, destinationFolder);
86+
}
87+
88+
//Bottom margin box tests
89+
/// <exception cref="System.IO.IOException"/>
90+
/// <exception cref="System.Exception"/>
91+
[NUnit.Framework.Test]
92+
public virtual void BottomOnlyLeftTest() {
93+
ConvertToPdfAndCompare("bottomOnlyLeft", sourceFolder, destinationFolder);
94+
}
95+
96+
/// <exception cref="System.IO.IOException"/>
97+
/// <exception cref="System.Exception"/>
98+
[NUnit.Framework.Test]
99+
public virtual void BottomOnlyRightTest() {
100+
ConvertToPdfAndCompare("bottomOnlyRight", sourceFolder, destinationFolder);
101+
}
102+
103+
/// <exception cref="System.IO.IOException"/>
104+
/// <exception cref="System.Exception"/>
105+
[NUnit.Framework.Test]
106+
public virtual void BottomOnlyCenterTest() {
107+
ConvertToPdfAndCompare("bottomOnlyCenter", sourceFolder, destinationFolder);
108+
}
109+
110+
/// <exception cref="System.IO.IOException"/>
111+
/// <exception cref="System.Exception"/>
112+
[NUnit.Framework.Test]
113+
public virtual void BottomCenterAndRight() {
114+
ConvertToPdfAndCompare("bottomCenterAndRight", sourceFolder, destinationFolder);
115+
}
116+
117+
/// <exception cref="System.IO.IOException"/>
118+
/// <exception cref="System.Exception"/>
119+
[NUnit.Framework.Test]
120+
public virtual void BottomLeftAndCenter() {
121+
ConvertToPdfAndCompare("bottomLeftAndCenter", sourceFolder, destinationFolder);
122+
}
123+
124+
/// <exception cref="System.IO.IOException"/>
125+
/// <exception cref="System.Exception"/>
126+
[NUnit.Framework.Test]
127+
public virtual void BottomLeftAndRight() {
128+
ConvertToPdfAndCompare("bottomLeftAndRight", sourceFolder, destinationFolder);
129+
}
130+
131+
/// <exception cref="System.IO.IOException"/>
132+
/// <exception cref="System.Exception"/>
133+
[NUnit.Framework.Test]
134+
public virtual void BottomLeftAndCenterAndRight() {
135+
ConvertToPdfAndCompare("bottomLeftAndCenterAndRight", sourceFolder, destinationFolder);
136+
}
137+
138+
//Left margin box tests
139+
/// <exception cref="System.IO.IOException"/>
140+
/// <exception cref="System.Exception"/>
141+
[NUnit.Framework.Test]
142+
public virtual void LeftOnlyTopTest() {
143+
ConvertToPdfAndCompare("leftOnlyTop", sourceFolder, destinationFolder);
144+
}
145+
146+
/// <exception cref="System.IO.IOException"/>
147+
/// <exception cref="System.Exception"/>
148+
[NUnit.Framework.Test]
149+
public virtual void LeftOnlyCenterTest() {
150+
ConvertToPdfAndCompare("leftOnlyCenter", sourceFolder, destinationFolder);
151+
}
152+
153+
/// <exception cref="System.IO.IOException"/>
154+
/// <exception cref="System.Exception"/>
155+
[NUnit.Framework.Test]
156+
public virtual void LeftOnlyBottomTest() {
157+
ConvertToPdfAndCompare("leftOnlyBottom", sourceFolder, destinationFolder);
158+
}
159+
160+
/// <exception cref="System.IO.IOException"/>
161+
/// <exception cref="System.Exception"/>
162+
[NUnit.Framework.Test]
163+
public virtual void LeftTopAndCenterTest() {
164+
ConvertToPdfAndCompare("leftTopAndCenter", sourceFolder, destinationFolder);
165+
}
166+
167+
/// <exception cref="System.IO.IOException"/>
168+
/// <exception cref="System.Exception"/>
169+
[NUnit.Framework.Test]
170+
public virtual void LeftTopAndBottomTest() {
171+
ConvertToPdfAndCompare("leftTopAndBottom", sourceFolder, destinationFolder);
172+
}
173+
174+
/// <exception cref="System.IO.IOException"/>
175+
/// <exception cref="System.Exception"/>
176+
[NUnit.Framework.Test]
177+
public virtual void LeftCenterAndBottomTest() {
178+
ConvertToPdfAndCompare("leftCenterAndBottom", sourceFolder, destinationFolder);
179+
}
180+
181+
/// <exception cref="System.IO.IOException"/>
182+
/// <exception cref="System.Exception"/>
183+
[NUnit.Framework.Test]
184+
public virtual void LeftTopAndCenterAndBottomTest() {
185+
ConvertToPdfAndCompare("leftTopAndCenterAndBottom", sourceFolder, destinationFolder);
186+
}
187+
188+
//Right margin box tests
189+
/// <exception cref="System.IO.IOException"/>
190+
/// <exception cref="System.Exception"/>
191+
[NUnit.Framework.Test]
192+
public virtual void RightOnlyTopTest() {
193+
ConvertToPdfAndCompare("rightOnlyTop", sourceFolder, destinationFolder);
194+
}
195+
196+
/// <exception cref="System.IO.IOException"/>
197+
/// <exception cref="System.Exception"/>
198+
[NUnit.Framework.Test]
199+
public virtual void RightOnlyCenterTest() {
200+
ConvertToPdfAndCompare("rightOnlyCenter", sourceFolder, destinationFolder);
201+
}
202+
203+
/// <exception cref="System.IO.IOException"/>
204+
/// <exception cref="System.Exception"/>
205+
[NUnit.Framework.Test]
206+
public virtual void RightOnlyBottomTest() {
207+
ConvertToPdfAndCompare("rightOnlyBottom", sourceFolder, destinationFolder);
208+
}
209+
210+
/// <exception cref="System.IO.IOException"/>
211+
/// <exception cref="System.Exception"/>
212+
[NUnit.Framework.Test]
213+
public virtual void RightTopAndCenterTest() {
214+
ConvertToPdfAndCompare("rightTopAndCenter", sourceFolder, destinationFolder);
215+
}
216+
217+
/// <exception cref="System.IO.IOException"/>
218+
/// <exception cref="System.Exception"/>
219+
[NUnit.Framework.Test]
220+
public virtual void RightTopAndBottomTest() {
221+
ConvertToPdfAndCompare("rightTopAndBottom", sourceFolder, destinationFolder);
222+
}
223+
224+
/// <exception cref="System.IO.IOException"/>
225+
/// <exception cref="System.Exception"/>
226+
[NUnit.Framework.Test]
227+
public virtual void RightCenterAndBottomTest() {
228+
ConvertToPdfAndCompare("rightCenterAndBottom", sourceFolder, destinationFolder);
229+
}
230+
231+
/// <exception cref="System.IO.IOException"/>
232+
/// <exception cref="System.Exception"/>
233+
[NUnit.Framework.Test]
234+
public virtual void RightTopAndCenterAndBottomTest() {
235+
ConvertToPdfAndCompare("rightTopAndCenterAndBottom", sourceFolder, destinationFolder);
236+
}
237+
}
238+
}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)