fixup! Add tests for loading/saving of 16-bit quantization tables

This commit is contained in:
gofr 2020-10-10 20:01:28 +02:00
parent 2f0544b542
commit d54dc4062f

View File

@ -446,7 +446,7 @@ class TestFileJpeg:
assert len(im.quantization) == n assert len(im.quantization) == n
reloaded = self.roundtrip(im, qtables="keep") reloaded = self.roundtrip(im, qtables="keep")
assert im.quantization == reloaded.quantization assert im.quantization == reloaded.quantization
assert reloaded.quantization[0].typecode == 'B' assert reloaded.quantization[0].typecode == "B"
with Image.open("Tests/images/hopper.jpg") as im: with Image.open("Tests/images/hopper.jpg") as im:
qtables = im.quantization qtables = im.quantization
@ -553,12 +553,12 @@ class TestFileJpeg:
def test_save_multiple_16bit_qtables(self): def test_save_multiple_16bit_qtables(self):
with Image.open("Tests/images/hopper_16bit_qtables.jpg") as im: with Image.open("Tests/images/hopper_16bit_qtables.jpg") as im:
im2 = self.roundtrip(im, qtables='keep') im2 = self.roundtrip(im, qtables="keep")
assert im.quantization == im2.quantization assert im.quantization == im2.quantization
def test_save_single_16bit_qtable(self): def test_save_single_16bit_qtable(self):
with Image.open("Tests/images/hopper_16bit_qtables.jpg") as im: with Image.open("Tests/images/hopper_16bit_qtables.jpg") as im:
im2 = self.roundtrip(im, qtables=[im.quantization[0]]) im2 = self.roundtrip(im, qtables={0: im.quantization[0]})
assert len(im2.quantization) == 1 assert len(im2.quantization) == 1
assert im2.quantization[0] == im.quantization[0] assert im2.quantization[0] == im.quantization[0]