| 8 | import org.jetbrains.skija.test.runner.*; |
| 9 | |
| 10 | public class BitmapTest implements Executable { |
| 11 | @Override |
| 12 | public void execute() throws Exception { |
| 13 | try (var bitmap = new Bitmap()) { |
| 14 | int id1 = bitmap.getGenerationId(); |
| 15 | assertEquals(true, bitmap.isNull()); |
| 16 | assertEquals(true, bitmap.isEmpty()); |
| 17 | |
| 18 | bitmap.allocPixels(ImageInfo.makeS32(7, 3, ColorAlphaType.OPAQUE)); |
| 19 | assertNotEquals(id1, bitmap.getGenerationId()); |
| 20 | |
| 21 | assertEquals(false, bitmap.isNull()); |
| 22 | assertEquals(false, bitmap.isEmpty()); |
| 23 | |
| 24 | assertEquals(7L * 4, bitmap.getRowBytes()); |
| 25 | assertEquals(4, bitmap.getBytesPerPixel()); |
| 26 | assertEquals(7, bitmap.getRowBytesAsPixels()); |
| 27 | |
| 28 | bitmap.allocPixels(ImageInfo.makeS32(7, 3, ColorAlphaType.OPAQUE), 32); |
| 29 | assertEquals(32L, bitmap.getRowBytes()); |
| 30 | assertEquals(4, bitmap.getBytesPerPixel()); |
| 31 | assertEquals(8, bitmap.getRowBytesAsPixels()); |
| 32 | |
| 33 | bitmap.setImageInfo(ImageInfo.makeS32(7, 3, ColorAlphaType.OPAQUE)); |
| 34 | assertEquals(true, bitmap.isNull()); |
| 35 | assertEquals(false, bitmap.isEmpty()); |
| 36 | assertEquals(false, bitmap.isReadyToDraw()); |
| 37 | bitmap.allocPixels(); |
| 38 | assertEquals(false, bitmap.isNull()); |
| 39 | assertEquals(true, bitmap.isReadyToDraw()); |
| 40 | |
| 41 | |
| 42 | bitmap.getGenerationId(); |
| 43 | |
| 44 | } |
| 45 | } |
| 46 | } |
nothing calls this directly
no outgoing calls
no test coverage detected