MCPcopy Create free account
hub / github.com/JetBrains/skija / execute

Method execute

tests/java/ColorTest.java:12–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11public class ColorTest implements Executable {
12 @Override
13 public void execute() throws Exception {
14 Map<Integer, Color4f> cases = new HashMap<>();
15 cases.put(0x00000000, new Color4f(0, 0, 0, 0));
16 cases.put(0xFF000000, new Color4f(0, 0, 0, 1));
17 cases.put(0x00FF0000, new Color4f(1, 0, 0, 0));
18 cases.put(0x0000FF00, new Color4f(0, 1, 0, 0));
19 cases.put(0x000000FF, new Color4f(0, 0, 1, 0));
20 cases.put(0x80808080, new Color4f(128/255f, 128/255f, 128/255f, 128/255f));
21
22 for (var entry: cases.entrySet()) {
23 int color = entry.getKey();
24 Color4f color4f = entry.getValue();
25 pushStack(Integer.toString(color, 16) + " <-> " + color4f);
26 assertEquals(color, color4f.toColor());
27 assertEquals(new Color4f(color), color4f);
28 popStack();
29 }
30
31 assertEquals(0x12, Color.getA(0x12345678));
32 assertEquals(0x34, Color.getR(0x12345678));
33 assertEquals(0x56, Color.getG(0x12345678));
34 assertEquals(0x78, Color.getB(0x12345678));
35 assertEquals(0xFE345678, Color.withA(0x12345678, 0xFE));
36 assertEquals(0x12FE5678, Color.withR(0x12345678, 0xFE));
37 assertEquals(0x1234FE78, Color.withG(0x12345678, 0xFE));
38 assertEquals(0x123456FE, Color.withB(0x12345678, 0xFE));
39 }
40}

Callers

nothing calls this directly

Calls 13

toColorMethod · 0.95
getAMethod · 0.95
getRMethod · 0.95
getGMethod · 0.95
getBMethod · 0.95
withAMethod · 0.95
withRMethod · 0.95
withGMethod · 0.95
withBMethod · 0.95
pushStackMethod · 0.80
assertEqualsMethod · 0.80
popStackMethod · 0.80

Tested by

no test coverage detected