Skip to content

Commit d1466b8

Browse files
author
Kate Ivanova
committed
Add tests for "background-repeat" css property
DEVSIX-4533
1 parent 371b77e commit d1466b8

File tree

62 files changed

+1155
-0
lines changed

Some content is hidden

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

62 files changed

+1155
-0
lines changed
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
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+
package com.itextpdf.html2pdf.css;
24+
25+
import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest;
26+
import com.itextpdf.test.annotations.type.IntegrationTest;
27+
28+
import java.io.IOException;
29+
import org.junit.BeforeClass;
30+
import org.junit.Test;
31+
import org.junit.experimental.categories.Category;
32+
33+
@Category(IntegrationTest.class)
34+
public class BackgroundRepeatTest extends ExtendedHtmlConversionITextTest {
35+
36+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/BackgroundRepeatTest/";
37+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/BackgroundRepeatTest/";
38+
39+
@BeforeClass
40+
public static void beforeClass() {
41+
createDestinationFolder(DESTINATION_FOLDER);
42+
}
43+
44+
@Test
45+
//TODO: DEVSIX-4370 update cmp file
46+
public void imageBckgRepeatTest() throws IOException, InterruptedException {
47+
convertToPdfAndCompare("imageBckgRepeat", SOURCE_FOLDER, DESTINATION_FOLDER);
48+
}
49+
50+
@Test
51+
//TODO: DEVSIX-4370 update cmp file
52+
public void imageBckgNoRepeatTest() throws InterruptedException, IOException {
53+
convertToPdfAndCompare("imageBckgNoRepeat", SOURCE_FOLDER, DESTINATION_FOLDER);
54+
}
55+
56+
@Test
57+
//TODO: DEVSIX-4370 update cmp file
58+
public void imageBckgRoundTest() throws InterruptedException, IOException {
59+
convertToPdfAndCompare("imageBckgRound", SOURCE_FOLDER, DESTINATION_FOLDER);
60+
}
61+
62+
@Test
63+
//TODO: DEVSIX-4370 update cmp file
64+
public void imageBckgSpaceTest() throws InterruptedException, IOException {
65+
convertToPdfAndCompare("imageBckgSpace", SOURCE_FOLDER, DESTINATION_FOLDER);
66+
}
67+
68+
@Test
69+
//TODO: DEVSIX-4370 update cmp file
70+
public void imageBckgRepeatXTest() throws InterruptedException, IOException {
71+
convertToPdfAndCompare("imageBckgRepeatX", SOURCE_FOLDER, DESTINATION_FOLDER);
72+
}
73+
74+
@Test
75+
//TODO: DEVSIX-4370 update cmp file
76+
public void imageBckgRepeatYTest() throws InterruptedException, IOException {
77+
convertToPdfAndCompare("imageBckgRepeatY", SOURCE_FOLDER, DESTINATION_FOLDER);
78+
}
79+
80+
@Test
81+
//TODO: DEVSIX-4370 update cmp file
82+
public void linearGradientBckgRepeatTest() throws InterruptedException, IOException {
83+
convertToPdfAndCompare("linearGradientBckgRepeat", SOURCE_FOLDER, DESTINATION_FOLDER);
84+
}
85+
86+
@Test
87+
//TODO: DEVSIX-4370 update cmp file
88+
public void linearGradientBckgNoRepeatTest() throws InterruptedException, IOException {
89+
convertToPdfAndCompare("linearGradientBckgNoRepeat", SOURCE_FOLDER, DESTINATION_FOLDER);
90+
}
91+
92+
@Test
93+
//TODO: DEVSIX-4370 update cmp file
94+
public void linearGradientBckgRoundTest() throws IOException, InterruptedException {
95+
convertToPdfAndCompare("linearGradientBckgRound", SOURCE_FOLDER, DESTINATION_FOLDER);
96+
}
97+
98+
@Test
99+
//TODO: DEVSIX-1708 update cmp file
100+
public void linearGradientBckgSpaceTest() throws IOException, InterruptedException {
101+
convertToPdfAndCompare("linearGradientBckgSpace", SOURCE_FOLDER, DESTINATION_FOLDER);
102+
}
103+
104+
@Test
105+
//TODO: DEVSIX-4370 update cmp file
106+
public void linearGradientBckgRepeatXTest() throws IOException, InterruptedException {
107+
convertToPdfAndCompare("linearGradientBckgRepeatX", SOURCE_FOLDER, DESTINATION_FOLDER);
108+
}
109+
110+
@Test
111+
//TODO: DEVSIX-4370 update cmp file
112+
public void linearGradientBckgRepeatYTest() throws IOException, InterruptedException {
113+
convertToPdfAndCompare("linearGradientBckgRepeatY", SOURCE_FOLDER, DESTINATION_FOLDER);
114+
}
115+
116+
@Test
117+
//TODO: DEVSIX-4370 update cmp file
118+
public void imageBckgRepeatAndSpaceTest() throws IOException, InterruptedException {
119+
convertToPdfAndCompare("imageBckgRepeatAndSpace", SOURCE_FOLDER, DESTINATION_FOLDER);
120+
}
121+
122+
@Test
123+
//TODO: DEVSIX-4370 update cmp file
124+
public void imageBckgRoundAndSpaceTest() throws IOException, InterruptedException {
125+
convertToPdfAndCompare("imageBckgRoundAndSpace", SOURCE_FOLDER, DESTINATION_FOLDER);
126+
}
127+
128+
@Test
129+
//TODO: DEVSIX-4370 update cmp file
130+
public void bckgRepeatAndBckgPositionXTest() throws IOException, InterruptedException {
131+
convertToPdfAndCompare("bckgRepeatAndBckgPositionX", SOURCE_FOLDER, DESTINATION_FOLDER);
132+
}
133+
134+
@Test
135+
//TODO: DEVSIX-4370 update cmp file
136+
public void bckgRepeatAndBckgPositionYTest() throws IOException, InterruptedException {
137+
convertToPdfAndCompare("bckgRepeatAndBckgPositionY", SOURCE_FOLDER, DESTINATION_FOLDER);
138+
}
139+
140+
@Test
141+
//TODO: DEVSIX-4370 update cmp file
142+
public void bckgRoundSpaceAndBckgPositionXTest() throws IOException, InterruptedException {
143+
convertToPdfAndCompare("bckgRoundSpaceAndBckgPositionX", SOURCE_FOLDER, DESTINATION_FOLDER);
144+
}
145+
146+
@Test
147+
//TODO: DEVSIX-4370 update cmp file
148+
public void bckgSpaceRoundAndBckgPositionYTest() throws IOException, InterruptedException {
149+
convertToPdfAndCompare("bckgSpaceRoundAndBckgPositionY", SOURCE_FOLDER, DESTINATION_FOLDER);
150+
}
151+
152+
@Test
153+
//TODO: DEVSIX-4370 update cmp file
154+
public void bckgRepeatXAndBckgPositionYTest() throws IOException, InterruptedException {
155+
convertToPdfAndCompare("bckgRepeatXAndBckgPositionY", SOURCE_FOLDER, DESTINATION_FOLDER);
156+
}
157+
158+
@Test
159+
//TODO: DEVSIX-4370 update cmp file
160+
public void bckgRepeatYAndBckgPositionXTest() throws IOException, InterruptedException {
161+
convertToPdfAndCompare("bckgRepeatYAndBckgPositionX", SOURCE_FOLDER, DESTINATION_FOLDER);
162+
}
163+
164+
@Test
165+
//TODO: DEVSIX-4370 update cmp file
166+
public void bckgRoundAndBckgPositionTest() throws IOException, InterruptedException {
167+
convertToPdfAndCompare("bckgRoundAndBckgPosition", SOURCE_FOLDER, DESTINATION_FOLDER);
168+
}
169+
170+
@Test
171+
//TODO: DEVSIX-4370 update cmp file
172+
public void bckgRoundAndNegativeBckgPositionTest() throws IOException, InterruptedException {
173+
convertToPdfAndCompare("bckgRoundAndNegativeBckgPosition", SOURCE_FOLDER, DESTINATION_FOLDER);
174+
}
175+
176+
@Test
177+
//TODO: DEVSIX-4370 update cmp file
178+
public void bckgSpaceAndBckgPositionTest() throws IOException, InterruptedException {
179+
convertToPdfAndCompare("bckgSpaceAndBckgPosition", SOURCE_FOLDER, DESTINATION_FOLDER);
180+
}
181+
182+
@Test
183+
//TODO: DEVSIX-4370 update cmp file
184+
public void bckgSpaceAndBckgPositionPageSeparationTest() throws IOException, InterruptedException {
185+
convertToPdfAndCompare("bckgSpaceAndBckgPositionPageSeparation", SOURCE_FOLDER, DESTINATION_FOLDER);
186+
}
187+
188+
@Test
189+
//TODO: DEVSIX-4370 update cmp file
190+
public void bckgSpaceAndNegativeBckgPositionTest() throws IOException, InterruptedException {
191+
convertToPdfAndCompare("bckgSpaceAndNegativeBckgPosition", SOURCE_FOLDER, DESTINATION_FOLDER);
192+
}
193+
194+
@Test
195+
//TODO: DEVSIX-4370 update cmp file
196+
public void bckgRoundRemainsLessHalfOfImageTest() throws IOException, InterruptedException {
197+
convertToPdfAndCompare("bckgRoundRemainsLessHalfOfImage", SOURCE_FOLDER, DESTINATION_FOLDER);
198+
}
199+
200+
@Test
201+
//TODO: DEVSIX-4370 update cmp file
202+
public void bckgRoundRemainsMoreHalfOfImageTest() throws IOException, InterruptedException {
203+
convertToPdfAndCompare("bckgRoundRemainsMoreHalfOfImage", SOURCE_FOLDER, DESTINATION_FOLDER);
204+
}
205+
206+
@Test
207+
//TODO: DEVSIX-4370 update cmp file
208+
public void bckgRoundCompressAndStretchImageTest() throws IOException, InterruptedException {
209+
convertToPdfAndCompare("bckgRoundCompressAndStretchImage", SOURCE_FOLDER, DESTINATION_FOLDER);
210+
}
211+
212+
@Test
213+
//TODO: DEVSIX-4370 update cmp file
214+
public void imageBckgRoundBckgSizeLessThanImageTest() throws IOException, InterruptedException {
215+
convertToPdfAndCompare("imageBckgRoundBckgSizeLessThanImage", SOURCE_FOLDER, DESTINATION_FOLDER);
216+
}
217+
218+
@Test
219+
//TODO: DEVSIX-4370 update cmp file
220+
public void imageBckgSpaceBckgSizeLessThanImageTest() throws IOException, InterruptedException {
221+
convertToPdfAndCompare("imageBckgSpaceBckgSizeLessThanImage", SOURCE_FOLDER, DESTINATION_FOLDER);
222+
}
223+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>background-repeat and background-position-x</title>
6+
<style>
7+
div {
8+
background-color: green;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<p>Background-repeat: repeat</p>
14+
<p>Background-position-x: left</p>
15+
<div style="
16+
height: 500px;
17+
width: 500px;
18+
background-color: green;
19+
background-image: url(image.png);
20+
background-repeat: repeat;
21+
background-position-x: left;
22+
margin-bottom: 27em;">
23+
</div>
24+
<p>Background-position-x: right</p>
25+
<div style="
26+
height: 500px;
27+
width: 500px;
28+
background-image: url(image.png);
29+
background-repeat: repeat repeat;
30+
background-position-x: right;
31+
margin-bottom: 30em;">
32+
</div>
33+
<p>Background-position-x: center</p>
34+
<div style="
35+
height: 500px;
36+
width: 500px;
37+
background-image: url(image.png);
38+
background-repeat: repeat;
39+
background-position-x: center;">
40+
</div>
41+
</body>
42+
</html>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>background-repeat and background-position-y</title>
6+
<style>
7+
div {
8+
background-color: green;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<p>Background-repeat: repeat</p>
14+
<p>Background-position-y: top</p>
15+
<div style="
16+
height: 500px;
17+
width: 500px;
18+
background-image: url(image.png);
19+
background-repeat: repeat;
20+
background-position-y: top;
21+
margin-bottom: 27em;">
22+
</div>
23+
<p>Background-position-y: bottom</p>
24+
<div style="
25+
height: 500px;
26+
width: 500px;
27+
background-image: url(image.png);
28+
background-repeat: repeat repeat;
29+
background-position-y: bottom;
30+
margin-bottom: 30em;">
31+
</div>
32+
<p>Background-position-y: center</p>
33+
<div style="
34+
height: 500px;
35+
width: 500px;
36+
background-image: url(image.png);
37+
background-repeat: repeat;
38+
background-position-y: center;">
39+
</div>
40+
</body>
41+
</html>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>background-repeat and background-position-y</title>
6+
<style>
7+
div {
8+
background-color: green;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<p>Background-repeat: repeat-x</p>
14+
<p>Background-position-y: top</p>
15+
<div style="
16+
height: 550px;
17+
width: 500px;
18+
background-image: url(image.png);
19+
background-repeat: repeat-x;
20+
background-position-y: top;
21+
margin-bottom: 25em;">
22+
</div>
23+
<p>Background-position-y: bottom</p>
24+
<div style="
25+
height: 550px;
26+
width: 500px;
27+
background-image: url(image.png);
28+
background-repeat: repeat no-repeat;
29+
background-position-y: bottom;
30+
margin-bottom: 27em;">
31+
</div>
32+
<p>Background-position-y: center</p>
33+
<div style="
34+
height: 550px;
35+
width: 500px;
36+
background-image: url(image.png);
37+
background-repeat: repeat-x;
38+
background-position-y: center;">
39+
</div>
40+
</body>
41+
</html>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>background-repeat and background-position-x</title>
6+
<style>
7+
div {
8+
background-color: green;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<p>Background-repeat: repeat-y</p>
14+
<p>Background-position-x: left</p>
15+
<div style="
16+
height: 500px;
17+
width: 500px;
18+
background-image: url(image.png);
19+
background-repeat: repeat-y;
20+
background-position-x: left;
21+
margin-bottom: 27em;">
22+
</div>
23+
<p>Background-position-x: right</p>
24+
<div style="
25+
height: 500px;
26+
width: 500px;
27+
background-image: url(image.png);
28+
background-repeat: no-repeat repeat;
29+
background-position-x: right;
30+
margin-bottom: 30em;">
31+
</div>
32+
<p>Background-position-x: center</p>
33+
<div style="
34+
height: 500px;
35+
width: 500px;
36+
background-image: url(image.png);
37+
background-repeat: repeat-y;
38+
background-position-x: center;">
39+
</div>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)