Add palette size to test

This commit is contained in:
themode 2021-12-19 03:28:38 +01:00 committed by TheMode
parent 200c94c59e
commit c4190f544d

View File

@ -25,24 +25,32 @@ public class PaletteTest {
for (Palette palette : palettes) { for (Palette palette : palettes) {
final int dimension = palette.dimension(); final int dimension = palette.dimension();
assertEquals(0, palette.get(0, 0, 0), "Default value should be 0"); assertEquals(0, palette.get(0, 0, 0), "Default value should be 0");
assertEquals(0, palette.size());
palette.set(0, 0, 0, 64); palette.set(0, 0, 0, 64);
assertEquals(64, palette.get(0, 0, 0)); assertEquals(64, palette.get(0, 0, 0));
assertEquals(64, palette.get(dimension, 0, 0), "Coordinate must be rounded to the palette dimension"); assertEquals(64, palette.get(dimension, 0, 0), "Coordinate must be rounded to the palette dimension");
assertEquals(1, palette.size());
palette.set(1, 0, 0, 65); palette.set(1, 0, 0, 65);
assertEquals(64, palette.get(0, 0, 0)); assertEquals(64, palette.get(0, 0, 0));
assertEquals(65, palette.get(1, 0, 0)); assertEquals(65, palette.get(1, 0, 0));
assertEquals(2, palette.size());
palette.set(0, 1, 0, 66); palette.set(0, 1, 0, 66);
assertEquals(64, palette.get(0, 0, 0)); assertEquals(64, palette.get(0, 0, 0));
assertEquals(65, palette.get(1, 0, 0)); assertEquals(65, palette.get(1, 0, 0));
assertEquals(66, palette.get(0, 1, 0)); assertEquals(66, palette.get(0, 1, 0));
assertEquals(3, palette.size());
palette.set(0, 0, 1, 67); palette.set(0, 0, 1, 67);
assertEquals(64, palette.get(0, 0, 0)); assertEquals(64, palette.get(0, 0, 0));
assertEquals(65, palette.get(1, 0, 0)); assertEquals(65, palette.get(1, 0, 0));
assertEquals(66, palette.get(0, 1, 0)); assertEquals(66, palette.get(0, 1, 0));
assertEquals(67, palette.get(0, 0, 1)); assertEquals(67, palette.get(0, 0, 1));
assertEquals(4, palette.size());
palette.set(0, 0, 1, 68);
assertEquals(4, palette.size());
} }
} }