defmodule Imagineer.Image.PNG.PngSuite.Basic.RGBAlphaTest do
  use ExUnit.Case, async: true

  @test_path "test/support/images/pngsuite/basic/"
  @tmp_path "./tmp/"

  @actual_pixels [
    [
      {255, 0, 8, 0},
      {255, 0, 8, 8},
      {255, 0, 8, 16},
      {255, 0, 8, 24},
      {255, 0, 8, 32},
      {255, 0, 8, 41},
      {255, 0, 8, 49},
      {255, 0, 8, 57},
      {255, 0, 8, 65},
      {255, 0, 8, 74},
      {255, 0, 8, 82},
      {255, 0, 8, 90},
      {255, 0, 8, 98},
      {255, 0, 8, 106},
      {255, 0, 8, 115},
      {255, 0, 8, 123},
      {255, 0, 8, 131},
      {255, 0, 8, 139},
      {255, 0, 8, 148},
      {255, 0, 8, 156},
      {255, 0, 8, 164},
      {255, 0, 8, 172},
      {255, 0, 8, 180},
      {255, 0, 8, 189},
      {255, 0, 8, 197},
      {255, 0, 8, 205},
      {255, 0, 8, 213},
      {255, 0, 8, 222},
      {255, 0, 8, 230},
      {255, 0, 8, 238},
      {255, 0, 8, 246},
      {255, 0, 8, 255}
    ],
    [
      {255, 31, 8, 0},
      {255, 31, 8, 8},
      {255, 31, 8, 16},
      {255, 31, 8, 24},
      {255, 31, 8, 32},
      {255, 31, 8, 41},
      {255, 31, 8, 49},
      {255, 31, 8, 57},
      {255, 31, 8, 65},
      {255, 31, 8, 74},
      {255, 31, 8, 82},
      {255, 31, 8, 90},
      {255, 31, 8, 98},
      {255, 31, 8, 106},
      {255, 31, 8, 115},
      {255, 31, 8, 123},
      {255, 31, 8, 131},
      {255, 31, 8, 139},
      {255, 31, 8, 148},
      {255, 31, 8, 156},
      {255, 31, 8, 164},
      {255, 31, 8, 172},
      {255, 31, 8, 180},
      {255, 31, 8, 189},
      {255, 31, 8, 197},
      {255, 31, 8, 205},
      {255, 31, 8, 213},
      {255, 31, 8, 222},
      {255, 31, 8, 230},
      {255, 31, 8, 238},
      {255, 31, 8, 246},
      {255, 31, 8, 255}
    ],
    [
      {255, 63, 8, 0},
      {255, 63, 8, 8},
      {255, 63, 8, 16},
      {255, 63, 8, 24},
      {255, 63, 8, 32},
      {255, 63, 8, 41},
      {255, 63, 8, 49},
      {255, 63, 8, 57},
      {255, 63, 8, 65},
      {255, 63, 8, 74},
      {255, 63, 8, 82},
      {255, 63, 8, 90},
      {255, 63, 8, 98},
      {255, 63, 8, 106},
      {255, 63, 8, 115},
      {255, 63, 8, 123},
      {255, 63, 8, 131},
      {255, 63, 8, 139},
      {255, 63, 8, 148},
      {255, 63, 8, 156},
      {255, 63, 8, 164},
      {255, 63, 8, 172},
      {255, 63, 8, 180},
      {255, 63, 8, 189},
      {255, 63, 8, 197},
      {255, 63, 8, 205},
      {255, 63, 8, 213},
      {255, 63, 8, 222},
      {255, 63, 8, 230},
      {255, 63, 8, 238},
      {255, 63, 8, 246},
      {255, 63, 8, 255}
    ],
    [
      {255, 95, 8, 0},
      {255, 95, 8, 8},
      {255, 95, 8, 16},
      {255, 95, 8, 24},
      {255, 95, 8, 32},
      {255, 95, 8, 41},
      {255, 95, 8, 49},
      {255, 95, 8, 57},
      {255, 95, 8, 65},
      {255, 95, 8, 74},
      {255, 95, 8, 82},
      {255, 95, 8, 90},
      {255, 95, 8, 98},
      {255, 95, 8, 106},
      {255, 95, 8, 115},
      {255, 95, 8, 123},
      {255, 95, 8, 131},
      {255, 95, 8, 139},
      {255, 95, 8, 148},
      {255, 95, 8, 156},
      {255, 95, 8, 164},
      {255, 95, 8, 172},
      {255, 95, 8, 180},
      {255, 95, 8, 189},
      {255, 95, 8, 197},
      {255, 95, 8, 205},
      {255, 95, 8, 213},
      {255, 95, 8, 222},
      {255, 95, 8, 230},
      {255, 95, 8, 238},
      {255, 95, 8, 246},
      {255, 95, 8, 255}
    ],
    [
      {255, 127, 7, 0},
      {255, 127, 7, 8},
      {255, 127, 7, 16},
      {255, 127, 7, 24},
      {255, 127, 7, 32},
      {255, 127, 7, 41},
      {255, 127, 7, 49},
      {255, 127, 7, 57},
      {255, 127, 7, 65},
      {255, 127, 7, 74},
      {255, 127, 7, 82},
      {255, 127, 7, 90},
      {255, 127, 7, 98},
      {255, 127, 7, 106},
      {255, 127, 7, 115},
      {255, 127, 7, 123},
      {255, 127, 7, 131},
      {255, 127, 7, 139},
      {255, 127, 7, 148},
      {255, 127, 7, 156},
      {255, 127, 7, 164},
      {255, 127, 7, 172},
      {255, 127, 7, 180},
      {255, 127, 7, 189},
      {255, 127, 7, 197},
      {255, 127, 7, 205},
      {255, 127, 7, 213},
      {255, 127, 7, 222},
      {255, 127, 7, 230},
      {255, 127, 7, 238},
      {255, 127, 7, 246},
      {255, 127, 7, 255}
    ],
    [
      {255, 159, 7, 0},
      {255, 159, 7, 8},
      {255, 159, 7, 16},
      {255, 159, 7, 24},
      {255, 159, 7, 32},
      {255, 159, 7, 41},
      {255, 159, 7, 49},
      {255, 159, 7, 57},
      {255, 159, 7, 65},
      {255, 159, 7, 74},
      {255, 159, 7, 82},
      {255, 159, 7, 90},
      {255, 159, 7, 98},
      {255, 159, 7, 106},
      {255, 159, 7, 115},
      {255, 159, 7, 123},
      {255, 159, 7, 131},
      {255, 159, 7, 139},
      {255, 159, 7, 148},
      {255, 159, 7, 156},
      {255, 159, 7, 164},
      {255, 159, 7, 172},
      {255, 159, 7, 180},
      {255, 159, 7, 189},
      {255, 159, 7, 197},
      {255, 159, 7, 205},
      {255, 159, 7, 213},
      {255, 159, 7, 222},
      {255, 159, 7, 230},
      {255, 159, 7, 238},
      {255, 159, 7, 246},
      {255, 159, 7, 255}
    ],
    [
      {255, 191, 7, 0},
      {255, 191, 7, 8},
      {255, 191, 7, 16},
      {255, 191, 7, 24},
      {255, 191, 7, 32},
      {255, 191, 7, 41},
      {255, 191, 7, 49},
      {255, 191, 7, 57},
      {255, 191, 7, 65},
      {255, 191, 7, 74},
      {255, 191, 7, 82},
      {255, 191, 7, 90},
      {255, 191, 7, 98},
      {255, 191, 7, 106},
      {255, 191, 7, 115},
      {255, 191, 7, 123},
      {255, 191, 7, 131},
      {255, 191, 7, 139},
      {255, 191, 7, 148},
      {255, 191, 7, 156},
      {255, 191, 7, 164},
      {255, 191, 7, 172},
      {255, 191, 7, 180},
      {255, 191, 7, 189},
      {255, 191, 7, 197},
      {255, 191, 7, 205},
      {255, 191, 7, 213},
      {255, 191, 7, 222},
      {255, 191, 7, 230},
      {255, 191, 7, 238},
      {255, 191, 7, 246},
      {255, 191, 7, 255}
    ],
    [
      {255, 223, 7, 0},
      {255, 223, 7, 8},
      {255, 223, 7, 16},
      {255, 223, 7, 24},
      {255, 223, 7, 32},
      {255, 223, 7, 41},
      {255, 223, 7, 49},
      {255, 223, 7, 57},
      {255, 223, 7, 65},
      {255, 223, 7, 74},
      {255, 223, 7, 82},
      {255, 223, 7, 90},
      {255, 223, 7, 98},
      {255, 223, 7, 106},
      {255, 223, 7, 115},
      {255, 223, 7, 123},
      {255, 223, 7, 131},
      {255, 223, 7, 139},
      {255, 223, 7, 148},
      {255, 223, 7, 156},
      {255, 223, 7, 164},
      {255, 223, 7, 172},
      {255, 223, 7, 180},
      {255, 223, 7, 189},
      {255, 223, 7, 197},
      {255, 223, 7, 205},
      {255, 223, 7, 213},
      {255, 223, 7, 222},
      {255, 223, 7, 230},
      {255, 223, 7, 238},
      {255, 223, 7, 246},
      {255, 223, 7, 255}
    ],
    [
      {255, 255, 6, 0},
      {255, 255, 6, 8},
      {255, 255, 6, 16},
      {255, 255, 6, 24},
      {255, 255, 6, 32},
      {255, 255, 6, 41},
      {255, 255, 6, 49},
      {255, 255, 6, 57},
      {255, 255, 6, 65},
      {255, 255, 6, 74},
      {255, 255, 6, 82},
      {255, 255, 6, 90},
      {255, 255, 6, 98},
      {255, 255, 6, 106},
      {255, 255, 6, 115},
      {255, 255, 6, 123},
      {255, 255, 6, 131},
      {255, 255, 6, 139},
      {255, 255, 6, 148},
      {255, 255, 6, 156},
      {255, 255, 6, 164},
      {255, 255, 6, 172},
      {255, 255, 6, 180},
      {255, 255, 6, 189},
      {255, 255, 6, 197},
      {255, 255, 6, 205},
      {255, 255, 6, 213},
      {255, 255, 6, 222},
      {255, 255, 6, 230},
      {255, 255, 6, 238},
      {255, 255, 6, 246},
      {255, 255, 6, 255}
    ],
    [
      {224, 255, 6, 0},
      {224, 255, 6, 8},
      {224, 255, 6, 16},
      {224, 255, 6, 24},
      {224, 255, 6, 32},
      {224, 255, 6, 41},
      {224, 255, 6, 49},
      {224, 255, 6, 57},
      {224, 255, 6, 65},
      {224, 255, 6, 74},
      {224, 255, 6, 82},
      {224, 255, 6, 90},
      {224, 255, 6, 98},
      {224, 255, 6, 106},
      {224, 255, 6, 115},
      {224, 255, 6, 123},
      {224, 255, 6, 131},
      {224, 255, 6, 139},
      {224, 255, 6, 148},
      {224, 255, 6, 156},
      {224, 255, 6, 164},
      {224, 255, 6, 172},
      {224, 255, 6, 180},
      {224, 255, 6, 189},
      {224, 255, 6, 197},
      {224, 255, 6, 205},
      {224, 255, 6, 213},
      {224, 255, 6, 222},
      {224, 255, 6, 230},
      {224, 255, 6, 238},
      {224, 255, 6, 246},
      {224, 255, 6, 255}
    ],
    [
      {192, 255, 6, 0},
      {192, 255, 6, 8},
      {192, 255, 6, 16},
      {192, 255, 6, 24},
      {192, 255, 6, 32},
      {192, 255, 6, 41},
      {192, 255, 6, 49},
      {192, 255, 6, 57},
      {192, 255, 6, 65},
      {192, 255, 6, 74},
      {192, 255, 6, 82},
      {192, 255, 6, 90},
      {192, 255, 6, 98},
      {192, 255, 6, 106},
      {192, 255, 6, 115},
      {192, 255, 6, 123},
      {192, 255, 6, 131},
      {192, 255, 6, 139},
      {192, 255, 6, 148},
      {192, 255, 6, 156},
      {192, 255, 6, 164},
      {192, 255, 6, 172},
      {192, 255, 6, 180},
      {192, 255, 6, 189},
      {192, 255, 6, 197},
      {192, 255, 6, 205},
      {192, 255, 6, 213},
      {192, 255, 6, 222},
      {192, 255, 6, 230},
      {192, 255, 6, 238},
      {192, 255, 6, 246},
      {192, 255, 6, 255}
    ],
    [
      {160, 255, 5, 0},
      {160, 255, 5, 8},
      {160, 255, 5, 16},
      {160, 255, 5, 24},
      {160, 255, 5, 32},
      {160, 255, 5, 41},
      {160, 255, 5, 49},
      {160, 255, 5, 57},
      {160, 255, 5, 65},
      {160, 255, 5, 74},
      {160, 255, 5, 82},
      {160, 255, 5, 90},
      {160, 255, 5, 98},
      {160, 255, 5, 106},
      {160, 255, 5, 115},
      {160, 255, 5, 123},
      {160, 255, 5, 131},
      {160, 255, 5, 139},
      {160, 255, 5, 148},
      {160, 255, 5, 156},
      {160, 255, 5, 164},
      {160, 255, 5, 172},
      {160, 255, 5, 180},
      {160, 255, 5, 189},
      {160, 255, 5, 197},
      {160, 255, 5, 205},
      {160, 255, 5, 213},
      {160, 255, 5, 222},
      {160, 255, 5, 230},
      {160, 255, 5, 238},
      {160, 255, 5, 246},
      {160, 255, 5, 255}
    ],
    [
      {128, 255, 5, 0},
      {128, 255, 5, 8},
      {128, 255, 5, 16},
      {128, 255, 5, 24},
      {128, 255, 5, 32},
      {128, 255, 5, 41},
      {128, 255, 5, 49},
      {128, 255, 5, 57},
      {128, 255, 5, 65},
      {128, 255, 5, 74},
      {128, 255, 5, 82},
      {128, 255, 5, 90},
      {128, 255, 5, 98},
      {128, 255, 5, 106},
      {128, 255, 5, 115},
      {128, 255, 5, 123},
      {128, 255, 5, 131},
      {128, 255, 5, 139},
      {128, 255, 5, 148},
      {128, 255, 5, 156},
      {128, 255, 5, 164},
      {128, 255, 5, 172},
      {128, 255, 5, 180},
      {128, 255, 5, 189},
      {128, 255, 5, 197},
      {128, 255, 5, 205},
      {128, 255, 5, 213},
      {128, 255, 5, 222},
      {128, 255, 5, 230},
      {128, 255, 5, 238},
      {128, 255, 5, 246},
      {128, 255, 5, 255}
    ],
    [
      {96, 255, 5, 0},
      {96, 255, 5, 8},
      {96, 255, 5, 16},
      {96, 255, 5, 24},
      {96, 255, 5, 32},
      {96, 255, 5, 41},
      {96, 255, 5, 49},
      {96, 255, 5, 57},
      {96, 255, 5, 65},
      {96, 255, 5, 74},
      {96, 255, 5, 82},
      {96, 255, 5, 90},
      {96, 255, 5, 98},
      {96, 255, 5, 106},
      {96, 255, 5, 115},
      {96, 255, 5, 123},
      {96, 255, 5, 131},
      {96, 255, 5, 139},
      {96, 255, 5, 148},
      {96, 255, 5, 156},
      {96, 255, 5, 164},
      {96, 255, 5, 172},
      {96, 255, 5, 180},
      {96, 255, 5, 189},
      {96, 255, 5, 197},
      {96, 255, 5, 205},
      {96, 255, 5, 213},
      {96, 255, 5, 222},
      {96, 255, 5, 230},
      {96, 255, 5, 238},
      {96, 255, 5, 246},
      {96, 255, 5, 255}
    ],
    [
      {64, 255, 5, 0},
      {64, 255, 5, 8},
      {64, 255, 5, 16},
      {64, 255, 5, 24},
      {64, 255, 5, 32},
      {64, 255, 5, 41},
      {64, 255, 5, 49},
      {64, 255, 5, 57},
      {64, 255, 5, 65},
      {64, 255, 5, 74},
      {64, 255, 5, 82},
      {64, 255, 5, 90},
      {64, 255, 5, 98},
      {64, 255, 5, 106},
      {64, 255, 5, 115},
      {64, 255, 5, 123},
      {64, 255, 5, 131},
      {64, 255, 5, 139},
      {64, 255, 5, 148},
      {64, 255, 5, 156},
      {64, 255, 5, 164},
      {64, 255, 5, 172},
      {64, 255, 5, 180},
      {64, 255, 5, 189},
      {64, 255, 5, 197},
      {64, 255, 5, 205},
      {64, 255, 5, 213},
      {64, 255, 5, 222},
      {64, 255, 5, 230},
      {64, 255, 5, 238},
      {64, 255, 5, 246},
      {64, 255, 5, 255}
    ],
    [
      {32, 255, 4, 0},
      {32, 255, 4, 8},
      {32, 255, 4, 16},
      {32, 255, 4, 24},
      {32, 255, 4, 32},
      {32, 255, 4, 41},
      {32, 255, 4, 49},
      {32, 255, 4, 57},
      {32, 255, 4, 65},
      {32, 255, 4, 74},
      {32, 255, 4, 82},
      {32, 255, 4, 90},
      {32, 255, 4, 98},
      {32, 255, 4, 106},
      {32, 255, 4, 115},
      {32, 255, 4, 123},
      {32, 255, 4, 131},
      {32, 255, 4, 139},
      {32, 255, 4, 148},
      {32, 255, 4, 156},
      {32, 255, 4, 164},
      {32, 255, 4, 172},
      {32, 255, 4, 180},
      {32, 255, 4, 189},
      {32, 255, 4, 197},
      {32, 255, 4, 205},
      {32, 255, 4, 213},
      {32, 255, 4, 222},
      {32, 255, 4, 230},
      {32, 255, 4, 238},
      {32, 255, 4, 246},
      {32, 255, 4, 255}
    ],
    [
      {4, 255, 0, 0},
      {4, 255, 0, 8},
      {4, 255, 0, 16},
      {4, 255, 0, 24},
      {4, 255, 0, 32},
      {4, 255, 0, 41},
      {4, 255, 0, 49},
      {4, 255, 0, 57},
      {4, 255, 0, 65},
      {4, 255, 0, 74},
      {4, 255, 0, 82},
      {4, 255, 0, 90},
      {4, 255, 0, 98},
      {4, 255, 0, 106},
      {4, 255, 0, 115},
      {4, 255, 0, 123},
      {4, 255, 0, 131},
      {4, 255, 0, 139},
      {4, 255, 0, 148},
      {4, 255, 0, 156},
      {4, 255, 0, 164},
      {4, 255, 0, 172},
      {4, 255, 0, 180},
      {4, 255, 0, 189},
      {4, 255, 0, 197},
      {4, 255, 0, 205},
      {4, 255, 0, 213},
      {4, 255, 0, 222},
      {4, 255, 0, 230},
      {4, 255, 0, 238},
      {4, 255, 0, 246},
      {4, 255, 0, 255}
    ],
    [
      {4, 255, 31, 0},
      {4, 255, 31, 8},
      {4, 255, 31, 16},
      {4, 255, 31, 24},
      {4, 255, 31, 32},
      {4, 255, 31, 41},
      {4, 255, 31, 49},
      {4, 255, 31, 57},
      {4, 255, 31, 65},
      {4, 255, 31, 74},
      {4, 255, 31, 82},
      {4, 255, 31, 90},
      {4, 255, 31, 98},
      {4, 255, 31, 106},
      {4, 255, 31, 115},
      {4, 255, 31, 123},
      {4, 255, 31, 131},
      {4, 255, 31, 139},
      {4, 255, 31, 148},
      {4, 255, 31, 156},
      {4, 255, 31, 164},
      {4, 255, 31, 172},
      {4, 255, 31, 180},
      {4, 255, 31, 189},
      {4, 255, 31, 197},
      {4, 255, 31, 205},
      {4, 255, 31, 213},
      {4, 255, 31, 222},
      {4, 255, 31, 230},
      {4, 255, 31, 238},
      {4, 255, 31, 246},
      {4, 255, 31, 255}
    ],
    [
      {3, 255, 63, 0},
      {3, 255, 63, 8},
      {3, 255, 63, 16},
      {3, 255, 63, 24},
      {3, 255, 63, 32},
      {3, 255, 63, 41},
      {3, 255, 63, 49},
      {3, 255, 63, 57},
      {3, 255, 63, 65},
      {3, 255, 63, 74},
      {3, 255, 63, 82},
      {3, 255, 63, 90},
      {3, 255, 63, 98},
      {3, 255, 63, 106},
      {3, 255, 63, 115},
      {3, 255, 63, 123},
      {3, 255, 63, 131},
      {3, 255, 63, 139},
      {3, 255, 63, 148},
      {3, 255, 63, 156},
      {3, 255, 63, 164},
      {3, 255, 63, 172},
      {3, 255, 63, 180},
      {3, 255, 63, 189},
      {3, 255, 63, 197},
      {3, 255, 63, 205},
      {3, 255, 63, 213},
      {3, 255, 63, 222},
      {3, 255, 63, 230},
      {3, 255, 63, 238},
      {3, 255, 63, 246},
      {3, 255, 63, 255}
    ],
    [
      {3, 255, 95, 0},
      {3, 255, 95, 8},
      {3, 255, 95, 16},
      {3, 255, 95, 24},
      {3, 255, 95, 32},
      {3, 255, 95, 41},
      {3, 255, 95, 49},
      {3, 255, 95, 57},
      {3, 255, 95, 65},
      {3, 255, 95, 74},
      {3, 255, 95, 82},
      {3, 255, 95, 90},
      {3, 255, 95, 98},
      {3, 255, 95, 106},
      {3, 255, 95, 115},
      {3, 255, 95, 123},
      {3, 255, 95, 131},
      {3, 255, 95, 139},
      {3, 255, 95, 148},
      {3, 255, 95, 156},
      {3, 255, 95, 164},
      {3, 255, 95, 172},
      {3, 255, 95, 180},
      {3, 255, 95, 189},
      {3, 255, 95, 197},
      {3, 255, 95, 205},
      {3, 255, 95, 213},
      {3, 255, 95, 222},
      {3, 255, 95, 230},
      {3, 255, 95, 238},
      {3, 255, 95, 246},
      {3, 255, 95, 255}
    ],
    [
      {3, 255, 127, 0},
      {3, 255, 127, 8},
      {3, 255, 127, 16},
      {3, 255, 127, 24},
      {3, 255, 127, 32},
      {3, 255, 127, 41},
      {3, 255, 127, 49},
      {3, 255, 127, 57},
      {3, 255, 127, 65},
      {3, 255, 127, 74},
      {3, 255, 127, 82},
      {3, 255, 127, 90},
      {3, 255, 127, 98},
      {3, 255, 127, 106},
      {3, 255, 127, 115},
      {3, 255, 127, 123},
      {3, 255, 127, 131},
      {3, 255, 127, 139},
      {3, 255, 127, 148},
      {3, 255, 127, 156},
      {3, 255, 127, 164},
      {3, 255, 127, 172},
      {3, 255, 127, 180},
      {3, 255, 127, 189},
      {3, 255, 127, 197},
      {3, 255, 127, 205},
      {3, 255, 127, 213},
      {3, 255, 127, 222},
      {3, 255, 127, 230},
      {3, 255, 127, 238},
      {3, 255, 127, 246},
      {3, 255, 127, 255}
    ],
    [
      {3, 255, 159, 0},
      {3, 255, 159, 8},
      {3, 255, 159, 16},
      {3, 255, 159, 24},
      {3, 255, 159, 32},
      {3, 255, 159, 41},
      {3, 255, 159, 49},
      {3, 255, 159, 57},
      {3, 255, 159, 65},
      {3, 255, 159, 74},
      {3, 255, 159, 82},
      {3, 255, 159, 90},
      {3, 255, 159, 98},
      {3, 255, 159, 106},
      {3, 255, 159, 115},
      {3, 255, 159, 123},
      {3, 255, 159, 131},
      {3, 255, 159, 139},
      {3, 255, 159, 148},
      {3, 255, 159, 156},
      {3, 255, 159, 164},
      {3, 255, 159, 172},
      {3, 255, 159, 180},
      {3, 255, 159, 189},
      {3, 255, 159, 197},
      {3, 255, 159, 205},
      {3, 255, 159, 213},
      {3, 255, 159, 222},
      {3, 255, 159, 230},
      {3, 255, 159, 238},
      {3, 255, 159, 246},
      {3, 255, 159, 255}
    ],
    [
      {2, 255, 191, 0},
      {2, 255, 191, 8},
      {2, 255, 191, 16},
      {2, 255, 191, 24},
      {2, 255, 191, 32},
      {2, 255, 191, 41},
      {2, 255, 191, 49},
      {2, 255, 191, 57},
      {2, 255, 191, 65},
      {2, 255, 191, 74},
      {2, 255, 191, 82},
      {2, 255, 191, 90},
      {2, 255, 191, 98},
      {2, 255, 191, 106},
      {2, 255, 191, 115},
      {2, 255, 191, 123},
      {2, 255, 191, 131},
      {2, 255, 191, 139},
      {2, 255, 191, 148},
      {2, 255, 191, 156},
      {2, 255, 191, 164},
      {2, 255, 191, 172},
      {2, 255, 191, 180},
      {2, 255, 191, 189},
      {2, 255, 191, 197},
      {2, 255, 191, 205},
      {2, 255, 191, 213},
      {2, 255, 191, 222},
      {2, 255, 191, 230},
      {2, 255, 191, 238},
      {2, 255, 191, 246},
      {2, 255, 191, 255}
    ],
    [
      {2, 255, 223, 0},
      {2, 255, 223, 8},
      {2, 255, 223, 16},
      {2, 255, 223, 24},
      {2, 255, 223, 32},
      {2, 255, 223, 41},
      {2, 255, 223, 49},
      {2, 255, 223, 57},
      {2, 255, 223, 65},
      {2, 255, 223, 74},
      {2, 255, 223, 82},
      {2, 255, 223, 90},
      {2, 255, 223, 98},
      {2, 255, 223, 106},
      {2, 255, 223, 115},
      {2, 255, 223, 123},
      {2, 255, 223, 131},
      {2, 255, 223, 139},
      {2, 255, 223, 148},
      {2, 255, 223, 156},
      {2, 255, 223, 164},
      {2, 255, 223, 172},
      {2, 255, 223, 180},
      {2, 255, 223, 189},
      {2, 255, 223, 197},
      {2, 255, 223, 205},
      {2, 255, 223, 213},
      {2, 255, 223, 222},
      {2, 255, 223, 230},
      {2, 255, 223, 238},
      {2, 255, 223, 246},
      {2, 255, 223, 255}
    ],
    [
      {2, 255, 255, 0},
      {2, 255, 255, 8},
      {2, 255, 255, 16},
      {2, 255, 255, 24},
      {2, 255, 255, 32},
      {2, 255, 255, 41},
      {2, 255, 255, 49},
      {2, 255, 255, 57},
      {2, 255, 255, 65},
      {2, 255, 255, 74},
      {2, 255, 255, 82},
      {2, 255, 255, 90},
      {2, 255, 255, 98},
      {2, 255, 255, 106},
      {2, 255, 255, 115},
      {2, 255, 255, 123},
      {2, 255, 255, 131},
      {2, 255, 255, 139},
      {2, 255, 255, 148},
      {2, 255, 255, 156},
      {2, 255, 255, 164},
      {2, 255, 255, 172},
      {2, 255, 255, 180},
      {2, 255, 255, 189},
      {2, 255, 255, 197},
      {2, 255, 255, 205},
      {2, 255, 255, 213},
      {2, 255, 255, 222},
      {2, 255, 255, 230},
      {2, 255, 255, 238},
      {2, 255, 255, 246},
      {2, 255, 255, 255}
    ],
    [
      {1, 224, 255, 0},
      {1, 224, 255, 8},
      {1, 224, 255, 16},
      {1, 224, 255, 24},
      {1, 224, 255, 32},
      {1, 224, 255, 41},
      {1, 224, 255, 49},
      {1, 224, 255, 57},
      {1, 224, 255, 65},
      {1, 224, 255, 74},
      {1, 224, 255, 82},
      {1, 224, 255, 90},
      {1, 224, 255, 98},
      {1, 224, 255, 106},
      {1, 224, 255, 115},
      {1, 224, 255, 123},
      {1, 224, 255, 131},
      {1, 224, 255, 139},
      {1, 224, 255, 148},
      {1, 224, 255, 156},
      {1, 224, 255, 164},
      {1, 224, 255, 172},
      {1, 224, 255, 180},
      {1, 224, 255, 189},
      {1, 224, 255, 197},
      {1, 224, 255, 205},
      {1, 224, 255, 213},
      {1, 224, 255, 222},
      {1, 224, 255, 230},
      {1, 224, 255, 238},
      {1, 224, 255, 246},
      {1, 224, 255, 255}
    ],
    [
      {1, 192, 255, 0},
      {1, 192, 255, 8},
      {1, 192, 255, 16},
      {1, 192, 255, 24},
      {1, 192, 255, 32},
      {1, 192, 255, 41},
      {1, 192, 255, 49},
      {1, 192, 255, 57},
      {1, 192, 255, 65},
      {1, 192, 255, 74},
      {1, 192, 255, 82},
      {1, 192, 255, 90},
      {1, 192, 255, 98},
      {1, 192, 255, 106},
      {1, 192, 255, 115},
      {1, 192, 255, 123},
      {1, 192, 255, 131},
      {1, 192, 255, 139},
      {1, 192, 255, 148},
      {1, 192, 255, 156},
      {1, 192, 255, 164},
      {1, 192, 255, 172},
      {1, 192, 255, 180},
      {1, 192, 255, 189},
      {1, 192, 255, 197},
      {1, 192, 255, 205},
      {1, 192, 255, 213},
      {1, 192, 255, 222},
      {1, 192, 255, 230},
      {1, 192, 255, 238},
      {1, 192, 255, 246},
      {1, 192, 255, 255}
    ],
    [
      {1, 160, 255, 0},
      {1, 160, 255, 8},
      {1, 160, 255, 16},
      {1, 160, 255, 24},
      {1, 160, 255, 32},
      {1, 160, 255, 41},
      {1, 160, 255, 49},
      {1, 160, 255, 57},
      {1, 160, 255, 65},
      {1, 160, 255, 74},
      {1, 160, 255, 82},
      {1, 160, 255, 90},
      {1, 160, 255, 98},
      {1, 160, 255, 106},
      {1, 160, 255, 115},
      {1, 160, 255, 123},
      {1, 160, 255, 131},
      {1, 160, 255, 139},
      {1, 160, 255, 148},
      {1, 160, 255, 156},
      {1, 160, 255, 164},
      {1, 160, 255, 172},
      {1, 160, 255, 180},
      {1, 160, 255, 189},
      {1, 160, 255, 197},
      {1, 160, 255, 205},
      {1, 160, 255, 213},
      {1, 160, 255, 222},
      {1, 160, 255, 230},
      {1, 160, 255, 238},
      {1, 160, 255, 246},
      {1, 160, 255, 255}
    ],
    [
      {1, 128, 255, 0},
      {1, 128, 255, 8},
      {1, 128, 255, 16},
      {1, 128, 255, 24},
      {1, 128, 255, 32},
      {1, 128, 255, 41},
      {1, 128, 255, 49},
      {1, 128, 255, 57},
      {1, 128, 255, 65},
      {1, 128, 255, 74},
      {1, 128, 255, 82},
      {1, 128, 255, 90},
      {1, 128, 255, 98},
      {1, 128, 255, 106},
      {1, 128, 255, 115},
      {1, 128, 255, 123},
      {1, 128, 255, 131},
      {1, 128, 255, 139},
      {1, 128, 255, 148},
      {1, 128, 255, 156},
      {1, 128, 255, 164},
      {1, 128, 255, 172},
      {1, 128, 255, 180},
      {1, 128, 255, 189},
      {1, 128, 255, 197},
      {1, 128, 255, 205},
      {1, 128, 255, 213},
      {1, 128, 255, 222},
      {1, 128, 255, 230},
      {1, 128, 255, 238},
      {1, 128, 255, 246},
      {1, 128, 255, 255}
    ],
    [
      {0, 96, 255, 0},
      {0, 96, 255, 8},
      {0, 96, 255, 16},
      {0, 96, 255, 24},
      {0, 96, 255, 32},
      {0, 96, 255, 41},
      {0, 96, 255, 49},
      {0, 96, 255, 57},
      {0, 96, 255, 65},
      {0, 96, 255, 74},
      {0, 96, 255, 82},
      {0, 96, 255, 90},
      {0, 96, 255, 98},
      {0, 96, 255, 106},
      {0, 96, 255, 115},
      {0, 96, 255, 123},
      {0, 96, 255, 131},
      {0, 96, 255, 139},
      {0, 96, 255, 148},
      {0, 96, 255, 156},
      {0, 96, 255, 164},
      {0, 96, 255, 172},
      {0, 96, 255, 180},
      {0, 96, 255, 189},
      {0, 96, 255, 197},
      {0, 96, 255, 205},
      {0, 96, 255, 213},
      {0, 96, 255, 222},
      {0, 96, 255, 230},
      {0, 96, 255, 238},
      {0, 96, 255, 246},
      {0, 96, 255, 255}
    ],
    [
      {0, 64, 255, 0},
      {0, 64, 255, 8},
      {0, 64, 255, 16},
      {0, 64, 255, 24},
      {0, 64, 255, 32},
      {0, 64, 255, 41},
      {0, 64, 255, 49},
      {0, 64, 255, 57},
      {0, 64, 255, 65},
      {0, 64, 255, 74},
      {0, 64, 255, 82},
      {0, 64, 255, 90},
      {0, 64, 255, 98},
      {0, 64, 255, 106},
      {0, 64, 255, 115},
      {0, 64, 255, 123},
      {0, 64, 255, 131},
      {0, 64, 255, 139},
      {0, 64, 255, 148},
      {0, 64, 255, 156},
      {0, 64, 255, 164},
      {0, 64, 255, 172},
      {0, 64, 255, 180},
      {0, 64, 255, 189},
      {0, 64, 255, 197},
      {0, 64, 255, 205},
      {0, 64, 255, 213},
      {0, 64, 255, 222},
      {0, 64, 255, 230},
      {0, 64, 255, 238},
      {0, 64, 255, 246},
      {0, 64, 255, 255}
    ],
    [
      {0, 32, 255, 0},
      {0, 32, 255, 8},
      {0, 32, 255, 16},
      {0, 32, 255, 24},
      {0, 32, 255, 32},
      {0, 32, 255, 41},
      {0, 32, 255, 49},
      {0, 32, 255, 57},
      {0, 32, 255, 65},
      {0, 32, 255, 74},
      {0, 32, 255, 82},
      {0, 32, 255, 90},
      {0, 32, 255, 98},
      {0, 32, 255, 106},
      {0, 32, 255, 115},
      {0, 32, 255, 123},
      {0, 32, 255, 131},
      {0, 32, 255, 139},
      {0, 32, 255, 148},
      {0, 32, 255, 156},
      {0, 32, 255, 164},
      {0, 32, 255, 172},
      {0, 32, 255, 180},
      {0, 32, 255, 189},
      {0, 32, 255, 197},
      {0, 32, 255, 205},
      {0, 32, 255, 213},
      {0, 32, 255, 222},
      {0, 32, 255, 230},
      {0, 32, 255, 238},
      {0, 32, 255, 246},
      {0, 32, 255, 255}
    ]
  ]
  test "8 bit rgb with alpha channel" do
    {:ok, image} = Imagineer.load(@test_path <> "basn6a08.png")

    assert image.height == 32
    assert image.width == 32

    assert image.color_format == :rgb_alpha
    assert image.compression == :zlib
    assert image.color_type == 6
    assert image.interlace_method == 0
    assert image.gamma == 1.0
    assert image.bit_depth == 8
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @actual_pixels)

    :ok = Imagineer.write(image, @tmp_path <> "basn6a08_test.png")
    {:ok, image} = Imagineer.load(@tmp_path <> "basn6a08_test.png")

    assert image.height == 32
    assert image.width == 32

    assert image.color_format == :rgb_alpha
    assert image.compression == :zlib
    assert image.color_type == 6
    assert image.interlace_method == 0
    assert image.gamma == 1.0
    assert image.bit_depth == 8
    assert image.mask == nil
    assert image.format == :png
    assert image.mime_type == "image/png"
    assert image.palette == []

    assert_pixels_match(image.pixels, @actual_pixels)
  end

  defp assert_pixels_match(parsed_pixels, actual_pixels) do
    Enum.zip(parsed_pixels, actual_pixels)
    |> Enum.with_index()
    |> Enum.each(fn
      {{parsed, actual}, index} ->
        assert(actual == parsed, """
          row #{index + 1} is fucked
          \texpected: #{inspect(actual)}
          \tgot: #{inspect(parsed)}
        """)
    end)
  end
end
