MCPcopy Index your code
hub / github.com/JetBrains/skija / BitmapTest

Class BitmapTest

tests/java/BitmapTest.java:10–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import org.jetbrains.skija.test.runner.*;
9
10public 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected