1
0
Fork 0

Initial commit

This commit is contained in:
Henrik Hautakoski 2026-04-22 16:41:48 +02:00
commit 3304b53c41
38 changed files with 6573 additions and 0 deletions

View file

@ -0,0 +1,16 @@
<?php
use Doom\Picture\Palette;
test('creates palette from bytes and roundtrips', function (): void {
$bytes = str_repeat("\x01\x02\x03", 256);
$palette = Palette::fromBytes($bytes);
expect($palette->colorAt(0))->toBe([1, 2, 3]);
expect($palette->colorAt(255))->toBe([1, 2, 3]);
expect($palette->toBytes())->toBe($bytes);
});
test('rejects invalid palette byte length', function (): void {
expect(fn () => Palette::fromBytes("\x00"))->toThrow(InvalidArgumentException::class);
});