diff options
3 files changed, 14 insertions, 1 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFont.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFont.java index 251cf3257b..9553d595bb 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFont.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFont.java @@ -52,7 +52,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTVerticalAlignFontPr import org.openxmlformats.schemas.spreadsheetml.x2006.main.STFontScheme; import org.openxmlformats.schemas.spreadsheetml.x2006.main.STUnderlineValues; -public final class TestXSSFFont extends BaseTestFont{ +public final class TestXSSFFont extends BaseTestFont { public TestXSSFFont() { super(XSSFITestDataProvider.instance); diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java index b178263185..54390cb59a 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java @@ -89,6 +89,7 @@ public class HSSFExtendedColor extends ExtendedColor { byte[] rgba = new byte[4]; System.arraycopy(rgb, 0, rgba, 0, 3); rgba[3] = -1; + color.setRGBA(rgba); } else { // Shuffle from ARGB to RGBA byte a = rgb[0]; diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java index d8e1e6dde3..5d26099419 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestFont.java @@ -17,6 +17,7 @@ package org.apache.poi.ss.usermodel; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -27,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; +import org.apache.commons.codec.binary.Hex; import org.apache.poi.ss.ITestDataProvider; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -220,4 +222,14 @@ public abstract class BaseTestFont { ); } } + + @Test + void testRGBColor() throws Exception { + try (Workbook wb1 = _testDataProvider.createWorkbook()) { + String colorHex = "FFEB84"; + ExtendedColor color = wb1.getCreationHelper().createExtendedColor(); + color.setRGB(Hex.decodeHex(colorHex)); + assertArrayEquals(Hex.decodeHex(colorHex), color.getRGB()); + } + } } |