// Decode tests for the JPEG / PNG / GIF / TGA codecs.
//
// Generated by .tools/gen_codec_tests.py — do not edit by hand.
// Each `fixture_*` fn returns the byte-for-byte file read from
// testdata/, so the tests need no filesystem access at run time.
//
// These four codecs previously had NO decode coverage: lib_test.mbt
// only exercised ICO, TIFF and FIM through a `decode_*` entry point.
// The fixtures are the real files, so a decoder that silently produces
// the wrong size, the wrong pixel format, or garbage pixels now fails
// here instead of in a downstream project.
//
// The assertions check structural properties (dimensions, pixel format,
// palette expansion, frame count, transparency) rather than hard-coded
// pixel values: a correct decoder always satisfies them, and they still
// catch the regressions that matter (wrong stride, wrong colour type,
// dropped alpha, mis-ordered rows).

///|
/// PNG 1x1 RGBA8 (testdata/png/png_tiny_1x1_rgba.png, 70 bytes)
fn fixture_png_tiny_1x1_rgba() -> Bytes {
  b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\x1f\x15\xc4\x89\x00\x00\x00\x0d\x49\x44\x41\x54\x78\x9c\x63\xf8\xcf\xc0\xf0\x1f\x00\x05\x00\x01\xff\x89\x99\x3d\x1d\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"
}

///|
/// PNG 16x16 indexed (testdata/png/png_palette_16x16.png, 1120 bytes)
fn fixture_png_palette_16x16() -> Bytes {
  b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x10\x00\x00\x00\x10\x08\x03\x00\x00\x00\x28\x2d\x0f\x53\x00\x00\x03\x00\x50\x4c\x54\x45\x00\xff\x00\x01\xfe\x03\x02\xfd\x06\x03\xfc\x09\x04\xfb\x0c\x05\xfa\x0f\x06\xf9\x12\x07\xf8\x15\x08\xf7\x18\x09\xf6\x1b\x0a\xf5\x1e\x0b\xf4\x21\x0c\xf3\x24\x0d\xf2\x27\x0e\xf1\x2a\x0f\xf0\x2d\x10\xef\x30\x11\xee\x33\x12\xed\x36\x13\xec\x39\x14\xeb\x3c\x15\xea\x3f\x16\xe9\x42\x17\xe8\x45\x18\xe7\x48\x19\xe6\x4b\x1a\xe5\x4e\x1b\xe4\x51\x1c\xe3\x54\x1d\xe2\x57\x1e\xe1\x5a\x1f\xe0\x5d\x20\xdf\x60\x21\xde\x63\x22\xdd\x66\x23\xdc\x69\x24\xdb\x6c\x25\xda\x6f\x26\xd9\x72\x27\xd8\x75\x28\xd7\x78\x29\xd6\x7b\x2a\xd5\x7e\x2b\xd4\x81\x2c\xd3\x84\x2d\xd2\x87\x2e\xd1\x8a\x2f\xd0\x8d\x30\xcf\x90\x31\xce\x93\x32\xcd\x96\x33\xcc\x99\x34\xcb\x9c\x35\xca\x9f\x36\xc9\xa2\x37\xc8\xa5\x38\xc7\xa8\x39\xc6\xab\x3a\xc5\xae\x3b\xc4\xb1\x3c\xc3\xb4\x3d\xc2\xb7\x3e\xc1\xba\x3f\xc0\xbd\x40\xbf\xc0\x41\xbe\xc3\x42\xbd\xc6\x43\xbc\xc9\x44\xbb\xcc\x45\xba\xcf\x46\xb9\xd2\x47\xb8\xd5\x48\xb7\xd8\x49\xb6\xdb\x4a\xb5\xde\x4b\xb4\xe1\x4c\xb3\xe4\x4d\xb2\xe7\x4e\xb1\xea\x4f\xb0\xed\x50\xaf\xf0\x51\xae\xf3\x52\xad\xf6\x53\xac\xf9\x54\xab\xfc\x55\xaa\xff\x56\xa9\x02\x57\xa8\x05\x58\xa7\x08\x59\xa6\x0b\x5a\xa5\x0e\x5b\xa4\x11\x5c\xa3\x14\x5d\xa2\x17\x5e\xa1\x1a\x5f\xa0\x1d\x60\x9f\x20\x61\x9e\x23\x62\x9d\x26\x63\x9c\x29\x64\x9b\x2c\x65\x9a\x2f\x66\x99\x32\x67\x98\x35\x68\x97\x38\x69\x96\x3b\x6a\x95\x3e\x6b\x94\x41\x6c\x93\x44\x6d\x92\x47\x6e\x91\x4a\x6f\x90\x4d\x70\x8f\x50\x71\x8e\x53\x72\x8d\x56\x73\x8c\x59\x74\x8b\x5c\x75\x8a\x5f\x76\x89\x62\x77\x88\x65\x78\x87\x68\x79\x86\x6b\x7a\x85\x6e\x7b\x84\x71\x7c\x83\x74\x7d\x82\x77\x7e\x81\x7a\x7f\x80\x7d\x80\x7f\x80\x81\x7e\x83\x82\x7d\x86\x83\x7c\x89\x84\x7b\x8c\x85\x7a\x8f\x86\x79\x92\x87\x78\x95\x88\x77\x98\x89\x76\x9b\x8a\x75\x9e\x8b\x74\xa1\x8c\x73\xa4\x8d\x72\xa7\x8e\x71\xaa\x8f\x70\xad\x90\x6f\xb0\x91\x6e\xb3\x92\x6d\xb6\x93\x6c\xb9\x94\x6b\xbc\x95\x6a\xbf\x96\x69\xc2\x97\x68\xc5\x98\x67\xc8\x99\x66\xcb\x9a\x65\xce\x9b\x64\xd1\x9c\x63\xd4\x9d\x62\xd7\x9e\x61\xda\x9f\x60\xdd\xa0\x5f\xe0\xa1\x5e\xe3\xa2\x5d\xe6\xa3\x5c\xe9\xa4\x5b\xec\xa5\x5a\xef\xa6\x59\xf2\xa7\x58\xf5\xa8\x57\xf8\xa9\x56\xfb\xaa\x55\xfe\xab\x54\x01\xac\x53\x04\xad\x52\x07\xae\x51\x0a\xaf\x50\x0d\xb0\x4f\x10\xb1\x4e\x13\xb2\x4d\x16\xb3\x4c\x19\xb4\x4b\x1c\xb5\x4a\x1f\xb6\x49\x22\xb7\x48\x25\xb8\x47\x28\xb9\x46\x2b\xba\x45\x2e\xbb\x44\x31\xbc\x43\x34\xbd\x42\x37\xbe\x41\x3a\xbf\x40\x3d\xc0\x3f\x40\xc1\x3e\x43\xc2\x3d\x46\xc3\x3c\x49\xc4\x3b\x4c\xc5\x3a\x4f\xc6\x39\x52\xc7\x38\x55\xc8\x37\x58\xc9\x36\x5b\xca\x35\x5e\xcb\x34\x61\xcc\x33\x64\xcd\x32\x67\xce\x31\x6a\xcf\x30\x6d\xd0\x2f\x70\xd1\x2e\x73\xd2\x2d\x76\xd3\x2c\x79\xd4\x2b\x7c\xd5\x2a\x7f\xd6\x29\x82\xd7\x28\x85\xd8\x27\x88\xd9\x26\x8b\xda\x25\x8e\xdb\x24\x91\xdc\x23\x94\xdd\x22\x97\xde\x21\x9a\xdf\x20\x9d\xe0\x1f\xa0\xe1\x1e\xa3\xe2\x1d\xa6\xe3\x1c\xa9\xe4\x1b\xac\xe5\x1a\xaf\xe6\x19\xb2\xe7\x18\xb5\xe8\x17\xb8\xe9\x16\xbb\xea\x15\xbe\xeb\x14\xc1\xec\x13\xc4\xed\x12\xc7\xee\x11\xca\xef\x10\xcd\xf0\x0f\xd0\xf1\x0e\xd3\xf2\x0d\xd6\xf3\x0c\xd9\xf4\x0b\xdc\xf5\x0a\xdf\xf6\x09\xe2\xf7\x08\xe5\xf8\x07\xe8\xf9\x06\xeb\xfa\x05\xee\xfb\x04\xf1\xfc\x03\xf4\xfd\x02\xf7\xfe\x01\xfa\xff\x00\xfd\x4a\x70\xa7\x12\x00\x00\x01\x1b\x49\x44\x41\x54\x78\x9c\x01\x10\x01\xef\xfe\x00\x00\x10\x20\x30\x40\x50\x60\x70\x80\x90\xa0\xb0\xc0\xd0\xe0\xf0\x00\x01\x11\x21\x31\x41\x51\x61\x71\x81\x91\xa1\xb1\xc1\xd1\xe1\xf1\x00\x02\x12\x22\x32\x42\x52\x62\x72\x82\x92\xa2\xb2\xc2\xd2\xe2\xf2\x00\x03\x13\x23\x33\x43\x53\x63\x73\x83\x93\xa3\xb3\xc3\xd3\xe3\xf3\x00\x04\x14\x24\x34\x44\x54\x64\x74\x84\x94\xa4\xb4\xc4\xd4\xe4\xf4\x00\x05\x15\x25\x35\x45\x55\x65\x75\x85\x95\xa5\xb5\xc5\xd5\xe5\xf5\x00\x06\x16\x26\x36\x46\x56\x66\x76\x86\x96\xa6\xb6\xc6\xd6\xe6\xf6\x00\x07\x17\x27\x37\x47\x57\x67\x77\x87\x97\xa7\xb7\xc7\xd7\xe7\xf7\x00\x08\x18\x28\x38\x48\x58\x68\x78\x88\x98\xa8\xb8\xc8\xd8\xe8\xf8\x00\x09\x19\x29\x39\x49\x59\x69\x79\x89\x99\xa9\xb9\xc9\xd9\xe9\xf9\x00\x0a\x1a\x2a\x3a\x4a\x5a\x6a\x7a\x8a\x9a\xaa\xba\xca\xda\xea\xfa\x00\x0b\x1b\x2b\x3b\x4b\x5b\x6b\x7b\x8b\x9b\xab\xbb\xcb\xdb\xeb\xfb\x00\x0c\x1c\x2c\x3c\x4c\x5c\x6c\x7c\x8c\x9c\xac\xbc\xcc\xdc\xec\xfc\x00\x0d\x1d\x2d\x3d\x4d\x5d\x6d\x7d\x8d\x9d\xad\xbd\xcd\xdd\xed\xfd\x00\x0e\x1e\x2e\x3e\x4e\x5e\x6e\x7e\x8e\x9e\xae\xbe\xce\xde\xee\xfe\x00\x0f\x1f\x2f\x3f\x4f\x5f\x6f\x7f\x8f\x9f\xaf\xbf\xcf\xdf\xef\xff\x03\x9f\x7f\x81\xba\x7e\x7c\x27\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"
}

///|
/// PNG 32x32 RGBA8 (testdata/png/png_gradient_32x32_rgba.png, 127 bytes)
fn fixture_png_gradient_32x32() -> Bytes {
  b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x20\x00\x00\x00\x20\x08\x06\x00\x00\x00\x73\x7a\x7a\xf4\x00\x00\x00\x46\x49\x44\x41\x54\x78\x9c\xed\xd7\xb1\x0d\xc0\x30\x0c\x03\xc1\x0b\xc0\xc2\xfb\x2f\x9c\x8c\xe1\x22\x5f\xb0\x17\x20\x89\x7c\x3e\x78\x8f\xb9\xa5\x39\xc3\x3d\xad\x01\xb4\x82\xd3\x11\xae\x37\x94\x11\xc9\x8a\x15\x46\x2b\x8e\x05\x24\x42\x32\x41\xe9\xc2\x72\x15\x13\x55\x33\x3f\x2c\xa7\x1f\x03\x1c\x13\x69\x7e\x85\x84\x22\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"
}

///|
/// GIF 1x1 (testdata/gif/gif_tiny_1x1.gif, 43 bytes)
fn fixture_gif_tiny_1x1() -> Bytes {
  b"\x47\x49\x46\x38\x37\x61\x01\x00\x01\x00\x81\x00\x00\x2a\x2a\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x08\x04\x00\x01\x04\x04\x00\x3b"
}

///|
/// GIF 32x32 (testdata/gif/gif_palette_32x32.gif, 1528 bytes)
fn fixture_gif_palette_32x32() -> Bytes {
  b"\x47\x49\x46\x38\x37\x61\x20\x00\x20\x00\x87\x00\x00\x00\xff\x00\x01\xfe\x07\x02\xfd\x0e\x03\xfc\x15\x04\xfb\x1c\x05\xfa\x23\x06\xf9\x2a\x07\xf8\x31\x08\xf7\x38\x09\xf6\x3f\x0a\xf5\x46\x0b\xf4\x4d\x0c\xf3\x54\x0d\xf2\x5b\x0e\xf1\x62\x0f\xf0\x69\x10\xef\x70\x11\xee\x77\x12\xed\x7e\x13\xec\x85\x14\xeb\x8c\x15\xea\x93\x16\xe9\x9a\x17\xe8\xa1\x18\xe7\xa8\x19\xe6\xaf\x1a\xe5\xb6\x1b\xe4\xbd\x1c\xe3\xc4\x1d\xe2\xcb\x1e\xe1\xd2\x1f\xe0\xd9\x20\xdf\xe0\x21\xde\xe7\x22\xdd\xee\x23\xdc\xf5\x24\xdb\xfc\x25\xda\x03\x26\xd9\x0a\x27\xd8\x11\x28\xd7\x18\x29\xd6\x1f\x2a\xd5\x26\x2b\xd4\x2d\x2c\xd3\x34\x2d\xd2\x3b\x2e\xd1\x42\x2f\xd0\x49\x30\xcf\x50\x31\xce\x57\x32\xcd\x5e\x33\xcc\x65\x34\xcb\x6c\x35\xca\x73\x36\xc9\x7a\x37\xc8\x81\x38\xc7\x88\x39\xc6\x8f\x3a\xc5\x96\x3b\xc4\x9d\x3c\xc3\xa4\x3d\xc2\xab\x3e\xc1\xb2\x3f\xc0\xb9\x40\xbf\xc0\x41\xbe\xc7\x42\xbd\xce\x43\xbc\xd5\x44\xbb\xdc\x45\xba\xe3\x46\xb9\xea\x47\xb8\xf1\x48\xb7\xf8\x49\xb6\xff\x4a\xb5\x06\x4b\xb4\x0d\x4c\xb3\x14\x4d\xb2\x1b\x4e\xb1\x22\x4f\xb0\x29\x50\xaf\x30\x51\xae\x37\x52\xad\x3e\x53\xac\x45\x54\xab\x4c\x55\xaa\x53\x56\xa9\x5a\x57\xa8\x61\x58\xa7\x68\x59\xa6\x6f\x5a\xa5\x76\x5b\xa4\x7d\x5c\xa3\x84\x5d\xa2\x8b\x5e\xa1\x92\x5f\xa0\x99\x60\x9f\xa0\x61\x9e\xa7\x62\x9d\xae\x63\x9c\xb5\x64\x9b\xbc\x65\x9a\xc3\x66\x99\xca\x67\x98\xd1\x68\x97\xd8\x69\x96\xdf\x6a\x95\xe6\x6b\x94\xed\x6c\x93\xf4\x6d\x92\xfb\x6e\x91\x02\x6f\x90\x09\x70\x8f\x10\x71\x8e\x17\x72\x8d\x1e\x73\x8c\x25\x74\x8b\x2c\x75\x8a\x33\x76\x89\x3a\x77\x88\x41\x78\x87\x48\x79\x86\x4f\x7a\x85\x56\x7b\x84\x5d\x7c\x83\x64\x7d\x82\x6b\x7e\x81\x72\x7f\x80\x79\x80\x7f\x80\x81\x7e\x87\x82\x7d\x8e\x83\x7c\x95\x84\x7b\x9c\x85\x7a\xa3\x86\x79\xaa\x87\x78\xb1\x88\x77\xb8\x89\x76\xbf\x8a\x75\xc6\x8b\x74\xcd\x8c\x73\xd4\x8d\x72\xdb\x8e\x71\xe2\x8f\x70\xe9\x90\x6f\xf0\x91\x6e\xf7\x92\x6d\xfe\x93\x6c\x05\x94\x6b\x0c\x95\x6a\x13\x96\x69\x1a\x97\x68\x21\x98\x67\x28\x99\x66\x2f\x9a\x65\x36\x9b\x64\x3d\x9c\x63\x44\x9d\x62\x4b\x9e\x61\x52\x9f\x60\x59\xa0\x5f\x60\xa1\x5e\x67\xa2\x5d\x6e\xa3\x5c\x75\xa4\x5b\x7c\xa5\x5a\x83\xa6\x59\x8a\xa7\x58\x91\xa8\x57\x98\xa9\x56\x9f\xaa\x55\xa6\xab\x54\xad\xac\x53\xb4\xad\x52\xbb\xae\x51\xc2\xaf\x50\xc9\xb0\x4f\xd0\xb1\x4e\xd7\xb2\x4d\xde\xb3\x4c\xe5\xb4\x4b\xec\xb5\x4a\xf3\xb6\x49\xfa\xb7\x48\x01\xb8\x47\x08\xb9\x46\x0f\xba\x45\x16\xbb\x44\x1d\xbc\x43\x24\xbd\x42\x2b\xbe\x41\x32\xbf\x40\x39\xc0\x3f\x40\xc1\x3e\x47\xc2\x3d\x4e\xc3\x3c\x55\xc4\x3b\x5c\xc5\x3a\x63\xc6\x39\x6a\xc7\x38\x71\xc8\x37\x78\xc9\x36\x7f\xca\x35\x86\xcb\x34\x8d\xcc\x33\x94\xcd\x32\x9b\xce\x31\xa2\xcf\x30\xa9\xd0\x2f\xb0\xd1\x2e\xb7\xd2\x2d\xbe\xd3\x2c\xc5\xd4\x2b\xcc\xd5\x2a\xd3\xd6\x29\xda\xd7\x28\xe1\xd8\x27\xe8\xd9\x26\xef\xda\x25\xf6\xdb\x24\xfd\xdc\x23\x04\xdd\x22\x0b\xde\x21\x12\xdf\x20\x19\xe0\x1f\x20\xe1\x1e\x27\xe2\x1d\x2e\xe3\x1c\x35\xe4\x1b\x3c\xe5\x1a\x43\xe6\x19\x4a\xe7\x18\x51\xe8\x17\x58\xe9\x16\x5f\xea\x15\x66\xeb\x14\x6d\xec\x13\x74\xed\x12\x7b\xee\x11\x82\xef\x10\x89\xf0\x0f\x90\xf1\x0e\x97\xf2\x0d\x9e\xf3\x0c\xa5\xf4\x0b\xac\xf5\x0a\xb3\xf6\x09\xba\xf7\x08\xc1\xf8\x07\xc8\xf9\x06\xcf\xfa\x05\xd6\xfb\x04\xdd\xfc\x03\xe4\xfd\x02\xeb\xfe\x01\xf2\xff\x00\xf9\x2c\x00\x00\x00\x00\x20\x00\x20\x00\x40\x08\xff\x00\x01\x20\x80\x80\x01\x04\x0a\x18\x38\x80\x20\x81\x82\x05\x0c\x1a\x38\x78\x00\x21\x82\x84\x09\x14\x2a\x58\xb8\x80\x21\x83\x86\x0d\x1c\x3a\x78\xf8\x06\x16\x3c\x98\x70\x61\xc3\x87\x11\x27\x56\xbc\x98\x71\x63\xc7\x8f\xf8\x00\x10\x34\x88\x50\x21\x43\x87\x10\x25\x52\xb4\x88\x51\x23\x47\x8f\x20\x05\x8e\xac\x69\x12\x67\xca\x9d\x2c\x7d\xbe\x0c\x3a\x90\x00\x03\x0a\x1c\x48\xb0\xa0\xc1\x83\x08\x13\x2a\x5c\xc8\xb0\xa1\xc3\x87\x10\x23\x4a\x9c\x48\xb1\xa2\xc5\x8b\x18\x33\x6a\xdc\xc8\xb1\xa3\xc7\xef\x69\xd4\xa9\x55\xaf\x66\xdd\xda\xf5\x6b\xd8\xb1\x65\xcf\xa6\x5d\xcb\x8f\x00\x54\xa9\x54\xad\x62\xd5\xca\xd5\x2b\x58\xb1\x64\xcd\xa2\x55\xcb\xd6\xe9\xdb\xc0\x72\x09\xd7\x3d\x8c\x57\xf1\xde\xc6\x4f\x05\x28\x90\xa0\x41\x84\x0a\x19\x3a\x84\x28\x91\xa2\x45\x8c\x1a\x39\x7a\x04\x29\x92\xa4\x49\x94\x2a\x59\xba\x84\x29\x93\xa6\x4d\x9c\x3a\x79\xfa\x0c\x38\xb0\xe0\xc1\x84\x0b\x1b\x3e\x8c\x38\xb1\xe2\xc5\x8c\x1b\x3b\x7e\x0c\x39\xb2\xe4\xc9\x94\x2b\x5b\xbe\x8c\x39\xb3\xe6\xcd\x9c\x3b\x7b\xfe\x36\x77\xfe\x1c\x7a\x74\xe9\xd3\xa9\x57\xb7\xff\x7e\x1d\x7b\x76\xed\xdb\xfa\x04\xec\xee\xfd\x3b\xf8\xf0\xe2\xc7\x93\x2f\x6f\xfe\x3c\xfa\xf4\xea\xd7\xfd\x19\xe0\xec\x19\xb4\x68\xd2\xa6\xa1\xa6\x1a\x6b\xae\xc1\x26\x1b\x6d\xb6\xe1\xa6\x19\x6f\xbe\x01\x27\x1c\x71\xc6\x21\xa7\x1c\x73\xce\x41\x27\x1d\x75\xd6\x61\xa7\xdb\x76\xfe\x79\x17\x60\x78\x04\x92\x77\xe0\x79\x0a\x6e\xc6\x9e\x83\xef\x45\x28\x1f\x85\xf5\x5d\x88\x9f\x86\xbb\x05\x90\x40\x04\x19\x84\x90\x42\x0c\x39\x04\x91\x44\x14\x59\x84\x91\x46\x1c\x79\x04\x92\x48\x24\x99\x84\x92\x4a\x2c\xb9\x04\x93\x4c\x34\xd9\x84\x93\x4e\x3c\xf9\x0c\xb0\xc0\x04\x1b\x8c\xb0\xc2\x0c\x3b\x0c\xb1\xc4\x14\x5b\x8c\xb1\xc6\x1c\x7b\x0c\xb2\xc8\x24\x9b\x8c\xb2\xca\x2c\xbb\x0c\xb3\xcc\x34\xdb\x8c\xb3\xce\x3c\xfb\x14\xd0\x40\x05\x1d\x94\xd0\x42\x0d\x3d\x14\xd1\x44\x15\x5d\x94\xd1\x46\x1d\x7d\x14\xd2\x48\x25\x9d\x94\xd2\x4a\x2d\xbd\x14\xd3\x4c\x35\xdd\x94\xd3\x4e\x3d\xfd\x1c\xf0\xc0\x05\x1f\x9c\xf0\xc2\x0d\x3f\x1c\xf1\xc4\x15\x5f\x9c\xf1\xc6\x1d\x7f\x1c\xf2\xc8\x25\x9f\x9c\xf2\xca\x2d\xbf\x1c\xf3\xcc\x35\xdf\x9c\xf3\xce\x3d\xff\xcc\xdd\x58\xe3\x8d\x39\xee\xd8\xe3\x8f\x41\x0e\x59\xe4\x91\x49\x2e\xd9\xe4\x93\xf9\x04\x30\x65\x95\x57\x66\xb9\x65\x97\x5f\x86\x39\x66\x99\x67\xa6\xb9\x66\x9b\x6f\xee\x33\xc0\x9c\x75\xde\x99\xe7\x9e\x7d\xfe\x19\xe8\xa0\x85\x1e\x9a\xe8\xa2\x8d\x3e\xda\x4f\x01\x93\x56\x7a\x69\xa6\x9b\x76\xfa\x69\xa8\xa3\x96\x7a\x6a\xaa\xab\xb6\xfa\xea\x3f\x07\xd0\x68\x23\x8e\x3a\xf2\xe8\x23\x90\x42\x12\x69\x24\x92\x4a\x32\xe9\x24\x94\x32\x52\x69\x25\x96\x5a\x72\xe9\x25\x98\x62\x92\x69\x26\x9a\x6a\xb2\xe9\x26\x9c\x52\xd2\x69\x27\x9e\x7a\xf2\xe9\x27\xa0\x82\x12\x6a\x28\xa2\x8a\x32\xea\x28\xa4\x72\x52\x6a\x29\xa6\x9a\x72\xea\x29\xa8\xa2\x92\x6a\x2a\xaa\xaa\xb2\xea\x2a\xac\x92\xce\x8a\xaf\xad\xfb\xe6\xea\x2f\xaf\x01\xff\x4a\xf0\x8c\xc4\x22\x7c\xec\xc2\xca\x3a\xdc\x6c\xc4\xd0\x52\x3c\x65\xb5\x18\x63\xbb\xf1\xb6\x1e\x7b\x1b\x72\xb8\x24\xcf\x69\x2e\xca\xe9\xae\xcc\xae\xcb\xef\xc6\x2c\x2f\xcd\x93\x06\x04\x00\x3b"
}

