diff --git a/weasyprint/tests/test_api.py b/weasyprint/tests/test_api.py
index a1a2c939..448e8f79 100644
--- a/weasyprint/tests/test_api.py
+++ b/weasyprint/tests/test_api.py
@@ -271,7 +271,8 @@ def test_python_render(tmpdir):
with open(pdf_file.strpath, 'wb') as pdf_fd:
html.write_pdf(pdf_fd, stylesheets=[css])
assert png_file.read_binary() == png_bytes
- assert pdf_file.read_binary() == pdf_bytes
+ if cairo.cairo_version() >= 11504:
+ assert pdf_file.read_binary() == pdf_bytes
x2_png_bytes = html.write_png(stylesheets=[css], resolution=192)
check_png_pattern(x2_png_bytes, x2=True)
@@ -330,7 +331,8 @@ def test_command_line_render(tmpdir):
_run('combined.html out1.png')
_run('combined.html out2.pdf')
assert tmpdir.join('out1.png').read_binary() == png_bytes
- assert tmpdir.join('out2.pdf').read_binary() == pdf_bytes
+ if cairo.cairo_version() >= 11504:
+ assert tmpdir.join('out2.pdf').read_binary() == pdf_bytes
_run('combined-UTF-16BE.html out3.png --encoding UTF-16BE')
assert tmpdir.join('out3.png').read_binary() == png_bytes
@@ -347,12 +349,14 @@ def test_command_line_render(tmpdir):
_run('combined.html out7 -f png')
_run('combined.html out8 --format pdf')
assert tmpdir.join('out7').read_binary() == png_bytes
- assert tmpdir.join('out8').read_binary(), pdf_bytes
+ if cairo.cairo_version() >= 11504:
+ assert tmpdir.join('out8').read_binary(), pdf_bytes
_run('no_css.html out9.png')
_run('no_css.html out10.png -s style.css')
assert tmpdir.join('out9.png').read_binary() != png_bytes
- assert tmpdir.join('out10.png').read_binary() == png_bytes
+ if cairo.cairo_version() >= 11504:
+ assert tmpdir.join('out10.png').read_binary() == png_bytes
stdout = _run('--format png combined.html -')
assert stdout == png_bytes
diff --git a/weasyprint/tests/test_pdf.py b/weasyprint/tests/test_pdf.py
index 873d86c2..4bf5dab1 100644
--- a/weasyprint/tests/test_pdf.py
+++ b/weasyprint/tests/test_pdf.py
@@ -19,7 +19,7 @@ import pytest
from .. import Attachment, pdf
from ..urls import path2url
from .testing_utils import (
- FakeHTML, assert_no_logs, capture_logs, resource_filename)
+ FakeHTML, assert_no_logs, capture_logs, requires, resource_filename)
# Top of the page is 297mm ~= 842pt
TOP = 842
@@ -59,6 +59,7 @@ def test_page_size_zoom(zoom):
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_bookmarks_1():
fileobj = io.BytesIO()
FakeHTML(string='''
@@ -99,6 +100,7 @@ def test_bookmarks_2():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_bookmarks_3():
fileobj = io.BytesIO()
FakeHTML(string='
a nbsp…
').write_pdf(target=fileobj)
@@ -111,6 +113,7 @@ def test_bookmarks_3():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_bookmarks_4():
fileobj = io.BytesIO()
FakeHTML(string='''
@@ -175,6 +178,7 @@ def test_bookmarks_4():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_bookmarks_5():
fileobj = io.BytesIO()
FakeHTML(string='''
@@ -206,6 +210,7 @@ def test_bookmarks_5():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_bookmarks_6():
fileobj = io.BytesIO()
FakeHTML(string='''
@@ -253,6 +258,7 @@ def test_bookmarks_6():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_bookmarks_7():
# Reference for the next test. zoom=1
fileobj = io.BytesIO()
@@ -287,6 +293,7 @@ def test_links_none():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_links():
fileobj = io.BytesIO()
FakeHTML(string='''
@@ -367,6 +374,7 @@ def test_links():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_relative_links():
# Relative URI reference without a base URI: allowed for anchors
fileobj = io.BytesIO()
@@ -398,6 +406,7 @@ def test_relative_links_missing_base():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_relative_links_internal():
# Internal URI reference without a base URI: OK
fileobj = io.BytesIO()
@@ -414,6 +423,7 @@ def test_relative_links_internal():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_relative_links_anchors():
fileobj = io.BytesIO()
FakeHTML(
@@ -429,6 +439,7 @@ def test_relative_links_anchors():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_missing_links():
fileobj = io.BytesIO()
with capture_logs() as logs:
@@ -464,6 +475,7 @@ def test_embed_jpeg():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_document_info():
fileobj = io.BytesIO()
FakeHTML(string='''
@@ -490,6 +502,7 @@ def test_document_info():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_embedded_files_attachments(tmpdir):
absolute_tmp_file = tmpdir.join('some_file.txt').strpath
adata = b'12345678'
@@ -577,6 +590,7 @@ def test_attachments_data():
@assert_no_logs
+@requires('cairo', (1, 15, 4))
def test_attachments_none():
fileobj = io.BytesIO()
FakeHTML(string='''
diff --git a/weasyprint/tests/test_tools.py b/weasyprint/tests/test_tools.py
index 3a1d4948..95a26aac 100644
--- a/weasyprint/tests/test_tools.py
+++ b/weasyprint/tests/test_tools.py
@@ -12,6 +12,8 @@
import io
from urllib.parse import urlencode
+import cairocffi as cairo
+
from ..tools import navigator, renderer
from ..urls import path2url
from .testing_utils import assert_no_logs
@@ -72,8 +74,9 @@ def test_navigator(tmpdir):
assert status == '200 OK'
assert headers['Content-Type'] == 'application/pdf'
assert body.startswith(b'%PDF')
- assert b'/URI (http://weasyprint.org)' in body
- assert b'/Title (Lorem ipsum)' in body
+ if cairo.cairo_version() >= 11504:
+ assert b'/URI (http://weasyprint.org)' in body
+ assert b'/Title (Lorem ipsum)' in body
@assert_no_logs