Changeset 13397 in josm for trunk/test/unit/org
- Timestamp:
- 2018-02-10T00:13:49+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/ColorfulImageProcessorTest.java
r10547 r13397 8 8 import java.awt.Graphics2D; 9 9 import java.awt.image.BufferedImage; 10 import java.awt.image.DataBuffer; 11 import java.awt.image.IndexColorModel; 10 12 11 13 import org.junit.Rule; … … 22 24 23 25 private static final int TEST_IMAGE_SIZE = 5; 26 27 private static final int[] PALETTE = { 28 Color.BLACK.getRGB(), 29 Color.WHITE.getRGB(), 30 Color.GRAY.getRGB(), 31 Color.GREEN.getRGB(), 32 Color.RED.getRGB(), 33 Color.BLUE.getRGB(), 34 0xff908050, 35 0xff908070, 36 0xff908070, 37 0xff908070, 38 0xfff02080, 39 }; 40 41 private static final IndexColorModel COLOR_MODEL = new IndexColorModel(8, PALETTE.length, PALETTE, 0, true, 255, DataBuffer.TYPE_BYTE); 24 42 25 43 /** … … 79 97 BufferedImage.TYPE_3BYTE_BGR, 80 98 BufferedImage.TYPE_4BYTE_ABGR, 81 BufferedImage.TYPE_4BYTE_ABGR_PRE }) { 99 BufferedImage.TYPE_4BYTE_ABGR_PRE, 100 BufferedImage.TYPE_BYTE_INDEXED }) { 82 101 assertTrue(runProcessing(data, type)); 83 102 } … … 104 123 105 124 private BufferedImage createImage(Color color, int type) { 106 BufferedImage image = new BufferedImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, type); 125 BufferedImage image = type == BufferedImage.TYPE_BYTE_INDEXED 126 ? new BufferedImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, type, COLOR_MODEL) 127 : new BufferedImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, type); 107 128 Graphics2D graphics = image.createGraphics(); 108 129 graphics.setColor(color); 109 130 graphics.fillRect(0, 0, TEST_IMAGE_SIZE, TEST_IMAGE_SIZE); 131 assertEquals(color.getRGB(), image.getRGB(1, 1)); 110 132 return image; 111 133 }
Note:
See TracChangeset
for help on using the changeset viewer.