///|
/// GIF 8x8 animated (testdata/gif/gif_animated_8x8.gif, 129 bytes)
fn fixture_gif_animated_8x8() -> Bytes {
  b"\x47\x49\x46\x38\x39\x61\x08\x00\x08\x00\x81\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x21\xff\x0b\x4e\x45\x54\x53\x43\x41\x50\x45\x32\x2e\x30\x03\x01\x00\x00\x00\x21\xf9\x04\x00\x0a\x00\x00\x00\x2c\x00\x00\x00\x00\x08\x00\x08\x00\x00\x08\x0f\x00\x01\x08\x1c\x48\xb0\xa0\xc1\x83\x08\x13\x2a\x4c\x18\x10\x00\x21\xf9\x04\x01\x0a\x00\x01\x00\x2c\x00\x00\x00\x00\x08\x00\x08\x00\x81\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x0f\x00\x01\x08\x1c\x48\xb0\xa0\xc1\x83\x08\x13\x2a\x4c\x18\x10\x00\x3b"
}

///|
/// TGA 1x1 24-bit (testdata/tga/tga_tiny_1x1_24.tga, 47 bytes)
fn fixture_tga_tiny_1x1_24() -> Bytes {
  b"\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01\x00\x18\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x52\x55\x45\x56\x49\x53\x49\x4f\x4e\x2d\x58\x46\x49\x4c\x45\x2e\x00"
}

///|
/// TGA 32x32 grayscale (testdata/tga/tga_grayscale_32x32.tga, 1068 bytes)
fn fixture_tga_grayscale_32x32() -> Bytes {
  b"\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x20\x00\x08\x00\x1f\x27\x2f\x37\x3f\x47\x4f\x57\x5f\x67\x6f\x77\x7f\x87\x8f\x97\x9f\xa7\xaf\xb7\xbf\xc7\xcf\xd7\xdf\xe7\xef\xf7\xff\x07\x0f\x17\x1e\x26\x2e\x36\x3e\x46\x4e\x56\x5e\x66\x6e\x76\x7e\x86\x8e\x96\x9e\xa6\xae\xb6\xbe\xc6\xce\xd6\xde\xe6\xee\xf6\xfe\x06\x0e\x16\x1d\x25\x2d\x35\x3d\x45\x4d\x55\x5d\x65\x6d\x75\x7d\x85\x8d\x95\x9d\xa5\xad\xb5\xbd\xc5\xcd\xd5\xdd\xe5\xed\xf5\xfd\x05\x0d\x15\x1c\x24\x2c\x34\x3c\x44\x4c\x54\x5c\x64\x6c\x74\x7c\x84\x8c\x94\x9c\xa4\xac\xb4\xbc\xc4\xcc\xd4\xdc\xe4\xec\xf4\xfc\x04\x0c\x14\x1b\x23\x2b\x33\x3b\x43\x4b\x53\x5b\x63\x6b\x73\x7b\x83\x8b\x93\x9b\xa3\xab\xb3\xbb\xc3\xcb\xd3\xdb\xe3\xeb\xf3\xfb\x03\x0b\x13\x1a\x22\x2a\x32\x3a\x42\x4a\x52\x5a\x62\x6a\x72\x7a\x82\x8a\x92\x9a\xa2\xaa\xb2\xba\xc2\xca\xd2\xda\xe2\xea\xf2\xfa\x02\x0a\x12\x19\x21\x29\x31\x39\x41\x49\x51\x59\x61\x69\x71\x79\x81\x89\x91\x99\xa1\xa9\xb1\xb9\xc1\xc9\xd1\xd9\xe1\xe9\xf1\xf9\x01\x09\x11\x18\x20\x28\x30\x38\x40\x48\x50\x58\x60\x68\x70\x78\x80\x88\x90\x98\xa0\xa8\xb0\xb8\xc0\xc8\xd0\xd8\xe0\xe8\xf0\xf8\x00\x08\x10\x17\x1f\x27\x2f\x37\x3f\x47\x4f\x57\x5f\x67\x6f\x77\x7f\x87\x8f\x97\x9f\xa7\xaf\xb7\xbf\xc7\xcf\xd7\xdf\xe7\xef\xf7\xff\x07\x0f\x16\x1e\x26\x2e\x36\x3e\x46\x4e\x56\x5e\x66\x6e\x76\x7e\x86\x8e\x96\x9e\xa6\xae\xb6\xbe\xc6\xce\xd6\xde\xe6\xee\xf6\xfe\x06\x0e\x15\x1d\x25\x2d\x35\x3d\x45\x4d\x55\x5d\x65\x6d\x75\x7d\x85\x8d\x95\x9d\xa5\xad\xb5\xbd\xc5\xcd\xd5\xdd\xe5\xed\xf5\xfd\x05\x0d\x14\x1c\x24\x2c\x34\x3c\x44\x4c\x54\x5c\x64\x6c\x74\x7c\x84\x8c\x94\x9c\xa4\xac\xb4\xbc\xc4\xcc\xd4\xdc\xe4\xec\xf4\xfc\x04\x0c\x13\x1b\x23\x2b\x33\x3b\x43\x4b\x53\x5b\x63\x6b\x73\x7b\x83\x8b\x93\x9b\xa3\xab\xb3\xbb\xc3\xcb\xd3\xdb\xe3\xeb\xf3\xfb\x03\x0b\x12\x1a\x22\x2a\x32\x3a\x42\x4a\x52\x5a\x62\x6a\x72\x7a\x82\x8a\x92\x9a\xa2\xaa\xb2\xba\xc2\xca\xd2\xda\xe2\xea\xf2\xfa\x02\x0a\x11\x19\x21\x29\x31\x39\x41\x49\x51\x59\x61\x69\x71\x79\x81\x89\x91\x99\xa1\xa9\xb1\xb9\xc1\xc9\xd1\xd9\xe1\xe9\xf1\xf9\x01\x09\x10\x18\x20\x28\x30\x38\x40\x48\x50\x58\x60\x68\x70\x78\x80\x88\x90\x98\xa0\xa8\xb0\xb8\xc0\xc8\xd0\xd8\xe0\xe8\xf0\xf8\x00\x08\x0f\x17\x1f\x27\x2f\x37\x3f\x47\x4f\x57\x5f\x67\x6f\x77\x7f\x87\x8f\x97\x9f\xa7\xaf\xb7\xbf\xc7\xcf\xd7\xdf\xe7\xef\xf7\xff\x07\x0e\x16\x1e\x26\x2e\x36\x3e\x46\x4e\x56\x5e\x66\x6e\x76\x7e\x86\x8e\x96\x9e\xa6\xae\xb6\xbe\xc6\xce\xd6\xde\xe6\xee\xf6\xfe\x06\x0d\x15\x1d\x25\x2d\x35\x3d\x45\x4d\x55\x5d\x65\x6d\x75\x7d\x85\x8d\x95\x9d\xa5\xad\xb5\xbd\xc5\xcd\xd5\xdd\xe5\xed\xf5\xfd\x05\x0c\x14\x1c\x24\x2c\x34\x3c\x44\x4c\x54\x5c\x64\x6c\x74\x7c\x84\x8c\x94\x9c\xa4\xac\xb4\xbc\xc4\xcc\xd4\xdc\xe4\xec\xf4\xfc\x04\x0b\x13\x1b\x23\x2b\x33\x3b\x43\x4b\x53\x5b\x63\x6b\x73\x7b\x83\x8b\x93\x9b\xa3\xab\xb3\xbb\xc3\xcb\xd3\xdb\xe3\xeb\xf3\xfb\x03\x0a\x12\x1a\x22\x2a\x32\x3a\x42\x4a\x52\x5a\x62\x6a\x72\x7a\x82\x8a\x92\x9a\xa2\xaa\xb2\xba\xc2\xca\xd2\xda\xe2\xea\xf2\xfa\x02\x09\x11\x19\x21\x29\x31\x39\x41\x49\x51\x59\x61\x69\x71\x79\x81\x89\x91\x99\xa1\xa9\xb1\xb9\xc1\xc9\xd1\xd9\xe1\xe9\xf1\xf9\x01\x08\x10\x18\x20\x28\x30\x38\x40\x48\x50\x58\x60\x68\x70\x78\x80\x88\x90\x98\xa0\xa8\xb0\xb8\xc0\xc8\xd0\xd8\xe0\xe8\xf0\xf8\x00\x07\x0f\x17\x1f\x27\x2f\x37\x3f\x47\x4f\x57\x5f\x67\x6f\x77\x7f\x87\x8f\x97\x9f\xa7\xaf\xb7\xbf\xc7\xcf\xd7\xdf\xe7\xef\xf7\xff\x06\x0e\x16\x1e\x26\x2e\x36\x3e\x46\x4e\x56\x5e\x66\x6e\x76\x7e\x86\x8e\x96\x9e\xa6\xae\xb6\xbe\xc6\xce\xd6\xde\xe6\xee\xf6\xfe\x05\x0d\x15\x1d\x25\x2d\x35\x3d\x45\x4d\x55\x5d\x65\x6d\x75\x7d\x85\x8d\x95\x9d\xa5\xad\xb5\xbd\xc5\xcd\xd5\xdd\xe5\xed\xf5\xfd\x04\x0c\x14\x1c\x24\x2c\x34\x3c\x44\x4c\x54\x5c\x64\x6c\x74\x7c\x84\x8c\x94\x9c\xa4\xac\xb4\xbc\xc4\xcc\xd4\xdc\xe4\xec\xf4\xfc\x03\x0b\x13\x1b\x23\x2b\x33\x3b\x43\x4b\x53\x5b\x63\x6b\x73\x7b\x83\x8b\x93\x9b\xa3\xab\xb3\xbb\xc3\xcb\xd3\xdb\xe3\xeb\xf3\xfb\x02\x0a\x12\x1a\x22\x2a\x32\x3a\x42\x4a\x52\x5a\x62\x6a\x72\x7a\x82\x8a\x92\x9a\xa2\xaa\xb2\xba\xc2\xca\xd2\xda\xe2\xea\xf2\xfa\x01\x09\x11\x19\x21\x29\x31\x39\x41\x49\x51\x59\x61\x69\x71\x79\x81\x89\x91\x99\xa1\xa9\xb1\xb9\xc1\xc9\xd1\xd9\xe1\xe9\xf1\xf9\x00\x08\x10\x18\x20\x28\x30\x38\x40\x48\x50\x58\x60\x68\x70\x78\x80\x88\x90\x98\xa0\xa8\xb0\xb8\xc0\xc8\xd0\xd8\xe0\xe8\xf0\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x54\x52\x55\x45\x56\x49\x53\x49\x4f\x4e\x2d\x58\x46\x49\x4c\x45\x2e\x00"
}

