Add Dense style for battery indicators

This commit is contained in:
James Babcock committed 2026-10-01 22:56:09 -07:00
1 parent 46fded856a
commit 566592c074
10 files changed
+309 -39

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { imageFromAsciiArt } = require('../.test-build/app/graphics/image.js');
test('imageFromAsciiArt maps characters through the palette', () => {
const image = imageFromAsciiArt(['#/.', ' _#'], { '#': 255, '/': 128, '_': 64 });
assert.equal(image.width, 3);
assert.equal(image.height, 2);
assert.deepEqual([...image.pixels], [255, 128, 0, 0, 64, 255]);
});
test('imageFromAsciiArt pads short lines and lets the palette override the background', () => {
const image = imageFromAsciiArt(['.#', '.'], { '#': 300, '.': 10 });
assert.deepEqual([...image.pixels], [10, 255, 10, 0]);
});
test('imageFromAsciiArt rejects characters missing from the palette', () => {
assert.throws(() => imageFromAsciiArt(['#x'], { '#': 255 }), /"x"/);
});