diff --git a/test/test-suite/helpers/helpers.py b/test/test-suite/helpers/helpers.py index 39e5efc2..7a8b7caa 100644 --- a/test/test-suite/helpers/helpers.py +++ b/test/test-suite/helpers/helpers.py @@ -28,6 +28,7 @@ GIF_ANIM_FILE = os.path.join(IMAGES, "cogs.gif") DICOM_FILE = os.path.join(IMAGES, "dicom_test_image.dcm") BMP_FILE = os.path.join(IMAGES, "MARBLES.BMP") NIFTI_FILE = os.path.join(IMAGES, "avg152T1_LR_nifti.nii.gz") +ICO_FILE = os.path.join(IMAGES, "favicon.ico") unsigned_formats = [pyvips.BandFormat.UCHAR, pyvips.BandFormat.USHORT, diff --git a/test/test-suite/images/favicon.ico b/test/test-suite/images/favicon.ico new file mode 100644 index 00000000..e8941291 Binary files /dev/null and b/test/test-suite/images/favicon.ico differ diff --git a/test/test-suite/test_foreign.py b/test/test-suite/test_foreign.py index f6db157a..103ed639 100644 --- a/test/test-suite/test_foreign.py +++ b/test/test-suite/test_foreign.py @@ -10,7 +10,7 @@ from helpers import \ JPEG_FILE, SRGB_FILE, MATLAB_FILE, PNG_FILE, TIF_FILE, OME_FILE, \ ANALYZE_FILE, GIF_FILE, WEBP_FILE, EXR_FILE, FITS_FILE, OPENSLIDE_FILE, \ PDF_FILE, SVG_FILE, SVGZ_FILE, SVG_GZ_FILE, GIF_ANIM_FILE, DICOM_FILE, \ - BMP_FILE, NIFTI_FILE, \ + BMP_FILE, NIFTI_FILE, ICO_FILE, \ temp_filename, assert_almost_equal_objects, have, skip_if_no @@ -428,11 +428,18 @@ class TestForeign: # assert im.bands == 1 # added in 8.7 - if have("magicksave"): - self.save_load_file(".bmp", "", self.colour, 0) - self.save_load_buffer("magicksave_buffer", "magickload_buffer", - self.colour, 0, format="BMP") - self.save_load("%s.bmp", self.colour) + self.save_load_file(".bmp", "", self.colour, 0) + self.save_load_buffer("magicksave_buffer", "magickload_buffer", + self.colour, 0, format="BMP") + self.save_load("%s.bmp", self.colour) + + # libvips has its own sniffer for ICO, test that + with open(ICO_FILE, 'rb') as f: + buf = f.read() + + im = pyvips.Image.new_from_buffer(buf, "") + assert im.width == 16 + assert im.height == 16 @skip_if_no("webpload") def test_webp(self):