///|
/// TGA 32x32 RGBA (testdata/tga/tga_rgba_32x32.tga, 4140 bytes)
fn fixture_tga_rgba_32x32() -> Bytes {
  b"\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x20\x00\x20\x08\x7c\xf8\x00\xff\x80\xf8\x08\xff\x84\xf8\x10\xff\x88\xf8\x18\xff\x8c\xf8\x20\xff\x90\xf8\x28\xff\x94\xf8\x30\xff\x98\xf8\x38\xff\x9c\xf8\x40\xff\xa0\xf8\x48\xff\xa4\xf8\x50\xff\xa8\xf8\x58\xff\xac\xf8\x60\xff\xb0\xf8\x68\xff\xb4\xf8\x70\xff\xb8\xf8\x78\xff\xbc\xf8\x80\xff\xc0\xf8\x88\xff\xc4\xf8\x90\xff\xc8\xf8\x98\xff\xcc\xf8\xa0\xff\xd0\xf8\xa8\xff\xd4\xf8\xb0\xff\xd8\xf8\xb8\xff\xdc\xf8\xc0\xff\xe0\xf8\xc8\xff\xe4\xf8\xd0\xff\xe8\xf8\xd8\xff\xec\xf8\xe0\xff\xf0\xf8\xe8\xff\xf4\xf8\xf0\xff\xf8\xf8\xf8\xff\x78\xf0\x00\xff\x7c\xf0\x08\xff\x80\xf0\x10\xff\x84\xf0\x18\xff\x88\xf0\x20\xff\x8c\xf0\x28\xff\x90\xf0\x30\xff\x94\xf0\x38\xff\x98\xf0\x40\xff\x9c\xf0\x48\xff\xa0\xf0\x50\xff\xa4\xf0\x58\xff\xa8\xf0\x60\xff\xac\xf0\x68\xff\xb0\xf0\x70\xff\xb4\xf0\x78\xff\xb8\xf0\x80\xff\xbc\xf0\x88\xff\xc0\xf0\x90\xff\xc4\xf0\x98\xff\xc8\xf0\xa0\xff\xcc\xf0\xa8\xff\xd0\xf0\xb0\xff\xd4\xf0\xb8\xff\xd8\xf0\xc0\xff\xdc\xf0\xc8\xff\xe0\xf0\xd0\xff\xe4\xf0\xd8\xff\xe8\xf0\xe0\xff\xec\xf0\xe8\xff\xf0\xf0\xf0\xff\xf4\xf0\xf8\xff\x74\xe8\x00\xff\x78\xe8\x08\xff\x7c\xe8\x10\xff\x80\xe8\x18\xff\x84\xe8\x20\xff\x88\xe8\x28\xff\x8c\xe8\x30\xff\x90\xe8\x38\xff\x94\xe8\x40\xff\x98\xe8\x48\xff\x9c\xe8\x50\xff\xa0\xe8\x58\xff\xa4\xe8\x60\xff\xa8\xe8\x68\xff\xac\xe8\x70\xff\xb0\xe8\x78\xff\xb4\xe8\x80\xff\xb8\xe8\x88\xff\xbc\xe8\x90\xff\xc0\xe8\x98\xff\xc4\xe8\xa0\xff\xc8\xe8\xa8\xff\xcc\xe8\xb0\xff\xd0\xe8\xb8\xff\xd4\xe8\xc0\xff\xd8\xe8\xc8\xff\xdc\xe8\xd0\xff\xe0\xe8\xd8\xff\xe4\xe8\xe0\xff\xe8\xe8\xe8\xff\xec\xe8\xf0\xff\xf0\xe8\xf8\xff\x70\xe0\x00\xff\x74\xe0\x08\xff\x78\xe0\x10\xff\x7c\xe0\x18\xff\x80\xe0\x20\xff\x84\xe0\x28\xff\x88\xe0\x30\xff\x8c\xe0\x38\xff\x90\xe0\x40\xff\x94\xe0\x48\xff\x98\xe0\x50\xff\x9c\xe0\x58\xff\xa0\xe0\x60\xff\xa4\xe0\x68\xff\xa8\xe0\x70\xff\xac\xe0\x78\xff\xb0\xe0\x80\xff\xb4\xe0\x88\xff\xb8\xe0\x90\xff\xbc\xe0\x98\xff\xc0\xe0\xa0\xff\xc4\xe0\xa8\xff\xc8\xe0\xb0\xff\xcc\xe0\xb8\xff\xd0\xe0\xc0\xff\xd4\xe0\xc8\xff\xd8\xe0\xd0\xff\xdc\xe0\xd8\xff\xe0\xe0\xe0\xff\xe4\xe0\xe8\xff\xe8\xe0\xf0\xff\xec\xe0\xf8\xff\x6c\xd8\x00\xff\x70\xd8\x08\xff\x74\xd8\x10\xff\x78\xd8\x18\xff\x7c\xd8\x20\xff\x80\xd8\x28\xff\x84\xd8\x30\xff\x88\xd8\x38\xff\x8c\xd8\x40\xff\x90\xd8\x48\xff\x94\xd8\x50\xff\x98\xd8\x58\xff\x9c\xd8\x60\xff\xa0\xd8\x68\xff\xa4\xd8\x70\xff\xa8\xd8\x78\xff\xac\xd8\x80\xff\xb0\xd8\x88\xff\xb4\xd8\x90\xff\xb8\xd8\x98\xff\xbc\xd8\xa0\xff\xc0\xd8\xa8\xff\xc4\xd8\xb0\xff\xc8\xd8\xb8\xff\xcc\xd8\xc0\xff\xd0\xd8\xc8\xff\xd4\xd8\xd0\xff\xd8\xd8\xd8\xff\xdc\xd8\xe0\xff\xe0\xd8\xe8\xff\xe4\xd8\xf0\xff\xe8\xd8\xf8\xff\x68\xd0\x00\xff\x6c\xd0\x08\xff\x70\xd0\x10\xff\x74\xd0\x18\xff\x78\xd0\x20\xff\x7c\xd0\x28\xff\x80\xd0\x30\xff\x84\xd0\x38\xff\x88\xd0\x40\xff\x8c\xd0\x48\xff\x90\xd0\x50\xff\x94\xd0\x58\xff\x98\xd0\x60\xff\x9c\xd0\x68\xff\xa0\xd0\x70\xff\xa4\xd0\x78\xff\xa8\xd0\x80\xff\xac\xd0\x88\xff\xb0\xd0\x90\xff\xb4\xd0\x98\xff\xb8\xd0\xa0\xff\xbc\xd0\xa8\xff\xc0\xd0\xb0\xff\xc4\xd0\xb8\xff\xc8\xd0\xc0\xff\xcc\xd0\xc8\xff\xd0\xd0\xd0\xff\xd4\xd0\xd8\xff\xd8\xd0\xe0\xff\xdc\xd0\xe8\xff\xe0\xd0\xf0\xff\xe4\xd0\xf8\xff\x64\xc8\x00\xff\x68\xc8\x08\xff\x6c\xc8\x10\xff\x70\xc8\x18\xff\x74\xc8\x20\xff\x78\xc8\x28\xff\x7c\xc8\x30\xff\x80\xc8\x38\xff\x84\xc8\x40\xff\x88\xc8\x48\xff\x8c\xc8\x50\xff\x90\xc8\x58\xff\x94\xc8\x60\xff\x98\xc8\x68\xff\x9c\xc8\x70\xff\xa0\xc8\x78\xff\xa4\xc8\x80\xff\xa8\xc8\x88\xff\xac\xc8\x90\xff\xb0\xc8\x98\xff\xb4\xc8\xa0\xff\xb8\xc8\xa8\xff\xbc\xc8\xb0\xff\xc0\xc8\xb8\xff\xc4\xc8\xc0\xff\xc8\xc8\xc8\xff\xcc\xc8\xd0\xff\xd0\xc8\xd8\xff\xd4\xc8\xe0\xff\xd8\xc8\xe8\xff\xdc\xc8\xf0\xff\xe0\xc8\xf8\xff\x60\xc0\x00\xff\x64\xc0\x08\xff\x68\xc0\x10\xff\x6c\xc0\x18\xff\x70\xc0\x20\xff\x74\xc0\x28\xff\x78\xc0\x30\xff\x7c\xc0\x38\xff\x80\xc0\x40\xff\x84\xc0\x48\xff\x88\xc0\x50\xff\x8c\xc0\x58\xff\x90\xc0\x60\xff\x94\xc0\x68\xff\x98\xc0\x70\xff\x9c\xc0\x78\xff\xa0\xc0\x80\xff\xa4\xc0\x88\xff\xa8\xc0\x90\xff\xac\xc0\x98\xff\xb0\xc0\xa0\xff\xb4\xc0\xa8\xff\xb8\xc0\xb0\xff\xbc\xc0\xb8\xff\xc0\xc0\xc0\xff\xc4\xc0\xc8\xff\xc8\xc0\xd0\xff\xcc\xc0\xd8\xff\xd0\xc0\xe0\xff\xd4\xc0\xe8\xff\xd8\xc0\xf0\xff\xdc\xc0\xf8\xff\x5c\xb8\x00\xff\x60\xb8\x08\xff\x64\xb8\x10\xff\x68\xb8\x18\xff\x6c\xb8\x20\xff\x70\xb8\x28\xff\x74\xb8\x30\xff\x78\xb8\x38\xff\x7c\xb8\x40\xff\x80\xb8\x48\xff\x84\xb8\x50\xff\x88\xb8\x58\xff\x8c\xb8\x60\xff\x90\xb8\x68\xff\x94\xb8\x70\xff\x98\xb8\x78\xff\x9c\xb8\x80\xff\xa0\xb8\x88\xff\xa4\xb8\x90\xff\xa8\xb8\x98\xff\xac\xb8\xa0\xff\xb0\xb8\xa8\xff\xb4\xb8\xb0\xff\xb8\xb8\xb8\xff\xbc\xb8\xc0\xff\xc0\xb8\xc8\xff\xc4\xb8\xd0\xff\xc8\xb8\xd8\xff\xcc\xb8\xe0\xff\xd0\xb8\xe8\xff\xd4\xb8\xf0\xff\xd8\xb8\xf8\xff\x58\xb0\x00\xff\x5c\xb0\x08\xff\x60\xb0\x10\xff\x64\xb0\x18\xff\x68\xb0\x20\xff\x6c\xb0\x28\xff\x70\xb0\x30\xff\x74\xb0\x38\xff\x78\xb0\x40\xff\x7c\xb0\x48\xff\x80\xb0\x50\xff\x84\xb0\x58\xff\x88\xb0\x60\xff\x8c\xb0\x68\xff\x90\xb0\x70\xff\x94\xb0\x78\xff\x98\xb0\x80\xff\x9c\xb0\x88\xff\xa0\xb0\x90\xff\xa4\xb0\x98\xff\xa8\xb0\xa0\xff\xac\xb0\xa8\xff\xb0\xb0\xb0\xff\xb4\xb0\xb8\xff\xb8\xb0\xc0\xff\xbc\xb0\xc8\xff\xc0\xb0\xd0\xff\xc4\xb0\xd8\xff\xc8\xb0\xe0\xff\xcc\xb0\xe8\xff\xd0\xb0\xf0\xff\xd4\xb0\xf8\xff\x54\xa8\x00\xff\x58\xa8\x08\xff\x5c\xa8\x10\xff\x60\xa8\x18\xff\x64\xa8\x20\xff\x68\xa8\x28\xff\x6c\xa8\x30\xff\x70\xa8\x38\xff\x74\xa8\x40\xff\x78\xa8\x48\xff\x7c\xa8\x50\xff\x80\xa8\x58\xff\x84\xa8\x60\xff\x88\xa8\x68\xff\x8c\xa8\x70\xff\x90\xa8\x78\xff\x94\xa8\x80\xff\x98\xa8\x88\xff\x9c\xa8\x90\xff\xa0\xa8\x98\xff\xa4\xa8\xa0\xff\xa8\xa8\xa8\xff\xac\xa8\xb0\xff\xb0\xa8\xb8\xff\xb4\xa8\xc0\xff\xb8\xa8\xc8\xff\xbc\xa8\xd0\xff\xc0\xa8\xd8\xff\xc4\xa8\xe0\xff\xc8\xa8\xe8\xff\xcc\xa8\xf0\xff\xd0\xa8\xf8\xff\x50\xa0\x00\xff\x54\xa0\x08\xff\x58\xa0\x10\xff\x5c\xa0\x18\xff\x60\xa0\x20\xff\x64\xa0\x28\xff\x68\xa0\x30\xff\x6c\xa0\x38\xff\x70\xa0\x40\xff\x74\xa0\x48\xff\x78\xa0\x50\xff\x7c\xa0\x58\xff\x80\xa0\x60\xff\x84\xa0\x68\xff\x88\xa0\x70\xff\x8c\xa0\x78\xff\x90\xa0\x80\xff\x94\xa0\x88\xff\x98\xa0\x90\xff\x9c\xa0\x98\xff\xa0\xa0\xa0\xff\xa4\xa0\xa8\xff\xa8\xa0\xb0\xff\xac\xa0\xb8\xff\xb0\xa0\xc0\xff\xb4\xa0\xc8\xff\xb8\xa0\xd0\xff\xbc\xa0\xd8\xff\xc0\xa0\xe0\xff\xc4\xa0\xe8\xff\xc8\xa0\xf0\xff\xcc\xa0\xf8\xff\x4c\x98\x00\xff\x50\x98\x08\xff\x54\x98\x10\xff\x58\x98\x18\xff\x5c\x98\x20\xff\x60\x98\x28\xff\x64\x98\x30\xff\x68\x98\x38\xff\x6c\x98\x40\xff\x70\x98\x48\xff\x74\x98\x50\xff\x78\x98\x58\xff\x7c\x98\x60\xff\x80\x98\x68\xff\x84\x98\x70\xff\x88\x98\x78\xff\x8c\x98\x80\xff\x90\x98\x88\xff\x94\x98\x90\xff\x98\x98\x98\xff\x9c\x98\xa0\xff\xa0\x98\xa8\xff\xa4\x98\xb0\xff\xa8\x98\xb8\xff\xac\x98\xc0\xff\xb0\x98\xc8\xff\xb4\x98\xd0\xff\xb8\x98\xd8\xff\xbc\x98\xe0\xff\xc0\x98\xe8\xff\xc4\x98\xf0\xff\xc8\x98\xf8\xff\x48\x90\x00\xff\x4c\x90\x08\xff\x50\x90\x10\xff\x54\x90\x18\xff\x58\x90\x20\xff\x5c\x90\x28\xff\x60\x90\x30\xff\x64\x90\x38\xff\x68\x90\x40\xff\x6c\x90\x48\xff\x70\x90\x50\xff\x74\x90\x58\xff\x78\x90\x60\xff\x7c\x90\x68\xff\x80\x90\x70\xff\x84\x90\x78\xff\x88\x90\x80\xff\x8c\x90\x88\xff\x90\x90\x90\xff\x94\x90\x98\xff\x98\x90\xa0\xff\x9c\x90\xa8\xff\xa0\x90\xb0\xff\xa4\x90\xb8\xff\xa8\x90\xc0\xff\xac\x90\xc8\xff\xb0\x90\xd0\xff\xb4\x90\xd8\xff\xb8\x90\xe0\xff\xbc\x90\xe8\xff\xc0\x90\xf0\xff\xc4\x90\xf8\xff\x44\x88\x00\xff\x48\x88\x08\xff\x4c\x88\x10\xff\x50\x88\x18\xff\x54\x88\x20\xff\x58\x88\x28\xff\x5c\x88\x30\xff\x60\x88\x38\xff\x64\x88\x40\xff\x68\x88\x48\xff\x6c\x88\x50\xff\x70\x88\x58\xff\x74\x88\x60\xff\x78\x88\x68\xff\x7c\x88\x70\xff\x80\x88\x78\xff\x84\x88\x80\xff\x88\x88\x88\xff\x8c\x88\x90\xff\x90\x88\x98\xff\x94\x88\xa0\xff\x98\x88\xa8\xff\x9c\x88\xb0\xff\xa0\x88\xb8\xff\xa4\x88\xc0\xff\xa8\x88\xc8\xff\xac\x88\xd0\xff\xb0\x88\xd8\xff\xb4\x88\xe0\xff\xb8\x88\xe8\xff\xbc\x88\xf0\xff\xc0\x88\xf8\xff\x40\x80\x00\xff\x44\x80\x08\xff\x48\x80\x10\xff\x4c\x80\x18\xff\x50\x80\x20\xff\x54\x80\x28\xff\x58\x80\x30\xff\x5c\x80\x38\xff\x60\x80\x40\xff\x64\x80\x48\xff\x68\x80\x50\xff\x6c\x80\x58\xff\x70\x80\x60\xff\x74\x80\x68\xff\x78\x80\x70\xff\x7c\x80\x78\xff\x80\x80\x80\xff\x84\x80\x88\xff\x88\x80\x90\xff\x8c\x80\x98\xff\x90\x80\xa0\xff\x94\x80\xa8\xff\x98\x80\xb0\xff\x9c\x80\xb8\xff\xa0\x80\xc0\xff\xa4\x80\xc8\xff\xa8\x80\xd0\xff\xac\x80\xd8\xff\xb0\x80\xe0\xff\xb4\x80\xe8\xff\xb8\x80\xf0\xff\xbc\x80\xf8\xff\x3c\x78\x00\xff\x40\x78\x08\xff\x44\x78\x10\xff\x48\x78\x18\xff\x4c\x78\x20\xff\x50\x78\x28\xff\x54\x78\x30\xff\x58\x78\x38\xff\x5c\x78\x40\xff\x60\x78\x48\xff\x64\x78\x50\xff\x68\x78\x58\xff\x6c\x78\x60\xff\x70\x78\x68\xff\x74\x78\x70\xff\x78\x78\x78\xff\x7c\x78\x80\xff\x80\x78\x88\xff\x84\x78\x90\xff\x88\x78\x98\xff\x8c\x78\xa0\xff\x90\x78\xa8\xff\x94\x78\xb0\xff\x98\x78\xb8\xff\x9c\x78\xc0\xff\xa0\x78\xc8\xff\xa4\x78\xd0\xff\xa8\x78\xd8\xff\xac\x78\xe0\xff\xb0\x78\xe8\xff\xb4\x78\xf0\xff\xb8\x78\xf8\xff\x38\x70\x00\xff\x3c\x70\x08\xff\x40\x70\x10\xff\x44\x70\x18\xff\x48\x70\x20\xff\x4c\x70\x28\xff\x50\x70\x30\xff\x54\x70\x38\xff\x58\x70\x40\xff\x5c\x70\x48\xff\x60\x70\x50\xff\x64\x70\x58\xff\x68\x70\x60\xff\x6c\x70\x68\xff\x70\x70\x70\xff\x74\x70\x78\xff\x78\x70\x80\xff\x7c\x70\x88\xff\x80\x70\x90\xff\x84\x70\x98\xff\x88\x70\xa0\xff\x8c\x70\xa8\xff\x90\x70\xb0\xff\x94\x70\xb8\xff\x98\x70\xc0\xff\x9c\x70\xc8\xff\xa0\x70\xd0\xff\xa4\x70\xd8\xff\xa8\x70\xe0\xff\xac\x70\xe8\xff\xb0\x70\xf0\xff\xb4\x70\xf8\xff\x34\x68\x00\xff\x38\x68\x08\xff\x3c\x68\x10\xff\x40\x68\x18\xff\x44\x68\x20\xff\x48\x68\x28\xff\x4c\x68\x30\xff\x50\x68\x38\xff\x54\x68\x40\xff\x58\x68\x48\xff\x5c\x68\x50\xff\x60\x68\x58\xff\x64\x68\x60\xff\x68\x68\x68\xff\x6c\x68\x70\xff\x70\x68\x78\xff\x74\x68\x80\xff\x78\x68\x88\xff\x7c\x68\x90\xff\x80\x68\x98\xff\x84\x68\xa0\xff\x88\x68\xa8\xff\x8c\x68\xb0\xff\x90\x68\xb8\xff\x94\x68\xc0\xff\x98\x68\xc8\xff\x9c\x68\xd0\xff\xa0\x68\xd8\xff\xa4\x68\xe0\xff\xa8\x68\xe8\xff\xac\x68\xf0\xff\xb0\x68\xf8\xff\x30\x60\x00\xff\x34\x60\x08\xff\x38\x60\x10\xff\x3c\x60\x18\xff\x40\x60\x20\xff\x44\x60\x28\xff\x48\x60\x30\xff\x4c\x60\x38\xff\x50\x60\x40\xff\x54\x60\x48\xff\x58\x60\x50\xff\x5c\x60\x58\xff\x60\x60\x60\xff\x64\x60\x68\xff\x68\x60\x70\xff\x6c\x60\x78\xff\x70\x60\x80\xff\x74\x60\x88\xff\x78\x60\x90\xff\x7c\x60\x98\xff\x80\x60\xa0\xff\x84\x60\xa8\xff\x88\x60\xb0\xff\x8c\x60\xb8\xff\x90\x60\xc0\xff\x94\x60\xc8\xff\x98\x60\xd0\xff\x9c\x60\xd8\xff\xa0\x60\xe0\xff\xa4\x60\xe8\xff\xa8\x60\xf0\xff\xac\x60\xf8\xff\x2c\x58\x00\xff\x30\x58\x08\xff\x34\x58\x10\xff\x38\x58\x18\xff\x3c\x58\x20\xff\x40\x58\x28\xff\x44\x58\x30\xff\x48\x58\x38\xff\x4c\x58\x40\xff\x50\x58\x48\xff\x54\x58\x50\xff\x58\x58\x58\xff\x5c\x58\x60\xff\x60\x58\x68\xff\x64\x58\x70\xff\x68\x58\x78\xff\x6c\x58\x80\xff\x70\x58\x88\xff\x74\x58\x90\xff\x78\x58\x98\xff\x7c\x58\xa0\xff\x80\x58\xa8\xff\x84\x58\xb0\xff\x88\x58\xb8\xff\x8c\x58\xc0\xff\x90\x58\xc8\xff\x94\x58\xd0\xff\x98\x58\xd8\xff\x9c\x58\xe0\xff\xa0\x58\xe8\xff\xa4\x58\xf0\xff\xa8\x58\xf8\xff\x28\x50\x00\xff\x2c\x50\x08\xff\x30\x50\x10\xff\x34\x50\x18\xff\x38\x50\x20\xff\x3c\x50\x28\xff\x40\x50\x30\xff\x44\x50\x38\xff\x48\x50\x40\xff\x4c\x50\x48\xff\x50\x50\x50\xff\x54\x50\x58\xff\x58\x50\x60\xff\x5c\x50\x68\xff\x60\x50\x70\xff\x64\x50\x78\xff\x68\x50\x80\xff\x6c\x50\x88\xff\x70\x50\x90\xff\x74\x50\x98\xff\x78\x50\xa0\xff\x7c\x50\xa8\xff\x80\x50\xb0\xff\x84\x50\xb8\xff\x88\x50\xc0\xff\x8c\x50\xc8\xff\x90\x50\xd0\xff\x94\x50\xd8\xff\x98\x50\xe0\xff\x9c\x50\xe8\xff\xa0\x50\xf0\xff\xa4\x50\xf8\xff\x24\x48\x00\xff\x28\x48\x08\xff\x2c\x48\x10\xff\x30\x48\x18\xff\x34\x48\x20\xff\x38\x48\x28\xff\x3c\x48\x30\xff\x40\x48\x38\xff\x44\x48\x40\xff\x48\x48\x48\xff\x4c\x48\x50\xff\x50\x48\x58\xff\x54\x48\x60\xff\x58\x48\x68\xff\x5c\x48\x70\xff\x60\x48\x78\xff\x64\x48\x80\xff\x68\x48\x88\xff\x6c\x48\x90\xff\x70\x48\x98\xff\x74\x48\xa0\xff\x78\x48\xa8\xff\x7c\x48\xb0\xff\x80\x48\xb8\xff\x84\x48\xc0\xff\x88\x48\xc8\xff\x8c\x48\xd0\xff\x90\x48\xd8\xff\x94\x48\xe0\xff\x98\x48\xe8\xff\x9c\x48\xf0\xff\xa0\x48\xf8\xff\x20\x40\x00\xff\x24\x40\x08\xff\x28\x40\x10\xff\x2c\x40\x18\xff\x30\x40\x20\xff\x34\x40\x28\xff\x38\x40\x30\xff\x3c\x40\x38\xff\x40\x40\x40\xff\x44\x40\x48\xff\x48\x40\x50\xff\x4c\x40\x58\xff\x50\x40\x60\xff\x54\x40\x68\xff\x58\x40\x70\xff\x5c\x40\x78\xff\x60\x40\x80\xff\x64\x40\x88\xff\x68\x40\x90\xff\x6c\x40\x98\xff\x70\x40\xa0\xff\x74\x40\xa8\xff\x78\x40\xb0\xff\x7c\x40\xb8\xff\x80\x40\xc0\xff\x84\x40\xc8\xff\x88\x40\xd0\xff\x8c\x40\xd8\xff\x90\x40\xe0\xff\x94\x40\xe8\xff\x98\x40\xf0\xff\x9c\x40\xf8\xff\x1c\x38\x00\xff\x20\x38\x08\xff\x24\x38\x10\xff\x28\x38\x18\xff\x2c\x38\x20\xff\x30\x38\x28\xff\x34\x38\x30\xff\x38\x38\x38\xff\x3c\x38\x40\xff\x40\x38\x48\xff\x44\x38\x50\xff\x48\x38\x58\xff\x4c\x38\x60\xff\x50\x38\x68\xff\x54\x38\x70\xff\x58\x38\x78\xff\x5c\x38\x80\xff\x60\x38\x88\xff\x64\x38\x90\xff\x68\x38\x98\xff\x6c\x38\xa0\xff\x70\x38\xa8\xff\x74\x38\xb0\xff\x78\x38\xb8\xff\x7c\x38\xc0\xff\x80\x38\xc8\xff\x84\x38\xd0\xff\x88\x38\xd8\xff\x8c\x38\xe0\xff\x90\x38\xe8\xff\x94\x38\xf0\xff\x98\x38\xf8\xff\x18\x30\x00\xff\x1c\x30\x08\xff\x20\x30\x10\xff\x24\x30\x18\xff\x28\x30\x20\xff\x2c\x30\x28\xff\x30\x30\x30\xff\x34\x30\x38\xff\x38\x30\x40\xff\x3c\x30\x48\xff\x40\x30\x50\xff\x44\x30\x58\xff\x48\x30\x60\xff\x4c\x30\x68\xff\x50\x30\x70\xff\x54\x30\x78\xff\x58\x30\x80\xff\x5c\x30\x88\xff\x60\x30\x90\xff\x64\x30\x98\xff\x68\x30\xa0\xff\x6c\x30\xa8\xff\x70\x30\xb0\xff\x74\x30\xb8\xff\x78\x30\xc0\xff\x7c\x30\xc8\xff\x80\x30\xd0\xff\x84\x30\xd8\xff\x88\x30\xe0\xff\x8c\x30\xe8\xff\x90\x30\xf0\xff\x94\x30\xf8\xff\x14\x28\x00\xff\x18\x28\x08\xff\x1c\x28\x10\xff\x20\x28\x18\xff\x24\x28\x20\xff\x28\x28\x28\xff\x2c\x28\x30\xff\x30\x28\x38\xff\x34\x28\x40\xff\x38\x28\x48\xff\x3c\x28\x50\xff\x40\x28\x58\xff\x44\x28\x60\xff\x48\x28\x68\xff\x4c\x28\x70\xff\x50\x28\x78\xff\x54\x28\x80\xff\x58\x28\x88\xff\x5c\x28\x90\xff\x60\x28\x98\xff\x64\x28\xa0\xff\x68\x28\xa8\xff\x6c\x28\xb0\xff\x70\x28\xb8\xff\x74\x28\xc0\xff\x78\x28\xc8\xff\x7c\x28\xd0\xff\x80\x28\xd8\xff\x84\x28\xe0\xff\x88\x28\xe8\xff\x8c\x28\xf0\xff\x90\x28\xf8\xff\x10\x20\x00\xff\x14\x20\x08\xff\x18\x20\x10\xff\x1c\x20\x18\xff\x20\x20\x20\xff\x24\x20\x28\xff\x28\x20\x30\xff\x2c\x20\x38\xff\x30\x20\x40\xff\x34\x20\x48\xff\x38\x20\x50\xff\x3c\x20\x58\xff\x40\x20\x60\xff\x44\x20\x68\xff\x48\x20\x70\xff\x4c\x20\x78\xff\x50\x20\x80\xff\x54\x20\x88\xff\x58\x20\x90\xff\x5c\x20\x98\xff\x60\x20\xa0\xff\x64\x20\xa8\xff\x68\x20\xb0\xff\x6c\x20\xb8\xff\x70\x20\xc0\xff\x74\x20\xc8\xff\x78\x20\xd0\xff\x7c\x20\xd8\xff\x80\x20\xe0\xff\x84\x20\xe8\xff\x88\x20\xf0\xff\x8c\x20\xf8\xff\x0c\x18\x00\xff\x10\x18\x08\xff\x14\x18\x10\xff\x18\x18\x18\xff\x1c\x18\x20\xff\x20\x18\x28\xff\x24\x18\x30\xff\x28\x18\x38\xff\x2c\x18\x40\xff\x30\x18\x48\xff\x34\x18\x50\xff\x38\x18\x58\xff\x3c\x18\x60\xff\x40\x18\x68\xff\x44\x18\x70\xff\x48\x18\x78\xff\x4c\x18\x80\xff\x50\x18\x88\xff\x54\x18\x90\xff\x58\x18\x98\xff\x5c\x18\xa0\xff\x60\x18\xa8\xff\x64\x18\xb0\xff\x68\x18\xb8\xff\x6c\x18\xc0\xff\x70\x18\xc8\xff\x74\x18\xd0\xff\x78\x18\xd8\xff\x7c\x18\xe0\xff\x80\x18\xe8\xff\x84\x18\xf0\xff\x88\x18\xf8\xff\x08\x10\x00\xff\x0c\x10\x08\xff\x10\x10\x10\xff\x14\x10\x18\xff\x18\x10\x20\xff\x1c\x10\x28\xff\x20\x10\x30\xff\x24\x10\x38\xff\x28\x10\x40\xff\x2c\x10\x48\xff\x30\x10\x50\xff\x34\x10\x58\xff\x38\x10\x60\xff\x3c\x10\x68\xff\x40\x10\x70\xff\x44\x10\x78\xff\x48\x10\x80\xff\x4c\x10\x88\xff\x50\x10\x90\xff\x54\x10\x98\xff\x58\x10\xa0\xff\x5c\x10\xa8\xff\x60\x10\xb0\xff\x64\x10\xb8\xff\x68\x10\xc0\xff\x6c\x10\xc8\xff\x70\x10\xd0\xff\x74\x10\xd8\xff\x78\x10\xe0\xff\x7c\x10\xe8\xff\x80\x10\xf0\xff\x84\x10\xf8\xff\x04\x08\x00\xff\x08\x08\x08\xff\x0c\x08\x10\xff\x10\x08\x18\xff\x14\x08\x20\xff\x18\x08\x28\xff\x1c\x08\x30\xff\x20\x08\x38\xff\x24\x08\x40\xff\x28\x08\x48\xff\x2c\x08\x50\xff\x30\x08\x58\xff\x34\x08\x60\xff\x38\x08\x68\xff\x3c\x08\x70\xff\x40\x08\x78\xff\x44\x08\x80\xff\x48\x08\x88\xff\x4c\x08\x90\xff\x50\x08\x98\xff\x54\x08\xa0\xff\x58\x08\xa8\xff\x5c\x08\xb0\xff\x60\x08\xb8\xff\x64\x08\xc0\xff\x68\x08\xc8\xff\x6c\x08\xd0\xff\x70\x08\xd8\xff\x74\x08\xe0\xff\x78\x08\xe8\xff\x7c\x08\xf0\xff\x80\x08\xf8\xff\x00\x00\x00\xff\x04\x00\x08\xff\x08\x00\x10\xff\x0c\x00\x18\xff\x10\x00\x20\xff\x14\x00\x28\xff\x18\x00\x30\xff\x1c\x00\x38\xff\x20\x00\x40\xff\x24\x00\x48\xff\x28\x00\x50\xff\x2c\x00\x58\xff\x30\x00\x60\xff\x34\x00\x68\xff\x38\x00\x70\xff\x3c\x00\x78\xff\x40\x00\x80\xff\x44\x00\x88\xff\x48\x00\x90\xff\x4c\x00\x98\xff\x50\x00\xa0\xff\x54\x00\xa8\xff\x58\x00\xb0\xff\x5c\x00\xb8\xff\x60\x00\xc0\xff\x64\x00\xc8\xff\x68\x00\xd0\xff\x6c\x00\xd8\xff\x70\x00\xe0\xff\x74\x00\xe8\xff\x78\x00\xf0\xff\x7c\x00\xf8\xff\x00\x00\x00\x00\x00\x00\x00\x00\x54\x52\x55\x45\x56\x49\x53\x49\x4f\x4e\x2d\x58\x46\x49\x4c\x45\x2e\x00"
}

