Skip to content

Commit 409d265

Browse files
committed
Add tests for SVG attributes/properties
DEVSIX-8742
1 parent 308fd5a commit 409d265

File tree

94 files changed

+1276
-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.

94 files changed

+1276
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2024 Apryse Group NV
4+
Authors: Apryse 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.svg.css;
24+
25+
import com.itextpdf.svg.renderers.SvgIntegrationTest;
26+
import com.itextpdf.test.ITextTest;
27+
28+
import java.io.IOException;
29+
import org.junit.jupiter.api.BeforeAll;
30+
import org.junit.jupiter.api.Tag;
31+
import org.junit.jupiter.api.Test;
32+
33+
@Tag("IntegrationTest")
34+
public class BaselineTest extends SvgIntegrationTest {
35+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/svg/css/BaselineTest/";
36+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/svg/css/BaselineTest/";
37+
38+
@BeforeAll
39+
public static void beforeClass() {
40+
ITextTest.createDestinationFolder(DESTINATION_FOLDER);
41+
}
42+
43+
@Test
44+
public void alignmentBaselineTest() throws IOException, InterruptedException {
45+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"alignment-base");
46+
}
47+
48+
@Test
49+
//TODO DEVSIX-2507: change cmp file after supporting
50+
public void baselineShiftTest() throws IOException, InterruptedException {
51+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"baseline-shift");
52+
}
53+
54+
@Test
55+
//TODO DEVSIX-5890: update cmp file after supporting
56+
public void dominantBaselineTest() throws IOException, InterruptedException {
57+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"dominant-baseline");
58+
}
59+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2024 Apryse Group NV
4+
Authors: Apryse 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.svg.css;
24+
25+
import com.itextpdf.svg.processors.impl.SvgConverterProperties;
26+
import com.itextpdf.svg.renderers.SvgIntegrationTest;
27+
import com.itextpdf.test.ITextTest;
28+
29+
import java.io.IOException;
30+
import org.junit.jupiter.api.BeforeAll;
31+
import org.junit.jupiter.api.Tag;
32+
import org.junit.jupiter.api.Test;
33+
34+
@Tag("IntegrationTest")
35+
public class ColorTest extends SvgIntegrationTest {
36+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/svg/css/ColorTest/";
37+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/svg/css/ColorTest/";
38+
39+
@BeforeAll
40+
public static void beforeClass() {
41+
ITextTest.createDestinationFolder(DESTINATION_FOLDER);
42+
}
43+
44+
@Test
45+
//TODO DEVSIX-7156: update cmp file after supporting
46+
public void backgroundColorTest() throws IOException, InterruptedException {
47+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"background-color");
48+
}
49+
50+
@Test
51+
//TODO DEVSIX-8758: update cmp file after supporting
52+
public void currentColorTest() throws IOException, InterruptedException {
53+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"current-color");
54+
}
55+
56+
@Test
57+
public void interpolationColorTest() throws IOException, InterruptedException {
58+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-interpolation");
59+
}
60+
61+
@Test
62+
public void interpolationFilterColorTest() throws IOException, InterruptedException {
63+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-interpolation-filter");
64+
}
65+
66+
@Test
67+
//TODO DEVSIX-2259: update cmp after supporting
68+
public void colorProfileTest() throws IOException, InterruptedException {
69+
SvgConverterProperties properties = new SvgConverterProperties()
70+
.setBaseUri(SOURCE_FOLDER);
71+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-profile", properties);
72+
}
73+
74+
@Test
75+
//TODO DEVSIX-8748: update cmp files after supporting
76+
public void colorTypesTest() throws IOException, InterruptedException {
77+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-types");
78+
}
79+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2024 Apryse Group NV
4+
Authors: Apryse 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.svg.css;
24+
25+
import com.itextpdf.svg.renderers.SvgIntegrationTest;
26+
import com.itextpdf.test.ITextTest;
27+
28+
import java.io.IOException;
29+
import org.junit.jupiter.api.BeforeAll;
30+
import org.junit.jupiter.api.Tag;
31+
import org.junit.jupiter.api.Test;
32+
33+
@Tag("IntegrationTest")
34+
public class DirectionTest extends SvgIntegrationTest {
35+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/svg/css/DirectionTest/";
36+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/svg/css/DirectionTest/";
37+
38+
@BeforeAll
39+
public static void beforeClass() {
40+
ITextTest.createDestinationFolder(DESTINATION_FOLDER);
41+
}
42+
43+
@Test
44+
//TODO DEVSIX-8779: update cmp file after supporting
45+
public void directionAttributeTest() throws IOException, InterruptedException {
46+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"direction");
47+
}
48+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2024 Apryse Group NV
4+
Authors: Apryse 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.svg.css;
24+
25+
import com.itextpdf.svg.logs.SvgLogMessageConstant;
26+
import com.itextpdf.svg.renderers.SvgIntegrationTest;
27+
import com.itextpdf.test.ITextTest;
28+
import com.itextpdf.test.annotations.LogMessage;
29+
import com.itextpdf.test.annotations.LogMessages;
30+
31+
import java.io.IOException;
32+
import org.junit.jupiter.api.BeforeAll;
33+
import org.junit.jupiter.api.Tag;
34+
import org.junit.jupiter.api.Test;
35+
36+
@Tag("IntegrationTest")
37+
public class DisplayTest extends SvgIntegrationTest {
38+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/svg/css/DisplayTest/";
39+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/svg/css/DisplayTest/";
40+
41+
@BeforeAll
42+
public static void beforeClass() {
43+
ITextTest.createDestinationFolder(DESTINATION_FOLDER);
44+
}
45+
46+
@Test
47+
@LogMessages(messages = {
48+
@LogMessage(messageTemplate = SvgLogMessageConstant.UNMAPPED_TAG)
49+
})
50+
public void displayAttributeTest() throws IOException, InterruptedException {
51+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"display");
52+
}
53+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2024 Apryse Group NV
4+
Authors: Apryse 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.svg.css;
24+
25+
import com.itextpdf.svg.renderers.SvgIntegrationTest;
26+
import com.itextpdf.test.ITextTest;
27+
28+
import java.io.IOException;
29+
import org.junit.jupiter.api.BeforeAll;
30+
import org.junit.jupiter.api.Tag;
31+
import org.junit.jupiter.api.Test;
32+
33+
@Tag("IntegrationTest")
34+
public class FilterTest extends SvgIntegrationTest {
35+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/svg/css/FilterTest/";
36+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/svg/css/FilterTest/";
37+
38+
@BeforeAll
39+
public static void beforeClass() {
40+
ITextTest.createDestinationFolder(DESTINATION_FOLDER);
41+
}
42+
43+
44+
@Test
45+
public void basicFilterTest() throws IOException, InterruptedException {
46+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"filter");
47+
}
48+
49+
@Test
50+
//TODO DEVSIX-8752: update cmp file after supporting
51+
public void feGaussianBlurTest() throws IOException, InterruptedException {
52+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"feGaussianBlur");
53+
}
54+
55+
@Test
56+
public void primitiveUnitsTest() throws IOException, InterruptedException {
57+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"primitive-units");
58+
}
59+
60+
@Test
61+
public void radiusTest() throws IOException, InterruptedException {
62+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"radius");
63+
}
64+
65+
@Test
66+
public void floodAttributeTest() throws IOException, InterruptedException {
67+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"flood");
68+
}
69+
70+
@Test
71+
public void lightingColorTest() throws IOException, InterruptedException {
72+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"lighting-color");
73+
}
74+
}

0 commit comments

Comments
 (0)