Mercurial > hg > openjdk > jdk8u > jdk
changeset 13431:da66807df40f
8212914: Test javax/imageio/plugins/bmp/BMP8BPPLoadTest.java fails
Summary: replaced bmp test file with data array
Reviewed-by: psadhukhan, jdv
author | fmatte |
---|---|
date | Wed, 05 Dec 2018 03:51:45 -0500 |
parents | ce8578e6c45a |
children | 054e78a0d4d6 |
files | test/javax/imageio/plugins/bmp/BMP8BPPLoadTest.java |
diffstat | 1 files changed, 44 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/test/javax/imageio/plugins/bmp/BMP8BPPLoadTest.java Wed Oct 31 16:02:43 2018 +0100 +++ b/test/javax/imageio/plugins/bmp/BMP8BPPLoadTest.java Wed Dec 05 03:51:45 2018 -0500 @@ -23,26 +23,23 @@ /** * @test - * @bug 8182461 + * @bug 8182461 8212914 * @summary Test verifies that the 8BPP indexed color BMP image file is read properly - * @requires BMP8BPPLoadTest.PNG * @run main BMP8BPPLoadTest - * @author fairoz.matte */ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.io.ByteArrayInputStream; import javax.imageio.ImageIO; - public class BMP8BPPLoadTest { public BMP8BPPLoadTest() throws IOException { try { - BufferedImage image = ImageIO.read(new File("BMP8BPPLoadTest.bmp")); - System.out.println("Test Passed ImageIO.read able to read the file"); + ImageIO.read(ImageIO.createImageInputStream(new ByteArrayInputStream(BMP8BPPIMAGE))); } catch (IndexOutOfBoundsException iobe) { - System.out.println("Test Failed with ImageIO.read throwing IndexOutOfBoundsException"); + throw new RuntimeException("Test failed: ImageIO.read throwing IndexOutOfBoundsException"); } } @@ -50,4 +47,44 @@ public static void main(String args[]) throws IOException{ BMP8BPPLoadTest test = new BMP8BPPLoadTest(); } + + public static byte[] BMP8BPPIMAGE = { + (byte)0x42, (byte)0x4d, (byte)0x1a, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0xca, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x7c, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x0f, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0a, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x50, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x13, (byte)0x0b, + (byte)0x00, (byte)0x00, (byte)0x13, (byte)0x0b, (byte)0x00, (byte)0x00, (byte)0x10, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x10, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0xff, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x42, (byte)0x47, + (byte)0x52, (byte)0x73, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0xc0, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x00, (byte)0xff, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x40, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0xff, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0xfc, (byte)0x00, (byte)0x00, (byte)0xff, + (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x00, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, (byte)0x11, + (byte)0x11, (byte)0x10 + }; }