///|
/// JPEG 1x1 (testdata/jpeg/jpeg_tiny_1x1.jpg, 632 bytes)
fn fixture_jpeg_tiny_1x1() -> Bytes {
  b"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x43\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\x09\x09\x08\x0a\x0c\x14\x0d\x0c\x0b\x0b\x0c\x19\x12\x13\x0f\x14\x1d\x1a\x1f\x1e\x1d\x1a\x1c\x1c\x20\x24\x2e\x27\x20\x22\x2c\x23\x1c\x1c\x28\x37\x29\x2c\x30\x31\x34\x34\x34\x1f\x27\x39\x3d\x38\x32\x3c\x2e\x33\x34\x32\xff\xdb\x00\x43\x01\x09\x09\x09\x0c\x0b\x0c\x18\x0d\x0d\x18\x32\x21\x1c\x21\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\xff\xc0\x00\x11\x08\x00\x01\x00\x01\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7d\x01\x02\x03\x00\x04\x11\x05\x12\x21\x31\x41\x06\x13\x51\x61\x07\x22\x71\x14\x32\x81\x91\xa1\x08\x23\x42\xb1\xc1\x15\x52\xd1\xf0\x24\x33\x62\x72\x82\x09\x0a\x16\x17\x18\x19\x1a\x25\x26\x27\x28\x29\x2a\x34\x35\x36\x37\x38\x39\x3a\x43\x44\x45\x46\x47\x48\x49\x4a\x53\x54\x55\x56\x57\x58\x59\x5a\x63\x64\x65\x66\x67\x68\x69\x6a\x73\x74\x75\x76\x77\x78\x79\x7a\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xc4\x00\x1f\x01\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff\xc4\x00\xb5\x11\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04\x00\x01\x02\x77\x00\x01\x02\x03\x11\x04\x05\x21\x31\x06\x12\x41\x51\x07\x61\x71\x13\x22\x32\x81\x08\x14\x42\x91\xa1\xb1\xc1\x09\x23\x33\x52\xf0\x15\x62\x72\xd1\x0a\x16\x24\x34\xe1\x25\xf1\x17\x18\x19\x1a\x26\x27\x28\x29\x2a\x35\x36\x37\x38\x39\x3a\x43\x44\x45\x46\x47\x48\x49\x4a\x53\x54\x55\x56\x57\x58\x59\x5a\x63\x64\x65\x66\x67\x68\x69\x6a\x73\x74\x75\x76\x77\x78\x79\x7a\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00\xf1\x1a\x28\xa2\xb6\x32\x3f\xff\xd9"
}

