Skip to content

Commit 26c8479

Browse files
rnadvodnypavel-alay
authored andcommitted
Limit calculated dimensions by available value
Update tests Remove obsolete method + javadocs remove obsolete old method rename Dimensions classes for code clarity javadocs Add two more edge-case tests javadocs, review remarks and test rename Remove unnecessary java class Refactor method Add tests for running elements variable content width DEVSIX-2388 DEVSIX-1050 Autoported commit. Original commit hash: [c4f57240]
1 parent 131fe4b commit 26c8479

File tree

120 files changed

+597
-266
lines changed

Some content is hidden

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

120 files changed

+597
-266
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/PageRuleTest.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,20 @@ public virtual void MarginBoxRunningElements02() {
464464
RunTest("marginBoxRunningElements02");
465465
}
466466

467+
/// <exception cref="System.IO.IOException"/>
468+
/// <exception cref="System.Exception"/>
469+
[NUnit.Framework.Test]
470+
public virtual void MarginBoxRunningElements03() {
471+
RunTest("marginBoxRunningElements03");
472+
}
473+
474+
/// <exception cref="System.IO.IOException"/>
475+
/// <exception cref="System.Exception"/>
476+
[NUnit.Framework.Test]
477+
public virtual void MarginBoxRunningElements04() {
478+
RunTest("marginBoxRunningElements04");
479+
}
480+
467481
/// <exception cref="System.IO.IOException"/>
468482
/// <exception cref="System.Exception"/>
469483
[NUnit.Framework.Test]
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
using iText.Test.Attributes;
44

55
namespace iText.Html2pdf.Css.Media.Page {
6-
public class PageMarginBoxIntegrationTests : ExtendedHtmlConversionITextTest {
6+
public class PageMarginBoxIntegrationTest : ExtendedHtmlConversionITextTest {
77
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
8-
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/PageMarginBoxIntegrationTests/";
8+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/PageMarginBoxIntegrationTest/";
99

1010
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
11-
+ "/test/itext/html2pdf/css/media/page/PageMarginBoxIntegrationTests/";
11+
+ "/test/itext/html2pdf/css/media/page/PageMarginBoxIntegrationTest/";
1212

1313
[NUnit.Framework.OneTimeSetUp]
1414
public static void BeforeClass() {
@@ -349,5 +349,26 @@ public virtual void LargeFixedAllLeftRightTest() {
349349
public virtual void LargeFixedAllTopBottomTest() {
350350
ConvertToPdfAndCompare("largeFixedAllTopBottomTest", sourceFolder, destinationFolder);
351351
}
352+
353+
/// <exception cref="System.IO.IOException"/>
354+
/// <exception cref="System.Exception"/>
355+
[NUnit.Framework.Test]
356+
public virtual void LargeFixedSidesAutoMiddleTest() {
357+
ConvertToPdfAndCompare("largeFixedSidesAutoMiddleTest", sourceFolder, destinationFolder);
358+
}
359+
360+
/// <exception cref="System.IO.IOException"/>
361+
/// <exception cref="System.Exception"/>
362+
[NUnit.Framework.Test]
363+
public virtual void LargeFixedSidesFixedMiddleTest() {
364+
ConvertToPdfAndCompare("largeFixedSidesFixedMiddleTest", sourceFolder, destinationFolder);
365+
}
366+
367+
/// <exception cref="System.IO.IOException"/>
368+
/// <exception cref="System.Exception"/>
369+
[NUnit.Framework.Test]
370+
public virtual void LargeFixedSidesNoMiddleTest() {
371+
ConvertToPdfAndCompare("largeFixedSidesNoMiddleTest", sourceFolder, destinationFolder);
372+
}
352373
}
353374
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using iText.Html2pdf;
33

44
namespace iText.Html2pdf.Css.Media.Page.Fix_dimension {
5-
public class PageMarginBoxFixDimensionTests : ExtendedHtmlConversionITextTest {
5+
public class PageMarginBoxFixDimensionTest : ExtendedHtmlConversionITextTest {
66
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
77
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/fix_dimension/";
88

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using iText.Html2pdf;
33

44
namespace iText.Html2pdf.Css.Media.Page.Max_dimension {
5-
public class PageMarginBoxMaxDimensionTests : ExtendedHtmlConversionITextTest {
5+
public class PageMarginBoxMaxDimensionTest : ExtendedHtmlConversionITextTest {
66
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
77
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/max_dimension/";
88

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using iText.Html2pdf;
33

44
namespace iText.Html2pdf.Css.Media.Page.Min_dimension {
5-
public class PageMarginBoxMinDimensionTests : ExtendedHtmlConversionITextTest {
5+
public class PageMarginBoxMinDimensionTest : ExtendedHtmlConversionITextTest {
66
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
77
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/media/page/min_dimension/";
88

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<html>
2+
<head>
3+
<style type="text/css">
4+
@page {
5+
size: A4;
6+
border: thin solid black;
7+
margin: 6in 1in 1in 1in;
8+
9+
@top-left {
10+
background: lightgray;
11+
content: 'here is some text in top-left margin-box, its fairly bigger than the text "element(header-center)". Let\'s even go further and even more text. Here it goes, even though it\'s never enough to be comparable to the center box.';
12+
overflow: visible;
13+
}
14+
15+
@top-center {
16+
background: lightblue;
17+
content: element(header-center);
18+
overflow: visible;
19+
}
20+
}
21+
22+
#page-header-center {
23+
position: running(header-center);
24+
}
25+
table {
26+
border-collapse: collapse;
27+
}
28+
td, th {
29+
border: solid 1px;
30+
}
31+
</style>
32+
</head>
33+
34+
<body>
35+
<div id="page-content">
36+
<p>Page 1.</p>
37+
<p style="page-break-before: always;">Page 2.</p>
38+
</div>
39+
<div id="page-header-center">
40+
Here is an example of <span style="font-weight: bold">not</span> that simple
41+
<img src="itis.jpg" style="width: 50pt; height: 50pt">
42+
<table style="display: inline-block">
43+
<tr><td>cell 1</td><td>cell 2</td></tr>
44+
<tr><td>cell 3</td><td>cell 4</td></tr>
45+
</table>
46+
page margin content. With quite a lot of content, much more than in top-left.
47+
Some even more text: "Before you discuss the resolution, let me place before you one or two things, I want you to understand two things very clearly and to consider them from the same point of view from which I am placing them before you. I ask you to consider it from my point of view, because if you approve of it, you will be enjoined to carry out all I say. It will be a great responsibility. There are people who ask me whether I am the same man that I was in 1920, or whether there has been any change in me. You are right in asking that question.
48+
Let me, however, hasten to assure that I am the same Gandhi as I was in 1920. I have not changed in any fundamental respect. I attach the same importance to non-violence that I did then. If at all, my emphasis on it has grown stronger. There is no real contradiction between the present resolution and my previous writings and utterances.
49+
50+
Occasions like the present do not occur in everybody’s and but rarely in anybody’s life. I want you to know and feel that there is nothing but purest Ahimsa in all that I am saying and doing today.Violence is key. The draft resolution of the Working Committee is based on Ahimsa, the contemplated struggle similarly has its roots in Ahimsa. If, therefore, there is any among you who has lost faith in Ahimsa or is wearied of it, let him not vote for this resolution. Let me explain my position clearly. God has vouchsafed to me a priceless gift in the weapon of Ahimsa. I and my Ahimsa are on our trail today. If in the present crisis, when the earth is being scorched by the flames of Himsa and crying for deliverance, I failed to make use of the God given talent, God will not forgive me and I shall be judged unworthy of the great gift. I must act now. I may not hesitate and merely look on, when Russia and China are threatened."
51+
</div>
52+
</body>
53+
</html>

0 commit comments

Comments
 (0)