Permalink
Browse files

GraphicsUtils.getAlphaImage() returns black image for transparent input.

  • Loading branch information...
eseifert committed Aug 19, 2017
1 parent 59e97f7 commit 6979aa7a8139a0f36b3a6aab982be8596ad96ae5
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/test/java/de/erichseifert/vectorgraphics2d/util/GraphicsUtilsTest.java
@@ -422,4 +422,17 @@ public void getAlphaImageReturnsWhiteImageForInputWithoutAlphaChannel() {
g.fillRect(0, 0, expected.getWidth(), expected.getHeight());
assertBufferedImageContentEquals(expected, result);
}
@Test
public void getAlphaImageReturnsBlackImageForTransparentInput() {
BufferedImage image = new BufferedImage(3, 3, BufferedImage.TYPE_INT_ARGB);
BufferedImage result = GraphicsUtils.getAlphaImage(image);
BufferedImage expected = new BufferedImage(3, 3, BufferedImage.TYPE_BYTE_GRAY);
Graphics g = expected.getGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, expected.getWidth(), expected.getHeight());
assertBufferedImageContentEquals(expected, result);
}
}

0 comments on commit 6979aa7

Please sign in to comment.