Skip to content

Commit 862fac8

Browse files
committed
SVG: Fix currentColor handling
DEVSIX-8886
1 parent 903b8df commit 862fac8

File tree

4 files changed

+38
-27
lines changed

4 files changed

+38
-27
lines changed

svg/src/main/java/com/itextpdf/svg/renderers/impl/AbstractSvgNodeRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ private TransparentColor getColorFromAttributeValue(SvgDrawContext context, Stri
547547
if (rawColorValue == null) {
548548
return null;
549549
}
550-
if (CommonCssConstants.CURRENTCOLOR.equals(rawColorValue)) {
550+
if (CommonCssConstants.CURRENTCOLOR.equals(rawColorValue.toLowerCase())) {
551551
rawColorValue = getAttributeOrDefault(CommonCssConstants.COLOR, "black");
552552
}
553553
CssDeclarationValueTokenizer tokenizer = new CssDeclarationValueTokenizer(rawColorValue);

svg/src/test/java/com/itextpdf/svg/css/ColorTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ This file is part of the iText (R) project.
2727
import com.itextpdf.test.ITextTest;
2828

2929
import java.io.IOException;
30+
3031
import org.junit.jupiter.api.BeforeAll;
3132
import org.junit.jupiter.api.Tag;
3233
import org.junit.jupiter.api.Test;
@@ -43,35 +44,35 @@ public static void beforeClass() {
4344

4445
@Test
4546
public void backgroundColorTest() throws IOException, InterruptedException {
46-
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"background-color");
47+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "background-color");
4748
}
4849

4950
@Test
5051
public void currentColorTest() throws IOException, InterruptedException {
51-
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"current-color");
52+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "current-color");
5253
}
5354

5455
@Test
5556
public void interpolationColorTest() throws IOException, InterruptedException {
56-
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-interpolation");
57+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "color-interpolation");
5758
}
5859

5960
@Test
6061
public void interpolationFilterColorTest() throws IOException, InterruptedException {
61-
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-interpolation-filter");
62+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "color-interpolation-filter");
6263
}
6364

6465
@Test
6566
//TODO DEVSIX-2259: update cmp after supporting
6667
public void colorProfileTest() throws IOException, InterruptedException {
6768
SvgConverterProperties properties = new SvgConverterProperties()
6869
.setBaseUri(SOURCE_FOLDER);
69-
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-profile", properties);
70+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "color-profile", properties);
7071
}
7172

7273
@Test
7374
//TODO DEVSIX-8748: update cmp files after supporting
7475
public void colorTypesTest() throws IOException, InterruptedException {
75-
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER,"color-types");
76+
convertAndCompareSinglePage(SOURCE_FOLDER, DESTINATION_FOLDER, "color-types");
7677
}
7778
}
Binary file not shown.
Lines changed: 30 additions & 20 deletions
Loading

0 commit comments

Comments
 (0)