///|
/// JPEG 64x64 natural (testdata/jpeg/jpeg_natural_64x64.jpg, 1041 bytes)
fn fixture_jpeg_natural_64x64() -> Bytes {
  b"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x43\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\x09\x09\x08\x0a\x0c\x14\x0d\x0c\x0b\x0b\x0c\x19\x12\x13\x0f\x14\x1d\x1a\x1f\x1e\x1d\x1a\x1c\x1c\x20\x24\x2e\x27\x20\x22\x2c\x23\x1c\x1c\x28\x37\x29\x2c\x30\x31\x34\x34\x34\x1f\x27\x39\x3d\x38\x32\x3c\x2e\x33\x34\x32\xff\xdb\x00\x43\x01\x09\x09\x09\x0c\x0b\x0c\x18\x0d\x0d\x18\x32\x21\x1c\x21\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\xff\xc0\x00\x11\x08\x00\x40\x00\x40\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7d\x01\x02\x03\x00\x04\x11\x05\x12\x21\x31\x41\x06\x13\x51\x61\x07\x22\x71\x14\x32\x81\x91\xa1\x08\x23\x42\xb1\xc1\x15\x52\xd1\xf0\x24\x33\x62\x72\x82\x09\x0a\x16\x17\x18\x19\x1a\x25\x26\x27\x28\x29\x2a\x34\x35\x36\x37\x38\x39\x3a\x43\x44\x45\x46\x47\x48\x49\x4a\x53\x54\x55\x56\x57\x58\x59\x5a\x63\x64\x65\x66\x67\x68\x69\x6a\x73\x74\x75\x76\x77\x78\x79\x7a\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xc4\x00\x1f\x01\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff\xc4\x00\xb5\x11\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04\x00\x01\x02\x77\x00\x01\x02\x03\x11\x04\x05\x21\x31\x06\x12\x41\x51\x07\x61\x71\x13\x22\x32\x81\x08\x14\x42\x91\xa1\xb1\xc1\x09\x23\x33\x52\xf0\x15\x62\x72\xd1\x0a\x16\x24\x34\xe1\x25\xf1\x17\x18\x19\x1a\x26\x27\x28\x29\x2a\x35\x36\x37\x38\x39\x3a\x43\x44\x45\x46\x47\x48\x49\x4a\x53\x54\x55\x56\x57\x58\x59\x5a\x63\x64\x65\x66\x67\x68\x69\x6a\x73\x74\x75\x76\x77\x78\x79\x7a\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00\xf0\xd8\xe0\xc7\x6a\xb9\x1c\x18\xed\x56\x63\x83\x1d\xaa\x78\xe0\xc7\x6a\x89\xd5\xf6\x63\xc3\xd7\xb9\x1c\x70\x63\xb5\x5d\x8e\x0c\x76\xab\x31\xc1\x8e\xd5\x3c\x70\x63\xb5\x76\x4e\xaf\xb3\x3d\x9c\x3d\x7b\x91\xc7\x06\x3b\x55\xc8\xe0\xc7\x6a\xb3\x1c\x18\xed\x53\xc7\x06\x3b\x57\x5c\xea\xfb\x33\xd8\xc3\xd7\xb8\xc8\xe0\xc7\x6a\xb9\x1c\x18\xed\x56\x63\x83\x1d\xaa\x78\xe0\xc7\x6a\xec\x9d\x5f\x66\x7b\x38\x7a\xf7\x38\x48\xe0\xc7\x6a\xb9\x1c\x18\xed\x56\x63\x83\x1d\xaa\x78\xe0\xc7\x6a\xf9\xe9\xd5\xf6\x67\xe3\x38\x7a\xf7\x28\x47\x06\x3b\x55\xd8\xe0\xc7\x6a\xb3\x1c\x18\xed\x53\xc7\x06\x3b\x57\x81\x3a\xbe\xcc\xfa\x0c\x3d\x7b\x93\xc7\x06\x3b\x55\xc8\xe0\xc7\x6a\xb3\x1c\x18\xed\x53\xc7\x06\x3b\x57\xdb\xce\xaf\xb3\x3d\x2c\x3d\x7b\x94\x63\x83\x1d\xaa\xe4\x70\x63\xb5\x59\x8e\x0c\x76\xa9\xe3\x83\x1d\xab\xc0\x9d\x5f\x66\x7d\x06\x1e\xbd\xce\x3e\x38\x31\xda\xae\x47\x06\x3b\x55\x98\xe0\xc7\x6a\x9e\x38\x31\xda\xba\xa7\x57\xd9\x9f\x89\x61\xeb\xdc\x8e\x38\x31\xda\xae\xc7\x06\x3b\x55\x98\xe0\xc7\x6a\x9e\x38\x31\xda\xbb\x27\x57\xd9\x9e\xce\x1e\xbd\xcc\x58\xe0\xc7\x6a\xb9\x1c\x18\xed\x56\xa3\x83\x1d\xaa\x68\xe0\xc7\x6a\xfc\xd6\x75\x7d\x99\xf4\xf8\x7a\xf7\x19\x1c\x18\xed\x57\x23\x83\x1d\xaa\xcc\x70\x63\xb5\x4f\x1c\x18\xed\x5d\x93\xab\xec\xcf\x67\x0f\x5e\xe7\x35\x1c\x18\xed\x57\x23\x83\x1d\xaa\xcc\x70\x63\xb5\x4f\x1c\x18\xed\x5f\x69\x3a\xbe\xcc\xfc\x2f\x0f\x5e\xe5\x08\xe0\xc7\x6a\xbb\x1c\x18\xed\x56\x63\x83\x1d\xaa\x78\xe0\xc7\x6a\xf0\x27\x57\xd9\x9f\x41\x87\xaf\x72\x84\x70\x63\xb5\x5c\x8e\x0c\x76\xab\x51\xc1\x8e\xd5\x34\x70\x63\xb5\x78\x13\xab\xec\xcf\x7f\x0f\x5e\xe5\x18\xe0\xc7\x6a\xb9\x1c\x18\xed\x56\x63\x83\x1d\xaa\x78\xe0\xc7\x6a\xf0\x27\x57\xd9\x9f\x41\x87\xaf\x73\xff\xd9"
}

