def test_data(self): tile = GBTile() assert len(tile.data) == 16 assert tile.data[0] == 0x00 assert tile.data[1] == 0x00 tile.put_pixel(0, 0, 3) assert tile.data[0] == 0x80 assert tile.data[1] == 0x80
def test_to_image(self, image): tile = GBTile.from_image(image, 32) tile_image = tile.to_image() assert tile_image.getpixel((0, 0)) == 0b00 assert tile_image.getpixel((0, 6)) == 0b01 assert tile_image.getpixel((2, 6)) == 0b10 assert tile_image.getpixel((5, 0)) == 0b11
def test_gbtile_equality(self): tile1 = GBTile() tile2 = GBTile() assert tile1 == tile2 tile1.put_pixel(0, 0, 3) assert tile1 != tile2 tile2.put_pixel(0, 0, 3) assert tile1 == tile2
def test_to_hex_string(self): tile = GBTile() assert tile.to_hex_string( ) == "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" # noqa tile.put_pixel(0, 0, 3) tile.put_pixel(1, 0, 3) assert tile.to_hex_string( ) == "C0 C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00" # noqa
def test_put_pixel(self): tile = GBTile() for b in tile.data: assert b == 0 tile.put_pixel(0, 0, 3) assert tile.data[0] == 0x80 assert tile.data[1] == 0x80 tile.put_pixel(4, 0, 2) assert tile.data[0] == 0x80 assert tile.data[1] == 0x88
def tile2(self): tile = GBTile() tile.put_pixel(0, 0, 3) return tile
def tile1(self): return GBTile()
def tile(self, image): return GBTile.from_image(image, 8, 0)
def test_get_pixel(self, image): tile = GBTile.from_image(image, 32) assert tile.get_pixel(0, 0) == 0b00 assert tile.get_pixel(0, 6) == 0b01 assert tile.get_pixel(2, 6) == 0b10 assert tile.get_pixel(5, 0) == 0b11
def test_from_image(self, image, x, result): tile = GBTile.from_image(image, x) assert tile.to_hex_string() == result