mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-29 13:03:11 +00:00
Add Dense style for battery indicators
This commit is contained in:
1 parent
46fded856a
commit
566592c074
10 files changed
+309
-39
No files matched your search
@@ -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"/);
|
||||
});
|
||||
Reference in new issue
Block a user