///|
/// JPEG 64x64 HQ (testdata/jpeg/jpeg_hq_64x64.jpg, 1010 bytes)
fn fixture_jpeg_hq_64x64() -> Bytes {
  b"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00\x43\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07\x07\x09\x09\x08\x0a\x0c\x14\x0d\x0c\x0b\x0b\x0c\x19\x12\x13\x0f\x14\x1d\x1a\x1f\x1e\x1d\x1a\x1c\x1c\x20\x24\x2e\x27\x20\x22\x2c\x23\x1c\x1c\x28\x37\x29\x2c\x30\x31\x34\x34\x34\x1f\x27\x39\x3d\x38\x32\x3c\x2e\x33\x34\x32\xff\xdb\x00\x43\x01\x09\x09\x09\x0c\x0b\x0c\x18\x0d\x0d\x18\x32\x21\x1c\x21\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\xff\xc0\x00\x11\x08\x00\x40\x00\x40\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7d\x01\x02\x03\x00\x04\x11\x05\x12\x21\x31\x41\x06\x13\x51\x61\x07\x22\x71\x14\x32\x81\x91\xa1\x08\x23\x42\xb1\xc1\x15\x52\xd1\xf0\x24\x33\x62\x72\x82\x09\x0a\x16\x17\x18\x19\x1a\x25\x26\x27\x28\x29\x2a\x34\x35\x36\x37\x38\x39\x3a\x43\x44\x45\x46\x47\x48\x49\x4a\x53\x54\x55\x56\x57\x58\x59\x5a\x63\x64\x65\x66\x67\x68\x69\x6a\x73\x74\x75\x76\x77\x78\x79\x7a\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xc4\x00\x1f\x01\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\xff\xc4\x00\xb5\x11\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04\x00\x01\x02\x77\x00\x01\x02\x03\x11\x04\x05\x21\x31\x06\x12\x41\x51\x07\x61\x71\x13\x22\x32\x81\x08\x14\x42\x91\xa1\xb1\xc1\x09\x23\x33\x52\xf0\x15\x62\x72\xd1\x0a\x16\x24\x34\xe1\x25\xf1\x17\x18\x19\x1a\x26\x27\x28\x29\x2a\x35\x36\x37\x38\x39\x3a\x43\x44\x45\x46\x47\x48\x49\x4a\x53\x54\x55\x56\x57\x58\x59\x5a\x63\x64\x65\x66\x67\x68\x69\x6a\x73\x74\x75\x76\x77\x78\x79\x7a\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00\x3f\x00\xf0\x98\x52\xb4\x61\x4a\xab\x0a\x56\x8c\x29\x5d\x15\x70\xc6\x73\x2c\xc2\x95\xa3\x0a\x55\x58\x53\xa5\x68\xc2\x9d\x2b\xce\xab\x86\x39\x26\x59\x85\x2b\x46\x14\xe9\x55\x61\x4a\xd1\x85\x2b\xcf\xab\x86\x39\x26\x59\x85\x2b\x46\x14\xaa\xb0\xa5\x68\xc2\x95\xe7\x55\xc3\x1c\x93\x3c\x4a\x14\xad\x18\x53\xa5\x55\x85\x2b\x46\x14\xaf\xd4\xea\xe1\x8f\xa2\x99\x66\x14\xad\x18\x52\xaa\xc2\x95\xa3\x0a\x57\x9d\x57\x0c\x72\x4c\xb3\x0a\x56\x8c\x29\x55\x61\x5e\x95\xa1\x0a\x57\x9f\x57\x0c\x72\x4c\xb5\x0a\xd6\x8c\x29\x55\x61\x4a\xd0\x85\x2b\xce\xab\x86\x39\x66\x78\x9c\x29\x5a\x30\xa5\x55\x85\x2b\x42\x14\xaf\xd4\xea\xe1\x8f\xa1\x99\x6a\x15\xad\x08\x52\xab\x42\xbd\x2b\x42\x14\xaf\x3e\xae\x18\xe4\x99\x6a\x15\xad\x08\x52\xab\x42\x95\xa1\x0a\x57\x9d\x57\x0c\x72\xcc\xb5\x0a\x56\x84\x29\x55\xa1\x4a\xd0\x85\x2b\xce\xab\x86\x39\x26\x78\x24\x37\xff\x00\xf4\xc7\xff\x00\x1e\xff\x00\xeb\x56\x8c\x37\xfd\x3f\x75\xff\x00\x8f\x7f\xf5\xab\x1e\x14\xad\x08\x52\xa6\xae\x77\x9a\x7f\xcf\xcf\xfc\x96\x3f\xe4\x7d\x7c\xe8\xc3\xb1\xb1\x0d\xff\x00\xfd\x31\xff\x00\xc7\xbf\xfa\xd5\xa3\x0d\xff\x00\x4f\xdd\x7f\xe3\xdf\xfd\x6a\xc7\x85\x2b\x42\x14\xaf\x3a\xae\x77\x9a\x7f\xcf\xcf\xfc\x96\x3f\xe4\x72\xce\x8c\x3b\x1b\x10\xdf\xff\x00\xd3\x1f\xfc\x7b\xff\x00\xad\x5a\x30\xdf\xf4\xfd\xcf\xfe\x3d\xff\x00\xd6\xac\x78\x53\xa5\x68\x42\x95\xe7\xd5\xce\xf3\x4f\xf9\xf9\xff\x00\x92\xc7\xfc\x8e\x49\xd1\x87\x63\x62\x1b\xfe\x9f\xb9\xff\x00\xc7\xbf\xfa\xd5\xa3\x0d\xff\x00\xfd\x31\xff\x00\xc7\xbf\xfa\xd5\x8f\x0a\x56\x84\x29\x5e\x75\x5c\xef\x34\xff\x00\x9f\x9f\xf9\x2c\x7f\xc8\xe4\x9d\x18\x76\x3f\xff\xd9"
}

// ---------------------------------------------------------------------------
// PNG
// ---------------------------------------------------------------------------

///|
test "png: decode_png reads a 1x1 RGBA8 image" {
  let img = decode_png(fixture_png_tiny_1x1_rgba()) catch {
    _ => fail("decode_png raised on a 1x1 RGBA PNG")
  }
  assert_eq(img.width, 1)
  assert_eq(img.height, 1)
  assert_eq(pixel_format_name(img.format), "RGBA8")
  assert_eq(img.data.length(), 4)
}

///|
test "png: decode_png expands an indexed (palette) image to RGBA8" {
  let img = decode_png(fixture_png_palette_16x16()) catch {
    _ => fail("decode_png raised on an indexed PNG")
  }
  assert_eq(img.width, 16)
  assert_eq(img.height, 16)
  // Colour type 3 (indexed) has no direct pixel format; the decoder
  // expands the palette to RGBA8.
  assert_eq(pixel_format_name(img.format), "RGBA8")
  assert_eq(img.data.length(), 16 * 16 * 4)
}

///|
test "png: decode_png reads a 32x32 RGBA8 image" {
  let img = decode_png(fixture_png_gradient_32x32()) catch {
    _ => fail("decode_png raised on a 32x32 RGBA PNG")
  }
  assert_eq(img.width, 32)
  assert_eq(img.height, 32)
  assert_eq(pixel_format_name(img.format), "RGBA8")
  assert_eq(img.data.length(), 32 * 32 * 4)
}

///|
test "png: image_dimensions reads IHDR without decoding pixels" {
  let (w, h, fmt) = image_dimensions(fixture_png_palette_16x16()) catch {
    _ => fail("image_dimensions raised on a PNG")
  }
  assert_eq(w, 16)
  assert_eq(h, 16)
  assert_eq(image_format_name(fmt), "PNG")
}

