MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_3058

Function test_3058

tests/test_pixmap.py:205–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

203 assert wt == 'PDF stream Length incorrect'
204
205def test_3058():
206 doc = pymupdf.Document(os.path.abspath(f'{__file__}/../../tests/resources/test_3058.pdf'))
207 images = doc[0].get_images(full=True)
208 pix = pymupdf.Pixmap(doc, 17)
209
210 # First bug was that `pix.colorspace` was DeviceRGB.
211 assert str(pix.colorspace) == 'Colorspace(CS_CMYK) - DeviceCMYK'
212
213 pix = pymupdf.Pixmap(pymupdf.csRGB, pix)
214 assert str(pix.colorspace) == 'Colorspace(CS_RGB) - DeviceRGB'
215
216 # Second bug was that the image was converted to RGB via greyscale proofing
217 # color space, so image contained only shades of grey. This compressed
218 # easily to a .png file, so we crudely check the bug is fixed by looking at
219 # size of .png file.
220 path = os.path.abspath(f'{__file__}/../../tests/test_3058_out.png')
221 pix.save(path)
222 s = os.path.getsize(path)
223 assert 1800000 < s < 2600000, f'Unexpected size of {path}: {s}'
224
225def test_3072():
226 path = os.path.abspath(f'{__file__}/../../tests/resources/test_3072.pdf')

Callers

nothing calls this directly

Calls 2

saveMethod · 0.95
get_imagesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…