Skip to content

Commit e44a528

Browse files
ar3emiText-CI
authored andcommitted
Add support of background-clip and background-origin
DEVSIX-2105 Autoported commit. Original commit hash: [308db0c9]
1 parent f93a4ad commit e44a528

File tree

257 files changed

+1967
-229
lines changed

Some content is hidden

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

257 files changed

+1967
-229
lines changed
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2020 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is free software; you can redistribute it and/or modify
7+
it under the terms of the GNU Affero General Public License version 3
8+
as published by the Free Software Foundation with the addition of the
9+
following permission added to Section 15 as permitted in Section 7(a):
10+
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
11+
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
12+
OF THIRD PARTY RIGHTS
13+
14+
This program is distributed in the hope that it will be useful, but
15+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16+
or FITNESS FOR A PARTICULAR PURPOSE.
17+
See the GNU Affero General Public License for more details.
18+
You should have received a copy of the GNU Affero General Public License
19+
along with this program; if not, see http://www.gnu.org/licenses or write to
20+
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21+
Boston, MA, 02110-1301 USA, or download the license from the following URL:
22+
http://itextpdf.com/terms-of-use/
23+
24+
The interactive user interfaces in modified source and object code versions
25+
of this program must display Appropriate Legal Notices, as required under
26+
Section 5 of the GNU Affero General Public License.
27+
28+
In accordance with Section 7(b) of the GNU Affero General Public License,
29+
a covered work must retain the producer line in every PDF that is created
30+
or manipulated using iText.
31+
32+
You can be released from the requirements of the license by purchasing
33+
a commercial license. Buying such a license is mandatory as soon as you
34+
develop commercial activities involving the iText software without
35+
disclosing the source code of your own applications.
36+
These activities include: offering paid services to customers as an ASP,
37+
serving PDFs on the fly in a web application, shipping iText with a closed
38+
source product.
39+
40+
For more information, please contact iText Software Corp. at this
41+
42+
*/
43+
using System;
44+
using iText.Html2pdf;
45+
46+
namespace iText.Html2pdf.Css {
47+
public class BackgroundClipTest : ExtendedHtmlConversionITextTest {
48+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
49+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/BackgroundClipTest/";
50+
51+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
52+
+ "/test/itext/html2pdf/css/BackgroundClipTest/";
53+
54+
[NUnit.Framework.OneTimeSetUp]
55+
public static void BeforeClass() {
56+
CreateDestinationFolder(destinationFolder);
57+
}
58+
59+
[NUnit.Framework.Test]
60+
public virtual void BackgroundColorBorderBoxTest() {
61+
ConvertToPdfAndCompare("backgroundColorBorderBox", sourceFolder, destinationFolder);
62+
}
63+
64+
[NUnit.Framework.Test]
65+
public virtual void BackgroundColorContentBoxTest() {
66+
ConvertToPdfAndCompare("backgroundColorContentBox", sourceFolder, destinationFolder);
67+
}
68+
69+
[NUnit.Framework.Test]
70+
public virtual void BackgroundColorContentBox1Test() {
71+
ConvertToPdfAndCompare("backgroundColorContentBox1", sourceFolder, destinationFolder);
72+
}
73+
74+
[NUnit.Framework.Test]
75+
public virtual void BackgroundColorContentBoxMarginsTest() {
76+
ConvertToPdfAndCompare("backgroundColorContentBoxMargins", sourceFolder, destinationFolder);
77+
}
78+
79+
[NUnit.Framework.Test]
80+
public virtual void BackgroundColorDefaultTest() {
81+
ConvertToPdfAndCompare("backgroundColorDefault", sourceFolder, destinationFolder);
82+
}
83+
84+
[NUnit.Framework.Test]
85+
public virtual void BackgroundColorPaddingBoxTest() {
86+
ConvertToPdfAndCompare("backgroundColorPaddingBox", sourceFolder, destinationFolder);
87+
}
88+
89+
[NUnit.Framework.Test]
90+
public virtual void BackgroundImageBorderBoxTest() {
91+
ConvertToPdfAndCompare("backgroundImageBorderBox", sourceFolder, destinationFolder);
92+
}
93+
94+
[NUnit.Framework.Test]
95+
public virtual void BackgroundImageColorContentBoxTest() {
96+
ConvertToPdfAndCompare("backgroundImageColorContentBox", sourceFolder, destinationFolder);
97+
}
98+
99+
[NUnit.Framework.Test]
100+
public virtual void BackgroundImageColorDefaultTest() {
101+
ConvertToPdfAndCompare("backgroundImageColorDefault", sourceFolder, destinationFolder);
102+
}
103+
104+
[NUnit.Framework.Test]
105+
public virtual void BackgroundImageContentBoxTest() {
106+
ConvertToPdfAndCompare("backgroundImageContentBox", sourceFolder, destinationFolder);
107+
}
108+
109+
[NUnit.Framework.Test]
110+
public virtual void BackgroundImageDiffBordersPaddingsTest() {
111+
ConvertToPdfAndCompare("backgroundImageDiffBordersPaddings", sourceFolder, destinationFolder);
112+
}
113+
114+
[NUnit.Framework.Test]
115+
public virtual void BackgroundImageDefaultTest() {
116+
ConvertToPdfAndCompare("backgroundImageDefault", sourceFolder, destinationFolder);
117+
}
118+
119+
[NUnit.Framework.Test]
120+
public virtual void BackgroundImagePaddingBoxTest() {
121+
ConvertToPdfAndCompare("backgroundImagePaddingBox", sourceFolder, destinationFolder);
122+
}
123+
124+
[NUnit.Framework.Test]
125+
public virtual void BackgroundMultiImageTest() {
126+
ConvertToPdfAndCompare("backgroundMultiImage", sourceFolder, destinationFolder);
127+
}
128+
129+
[NUnit.Framework.Test]
130+
public virtual void BackgroundMultiImageColorTest() {
131+
ConvertToPdfAndCompare("backgroundMultiImageColor", sourceFolder, destinationFolder);
132+
}
133+
134+
[NUnit.Framework.Test]
135+
public virtual void BackgroundMultiImageColor2Test() {
136+
ConvertToPdfAndCompare("backgroundMultiImageColor2", sourceFolder, destinationFolder);
137+
}
138+
139+
[NUnit.Framework.Test]
140+
public virtual void BackgroundMultiImageColor3Test() {
141+
ConvertToPdfAndCompare("backgroundMultiImageColor3", sourceFolder, destinationFolder);
142+
}
143+
144+
[NUnit.Framework.Test]
145+
public virtual void BackgroundColorMultipleClipTest() {
146+
ConvertToPdfAndCompare("backgroundColorMultipleClip", sourceFolder, destinationFolder);
147+
}
148+
149+
[NUnit.Framework.Test]
150+
public virtual void BackgroundColorBorderRadiusTest() {
151+
// TODO DEVSIX-4525 border-radius works incorrectly with background-clip
152+
ConvertToPdfAndCompare("backgroundColorBorderRadius", sourceFolder, destinationFolder);
153+
}
154+
155+
[NUnit.Framework.Test]
156+
public virtual void BackgroundImageBorderRadiusTest() {
157+
// TODO DEVSIX-4525 border-radius works incorrectly with background-clip
158+
ConvertToPdfAndCompare("backgroundImageBorderRadius", sourceFolder, destinationFolder);
159+
}
160+
161+
[NUnit.Framework.Test]
162+
public virtual void BackgroundGradientBorderBoxTest() {
163+
ConvertToPdfAndCompare("backgroundGradientBorderBox", sourceFolder, destinationFolder);
164+
}
165+
166+
[NUnit.Framework.Test]
167+
public virtual void BackgroundGradientPaddingBoxTest() {
168+
ConvertToPdfAndCompare("backgroundGradientPaddingBox", sourceFolder, destinationFolder);
169+
}
170+
171+
[NUnit.Framework.Test]
172+
public virtual void BackgroundGradientContentBoxTest() {
173+
ConvertToPdfAndCompare("backgroundGradientContentBox", sourceFolder, destinationFolder);
174+
}
175+
176+
[NUnit.Framework.Test]
177+
public virtual void MultiImageColorCommaTest() {
178+
ConvertToPdfAndCompare("multiImageColorComma", sourceFolder, destinationFolder);
179+
}
180+
181+
[NUnit.Framework.Test]
182+
public virtual void MultiImageColorNoCommaTest() {
183+
ConvertToPdfAndCompare("multiImageColorNoComma", sourceFolder, destinationFolder);
184+
}
185+
186+
[NUnit.Framework.Test]
187+
public virtual void MultiImageColorNoneCommaTest() {
188+
ConvertToPdfAndCompare("multiImageColorNoneComma", sourceFolder, destinationFolder);
189+
}
190+
191+
[NUnit.Framework.Test]
192+
public virtual void MultiImageColorNoneNoCommaTest() {
193+
ConvertToPdfAndCompare("multiImageColorNoneNoComma", sourceFolder, destinationFolder);
194+
}
195+
196+
[NUnit.Framework.Test]
197+
public virtual void BackgroundImagePositionContentBoxTest() {
198+
ConvertToPdfAndCompare("backgroundImagePositionContentBox", sourceFolder, destinationFolder);
199+
}
200+
}
201+
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2020 iText Group NV
4+
Authors: iText Software.
5+
6+
This program is offered under a commercial and under the AGPL license.
7+
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
8+
9+
AGPL licensing:
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
using System;
24+
using iText.Html2pdf;
25+
26+
namespace iText.Html2pdf.Css {
27+
public class BackgroundOriginTest : ExtendedHtmlConversionITextTest {
28+
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
29+
.CurrentContext.TestDirectory) + "/resources/itext/html2pdf/css/BackgroundOriginTest/";
30+
31+
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
32+
+ "/test/itext/html2pdf/css/BackgroundOriginTest/";
33+
34+
[NUnit.Framework.OneTimeSetUp]
35+
public static void BeforeClass() {
36+
CreateDestinationFolder(destinationFolder);
37+
}
38+
39+
[NUnit.Framework.Test]
40+
public virtual void BackgroundColorContentBoxTest() {
41+
ConvertToPdfAndCompare("backgroundColorContentBox", sourceFolder, destinationFolder);
42+
}
43+
44+
[NUnit.Framework.Test]
45+
public virtual void BackgroundGradientBorderBoxTest() {
46+
ConvertToPdfAndCompare("backgroundGradientBorderBox", sourceFolder, destinationFolder);
47+
}
48+
49+
[NUnit.Framework.Test]
50+
public virtual void BackgroundGradientColorTest() {
51+
ConvertToPdfAndCompare("backgroundGradientColor", sourceFolder, destinationFolder);
52+
}
53+
54+
[NUnit.Framework.Test]
55+
public virtual void BackgroundGradientContentBoxTest() {
56+
ConvertToPdfAndCompare("backgroundGradientContentBox", sourceFolder, destinationFolder);
57+
}
58+
59+
[NUnit.Framework.Test]
60+
public virtual void BackgroundGradientPaddingBoxTest() {
61+
ConvertToPdfAndCompare("backgroundGradientPaddingBox", sourceFolder, destinationFolder);
62+
}
63+
64+
[NUnit.Framework.Test]
65+
public virtual void BackgroundImageBorderBoxTest() {
66+
ConvertToPdfAndCompare("backgroundImageBorderBox", sourceFolder, destinationFolder);
67+
}
68+
69+
[NUnit.Framework.Test]
70+
public virtual void BackgroundImageColorTest() {
71+
ConvertToPdfAndCompare("backgroundImageColor", sourceFolder, destinationFolder);
72+
}
73+
74+
[NUnit.Framework.Test]
75+
public virtual void BackgroundImageContentBoxTest() {
76+
ConvertToPdfAndCompare("backgroundImageContentBox", sourceFolder, destinationFolder);
77+
}
78+
79+
[NUnit.Framework.Test]
80+
public virtual void BackgroundImagePaddingBoxTest() {
81+
ConvertToPdfAndCompare("backgroundImagePaddingBox", sourceFolder, destinationFolder);
82+
}
83+
84+
[NUnit.Framework.Test]
85+
public virtual void BackgroundImageContentBoxCleanTest() {
86+
ConvertToPdfAndCompare("backgroundImageContentBoxClean", sourceFolder, destinationFolder);
87+
}
88+
89+
[NUnit.Framework.Test]
90+
public virtual void BackgroundImageNoBorderTest() {
91+
ConvertToPdfAndCompare("backgroundImageNoBorder", sourceFolder, destinationFolder);
92+
}
93+
94+
[NUnit.Framework.Test]
95+
public virtual void BackgroundImageNoPaddingsTest() {
96+
ConvertToPdfAndCompare("backgroundImageNoPaddings", sourceFolder, destinationFolder);
97+
}
98+
99+
[NUnit.Framework.Test]
100+
public virtual void BackgroundImageBorderTopTest() {
101+
ConvertToPdfAndCompare("backgroundImageBorderTop", sourceFolder, destinationFolder);
102+
}
103+
104+
[NUnit.Framework.Test]
105+
public virtual void BackgroundImagePaddingLeftTest() {
106+
ConvertToPdfAndCompare("backgroundImagePaddingLeft", sourceFolder, destinationFolder);
107+
}
108+
109+
[NUnit.Framework.Test]
110+
public virtual void LinearGradientDiffBordersBorderBoxTest() {
111+
ConvertToPdfAndCompare("linearGradientDiffBordersBorderBox", sourceFolder, destinationFolder);
112+
}
113+
114+
[NUnit.Framework.Test]
115+
public virtual void LinearGradientDiffPaddingsTest() {
116+
ConvertToPdfAndCompare("linearGradientDiffPaddings", sourceFolder, destinationFolder);
117+
}
118+
119+
[NUnit.Framework.Test]
120+
public virtual void ImagePositionBorderBoxTest() {
121+
ConvertToPdfAndCompare("imagePositionBorderBox", sourceFolder, destinationFolder);
122+
}
123+
124+
[NUnit.Framework.Test]
125+
public virtual void ImagePositionPaddingBoxTest() {
126+
ConvertToPdfAndCompare("imagePositionPaddingBox", sourceFolder, destinationFolder);
127+
}
128+
129+
[NUnit.Framework.Test]
130+
public virtual void ImagePositionContentBoxTest() {
131+
ConvertToPdfAndCompare("imagePositionContentBox", sourceFolder, destinationFolder);
132+
}
133+
134+
[NUnit.Framework.Test]
135+
public virtual void ImagePositionNumberValuesTest() {
136+
ConvertToPdfAndCompare("imagePositionNumberValues", sourceFolder, destinationFolder);
137+
}
138+
139+
[NUnit.Framework.Test]
140+
public virtual void ImageRepeatXTest() {
141+
ConvertToPdfAndCompare("imageRepeatX", sourceFolder, destinationFolder);
142+
}
143+
}
144+
}

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/BackgroundRepeatTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public virtual void ImageBckgSpaceTest() {
5858

5959
[NUnit.Framework.Test]
6060
public virtual void ImageBckgSpaceWithBigBorderTest() {
61-
// TODO DEVSIX-2105
6261
ConvertToPdfAndCompare("imageBckgSpaceWithBigBorder", SOURCE_FOLDER, DESTINATION_FOLDER);
6362
}
6463

0 commit comments

Comments
 (0)