///|
test "png: detect_format identifies the PNG magic" {
  let name = match detect_format(fixture_png_gradient_32x32()) {
    Some(f) => image_format_name(f)
    None => "?"
  }
  assert_eq(name, "PNG")
}

// ---------------------------------------------------------------------------
// GIF
// ---------------------------------------------------------------------------

///|
test "gif: decode_gif reads a 1x1 image" {
  let img = decode_gif(fixture_gif_tiny_1x1()) catch {
    _ => fail("decode_gif raised on a 1x1 GIF")
  }
  assert_eq(img.width, 1)
  assert_eq(img.height, 1)
  assert_eq(pixel_format_name(img.format), "RGBA8")
}

///|
test "gif: decode_gif reads a 32x32 palette image" {
  let img = decode_gif(fixture_gif_palette_32x32()) catch {
    _ => fail("decode_gif raised on a 32x32 GIF")
  }
  assert_eq(img.width, 32)
  assert_eq(img.height, 32)
  assert_eq(pixel_format_name(img.format), "RGBA8")
  assert_eq(img.data.length(), 32 * 32 * 4)
}

///|
test "gif: decode_gif_all returns every frame of an animated GIF" {
  // The 8x8 sample carries two Graphic Control Extensions, i.e. two
  // frames. decode_gif() would only return the first one.
  let anim = decode_gif_all(fixture_gif_animated_8x8()) catch {
    _ => fail("decode_gif_all raised on an animated GIF")
  }
  assert_eq(anim.frame_count(), 2)
  assert_eq(anim.width, 8)
  assert_eq(anim.height, 8)
  let first = anim.frames[0]
  assert_eq(first.width, 8)
  assert_eq(first.height, 8)
}

///|
test "gif: detect_format identifies the GIF magic" {
  let name = match detect_format(fixture_gif_palette_32x32()) {
    Some(f) => image_format_name(f)
    None => "?"
  }
  assert_eq(name, "GIF")
}

// ---------------------------------------------------------------------------
// TGA
// ---------------------------------------------------------------------------

///|
test "tga: decode_tga reads a 1x1 24-bit image" {
  let img = decode_tga(fixture_tga_tiny_1x1_24()) catch {
    _ => fail("decode_tga raised on a 1x1 TGA")
  }
  assert_eq(img.width, 1)
  assert_eq(img.height, 1)
  // 24-bit true colour has no alpha, so it is widened to RGBA8.
  assert_eq(pixel_format_name(img.format), "RGBA8")
}

///|
test "tga: decode_tga maps an 8-bit grayscale image to Gray8" {
  let img = decode_tga(fixture_tga_grayscale_32x32()) catch {
    _ => fail("decode_tga raised on a grayscale TGA")
  }
  assert_eq(img.width, 32)
  assert_eq(img.height, 32)
  assert_eq(pixel_format_name(img.format), "Gray8")
  assert_eq(img.data.length(), 32 * 32)
}

///|
test "tga: decode_tga reads a 32x32 RGBA image" {
  let img = decode_tga(fixture_tga_rgba_32x32()) catch {
    _ => fail("decode_tga raised on an RGBA TGA")
  }
  assert_eq(img.width, 32)
  assert_eq(img.height, 32)
  assert_eq(pixel_format_name(img.format), "RGBA8")
  assert_eq(img.data.length(), 32 * 32 * 4)
}

///|
test "tga: detect_format identifies a TGA carrying the v2 footer" {
  // Regression guard for the off-by-one in the v2 footer scan: the
  // signature is 17 bytes but the scan used to walk 18, indexing past
  // the end of the string and panicking.
  let name = match detect_format(fixture_tga_rgba_32x32()) {
    Some(f) => image_format_name(f)
    None => "?"
  }
  assert_eq(name, "TGA")
}

///|
test "tga: image_dimensions reads the TGA header" {
  let (w, h, fmt) = image_dimensions(fixture_tga_rgba_32x32()) catch {
    _ => fail("image_dimensions raised on a TGA")
  }
  assert_eq(w, 32)
  assert_eq(h, 32)
  assert_eq(image_format_name(fmt), "TGA")
}

// ---------------------------------------------------------------------------
// JPEG
// ---------------------------------------------------------------------------

///|
test "jpeg: decode_jpeg reads a 1x1 baseline image" {
  let img = decode_jpeg(fixture_jpeg_tiny_1x1()) catch {
    _ => fail("decode_jpeg raised on a 1x1 JPEG")
  }
  assert_eq(img.width, 1)
  assert_eq(img.height, 1)
  assert_eq(pixel_format_name(img.format), "RGB8")
}

///|
test "jpeg: decode_jpeg reads a 64x64 baseline colour image" {
  let img = decode_jpeg(fixture_jpeg_natural_64x64()) catch {
    _ => fail("decode_jpeg raised on a 64x64 JPEG")
  }
  assert_eq(img.width, 64)
  assert_eq(img.height, 64)
  assert_eq(pixel_format_name(img.format), "RGB8")
  assert_eq(img.data.length(), 64 * 64 * 3)
}

///|
test "jpeg: decode_jpeg reads the high-quality 64x64 sample" {
  let img = decode_jpeg(fixture_jpeg_hq_64x64()) catch {
    _ => fail("decode_jpeg raised on the HQ JPEG")
  }
  assert_eq(img.width, 64)
  assert_eq(img.height, 64)
  assert_eq(pixel_format_name(img.format), "RGB8")
}

///|
test "jpeg: the two 64x64 samples decode to different pixels" {
  // Both samples are 64x64 baseline colour. If the decoder collapsed
  // them to the same buffer (e.g. a stale cache or a wrong stride) the
  // images would be identical, which would mean one of them was not
  // really decoded.
  let a = decode_jpeg(fixture_jpeg_natural_64x64()) catch {
    _ => fail("decode_jpeg raised on the natural JPEG")
  }
  let b = decode_jpeg(fixture_jpeg_hq_64x64()) catch {
    _ => fail("decode_jpeg raised on the HQ JPEG")
  }
  let mut differ = false
  for i = 0; i < a.data.length(); i = i + 1 {
    if a.data[i] != b.data[i] {
      differ = true
      break
    }
  }
  assert_true(differ)
}

///|
test "jpeg: detect_format identifies the JPEG magic" {
  let name = match detect_format(fixture_jpeg_natural_64x64()) {
    Some(f) => image_format_name(f)
    None => "?"
  }
  assert_eq(name, "JPEG")
}

// ---------------------------------------------------------------------------
// Cross-codec: the unified entry points route each format correctly
// ---------------------------------------------------------------------------

///|
test "codec matrix: decode() routes every JPEG / PNG / GIF / TGA sample" {
  let png = decode(fixture_png_gradient_32x32()) catch {
    _ => fail("decode() raised on a PNG")
  }
  assert_eq((png.width, png.height), (32, 32))
  let gif = decode(fixture_gif_palette_32x32()) catch {
    _ => fail("decode() raised on a GIF")
  }
  assert_eq((gif.width, gif.height), (32, 32))
  let tga = decode(fixture_tga_rgba_32x32()) catch {
    _ => fail("decode() raised on a TGA")
  }
  assert_eq((tga.width, tga.height), (32, 32))
  let jpeg = decode(fixture_jpeg_natural_64x64()) catch {
    _ => fail("decode() raised on a JPEG")
  }
  assert_eq((jpeg.width, jpeg.height), (64, 64))
}

///|
test "codec matrix: every JPEG / PNG / GIF / TGA format is decodable" {
  let png = match detect_format(fixture_png_tiny_1x1_rgba()) {
    Some(f) => f
    None => fail("detect_format missed the PNG magic")
  }
  let gif = match detect_format(fixture_gif_tiny_1x1()) {
    Some(f) => f
    None => fail("detect_format missed the GIF magic")
  }
  let tga = match detect_format(fixture_tga_tiny_1x1_24()) {
    Some(f) => f
    None => fail("detect_format missed the TGA magic")
  }
  let jpeg = match detect_format(fixture_jpeg_tiny_1x1()) {
    Some(f) => f
    None => fail("detect_format missed the JPEG magic")
  }
  assert_true(png.is_decodable())
  assert_true(gif.is_decodable())
  assert_true(tga.is_decodable())
  assert_true(jpeg.is_decodable())
}

// ---------------------------------------------------------------------------
// Golden pixel values
//
// The structural assertions above catch dimension / format regressions.
// These catch pixel-level regressions (a swapped channel, a wrong stride,
// a dropped alpha byte) that only show up in the bytes themselves.
//
// The PNG / GIF / TGA values are byte-identical to Pillow's reference
// decode of the same files. The JPEG values are this decoder's own
// deterministic output: the samples are 4:2:0 and this decoder upsamples
// chroma nearest-neighbour, while libjpeg (hence Pillow) uses "fancy"
// triangular upsampling, so chroma differs from Pillow by a few units.
// Both are valid 4:2:0 decodes; the golden pins the behaviour we ship.
// ---------------------------------------------------------------------------

///|
fn assert_leading_bytes(img : Image, expected : Array[Int32]) -> Unit raise {
  assert_true(img.data.length() >= expected.length())
  for i = 0; i < expected.length(); i = i + 1 {
    let got = img.data[i].to_int()
    if got != expected[i] {
      fail(
        "pixel byte " +
        i.to_string() +
        " is " +
        got.to_string() +
        ", expected " +
        expected[i].to_string(),
      )
    }
  }
}

///|
test "golden: png pixels match the reference decode" {
  assert_leading_bytes(
    decode_png(fixture_png_tiny_1x1_rgba()) catch {
      _ => fail("decode_png raised")
    },
    [255, 0, 0, 255],
  )
  assert_leading_bytes(
    decode_png(fixture_png_palette_16x16()) catch {
      _ => fail("decode_png raised")
    },
    [0, 255, 0, 255, 16, 239, 48, 255, 32, 223, 96, 255],
  )
  assert_leading_bytes(
    decode_png(fixture_png_gradient_32x32()) catch {
      _ => fail("decode_png raised")
    },
    [0, 0, 0, 255, 8, 0, 4, 255, 16, 0, 8, 255],
  )
}

///|
test "golden: gif pixels match the reference decode" {
  assert_leading_bytes(
    decode_gif(fixture_gif_tiny_1x1()) catch {
      _ => fail("decode_gif raised")
    },
    [42, 42, 42, 255],
  )
  assert_leading_bytes(
    decode_gif(fixture_gif_palette_32x32()) catch {
      _ => fail("decode_gif raised")
    },
    [0, 255, 0, 255, 8, 247, 56, 255, 16, 239, 112, 255],
  )
  assert_leading_bytes(
    decode_gif(fixture_gif_animated_8x8()) catch {
      _ => fail("decode_gif raised")
    },
    [255, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255],
  )
}

///|
test "golden: tga pixels match the reference decode" {
  assert_leading_bytes(
    decode_tga(fixture_tga_tiny_1x1_24()) catch {
      _ => fail("decode_tga raised")
    },
    [0, 255, 0, 255],
  )
  assert_leading_bytes(
    decode_tga(fixture_tga_grayscale_32x32()) catch {
      _ => fail("decode_tga raised")
    },
    [0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88],
  )
  assert_leading_bytes(
    decode_tga(fixture_tga_rgba_32x32()) catch {
      _ => fail("decode_tga raised")
    },
    [0, 0, 0, 255, 8, 0, 4, 255, 16, 0, 8, 255],
  )
}

///|
test "golden: jpeg pixels match this decoder's deterministic output" {
  assert_leading_bytes(
    decode_jpeg(fixture_jpeg_tiny_1x1()) catch {
      _ => fail("decode_jpeg raised")
    },
    [10, 20, 30],
  )
  assert_leading_bytes(
    decode_jpeg(fixture_jpeg_natural_64x64()) catch {
      _ => fail("decode_jpeg raised")
    },
    [3, 0, 0, 5, 1, 0, 6, 6, 4, 9, 9, 7],
  )
  assert_leading_bytes(
    decode_jpeg(fixture_jpeg_hq_64x64()) catch {
      _ => fail("decode_jpeg raised")
    },
    [0, 0, 4, 1, 0, 5, 2, 0, 11, 3, 1, 12],
  )
}