1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-04 07:57:52 +03:00

Merge branch '53.x'

This commit is contained in:
Guillaume Ayoub 2021-09-07 22:27:21 +02:00
commit f2cf74d31a
2 changed files with 16 additions and 3 deletions

View File

@ -290,6 +290,17 @@ def test_images_alt():
assert 'inexistent2.png' in logs[0]
@assert_no_logs
def test_images_repeat_transparent():
# Test regression: https://github.com/Kozea/WeasyPrint/issues/1440
assert_pixels('image_repeat_transparent', 1, 3, '_\n_\n_', '''
<style>
@page { size: 1px }
div { height: 100px; width: 100px; background: url(logo_small.png) }
</style>
<div></div><div></div><div></div>''')
@assert_no_logs
def test_images_no_width():
assert_pixels('image_0x1', 8, 8, no_image, '''

View File

@ -902,9 +902,10 @@ class Document:
for key, x_object in resources.get('XObject', {}).items():
# Images
if x_object is None:
x_object = images[key]
else:
pdf.add_object(x_object)
resources['XObject'][key] = images[key].reference
continue # function already called when images are added
pdf.add_object(x_object)
resources['XObject'][key] = x_object.reference
# Masks
@ -1401,6 +1402,7 @@ class Document:
resources['Font'] = pdf_fonts.reference
for image in images.values():
pdf.add_object(image)
self._use_references(pdf, image.extra, images)
self._use_references(pdf, resources, images)
# Anchors