MCPcopy Create free account
hub / github.com/HumbleUI/Skija / base

Method base

tests/java/BitmapTest.java:19–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17 }
18
19 public void base() throws Exception {
20 try (var bitmap = new Bitmap()) {
21 int id1 = bitmap.getGenerationId();
22 assertEquals(true, bitmap.isNull());
23 assertEquals(true, bitmap.isEmpty());
24
25 bitmap.allocPixels(ImageInfo.makeS32(7, 3, ColorAlphaType.OPAQUE));
26 assertNotEquals(id1, bitmap.getGenerationId());
27
28 assertEquals(false, bitmap.isNull());
29 assertEquals(false, bitmap.isEmpty());
30
31 assertEquals(7L * 4, bitmap.getRowBytes());
32 assertEquals(4, bitmap.getBytesPerPixel());
33 assertEquals(7, bitmap.getRowBytesAsPixels());
34
35 bitmap.allocPixels(ImageInfo.makeS32(7, 3, ColorAlphaType.OPAQUE), 32);
36 assertEquals(32L, bitmap.getRowBytes());
37 assertEquals(4, bitmap.getBytesPerPixel());
38 assertEquals(8, bitmap.getRowBytesAsPixels());
39
40 bitmap.setImageInfo(ImageInfo.makeS32(7, 3, ColorAlphaType.OPAQUE));
41 assertEquals(true, bitmap.isNull());
42 assertEquals(false, bitmap.isEmpty());
43 assertEquals(false, bitmap.isReadyToDraw());
44 bitmap.allocPixels();
45 assertEquals(false, bitmap.isNull());
46 assertEquals(true, bitmap.isReadyToDraw());
47
48 bitmap.getGenerationId();
49 }
50 }
51
52 public void swap() throws Exception {
53 try (Bitmap a = new Bitmap(); Bitmap b = new Bitmap()) {

Callers

nothing calls this directly

Calls 12

makeS32Method · 0.95
assertEqualsMethod · 0.80
isNullMethod · 0.80
allocPixelsMethod · 0.80
assertNotEqualsMethod · 0.80
setImageInfoMethod · 0.80
isReadyToDrawMethod · 0.80
isEmptyMethod · 0.65
getBytesPerPixelMethod · 0.65
getGenerationIdMethod · 0.45
getRowBytesMethod · 0.45
getRowBytesAsPixelsMethod · 0.45

Tested by

no test coverage detected