1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.imaging.formats.jpeg.specific;
18
19 import static org.junit.jupiter.api.Assertions.assertEquals;
20
21 import java.awt.image.BufferedImage;
22 import java.io.File;
23 import java.io.IOException;
24
25 import org.apache.commons.imaging.ImagingException;
26 import org.apache.commons.imaging.bytesource.ByteSource;
27 import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
28 import org.apache.commons.imaging.test.TestResources;
29 import org.junit.jupiter.api.Test;
30
31
32
33
34 public class JpegImageParserTest {
35
36
37
38
39
40
41 @Test
42 public void testGetBufferedImage10() throws ImagingException, IOException {
43 final File imageFile = TestResources.resourceToFile("/IMAGING-136/1402522741337.jpg");
44 final JpegImageParser parser = new JpegImageParser();
45 final BufferedImage image = parser.getBufferedImage(ByteSource.file(imageFile), null);
46 assertEquals(680, image.getWidth());
47 assertEquals(241, image.getHeight());
48 assertEquals(-16777216, image.getRGB(0, 0));
49 assertEquals(-12177367, image.getRGB(198, 13));
50 }
51 }