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

refactor: add and use parse_pixels in tests

This commit is contained in:
Manuel Barkhau 2019-06-02 12:40:45 +02:00
parent ec4504d23f
commit d687c12ff7
14 changed files with 1729 additions and 1676 deletions

View File

@ -25,7 +25,7 @@ import pytest
from .. import CSS, HTML, __main__, default_url_fetcher
from ..urls import path2url
from .test_draw import B, _, assert_pixels_equal, image_to_pixels, r
from .test_draw import assert_pixels_equal, image_to_pixels, parse_pixels
from .testing_utils import (
FakeHTML, assert_no_logs, capture_logs, http_server, resource_filename)
@ -173,65 +173,65 @@ def test_css_parsing():
def check_png_pattern(png_bytes, x2=False, blank=False, rotated=False):
if blank:
expected_pixels = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
expected_pixels = '''
________
________
________
________
________
________
________
________
'''
size = 8
elif x2:
expected_pixels = [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + r + r + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + r + r + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
]
expected_pixels = '''
________________
________________
________________
________________
____rrBBBBBB____
____rrBBBBBB____
____BBBBBBBB____
____BBBBBBBB____
____BBBBBBBB____
____BBBBBBBB____
____BBBBBBBB____
____BBBBBBBB____
________________
________________
________________
________________
'''
size = 16
elif rotated:
expected_pixels = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
expected_pixels = '''
________
________
__BBBB__
__BBBB__
__BBBB__
__rBBB__
________
________
'''
size = 8
else:
expected_pixels = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
expected_pixels = '''
________
________
__rBBB__
__BBBB__
__BBBB__
__BBBB__
________
________
'''
size = 8
surface = cairo.ImageSurface.create_from_png(io.BytesIO(png_bytes))
assert_pixels_equal('api_png', size, size,
image_to_pixels(surface, size, size),
b''.join(expected_pixels))
b"".join(parse_pixels(expected_pixels)))
@assert_no_logs

View File

@ -26,19 +26,56 @@ _ = as_pixel(b'\xff\xff\xff\xff') # white
R = as_pixel(b'\xff\x00\x00\xff') # red
B = as_pixel(b'\x00\x00\xff\xff') # blue
G = as_pixel(b'\x00\xff\x00\xff') # lime green
V = as_pixel(b'\xBF\x00\x40\xff') # Average of 1*B and 3*r.
S = as_pixel(b'\xff\x3f\x3f\xff') # r above r above #fff
V = as_pixel(b'\xBF\x00\x40\xff') # Average of 1*B and 3*R.
S = as_pixel(b'\xff\x3f\x3f\xff') # R above R above #fff
r = as_pixel(b'\xff\x00\x00\xff') # red
g = as_pixel(b'\x00\x80\x00\xff') # half green
b = as_pixel(b'\x00\x00\x80\xff') # half blue
v = as_pixel(b'\x80\x00\x80\xff') # Average of B and r.
v = as_pixel(b'\x80\x00\x80\xff') # Average of B and R.
a = as_pixel(b'\x00\x00\xfe\xff') # JPG is lossy...
p = as_pixel(b'\xc0\x00\x3f\xff') # r above r above B above #fff.
p = as_pixel(b'\xc0\x00\x3f\xff') # R above R above B above #fff.
# NOTE: "r" is not half red on purpose. In the pixel strings it has
# better contrast with "B" than does "R". eg. "rBBBrrBrB" vs "RBBBRRBRB".
PIXELS_BY_CHAR = {
"_": _,
"R": R,
"B": B,
"G": G,
"V": V,
"S": S,
"r": r,
"g": g,
"b": b,
"v": v,
"a": a,
"p": p,
}
def parse_pixels(pixels, pix_overrides=None):
if pix_overrides is None:
pix_by_char = PIXELS_BY_CHAR
else:
pix_by_char = PIXELS_BY_CHAR.copy()
pix_by_char.update(pix_overrides)
pixel_lines = []
for line in pixels.splitlines():
line = line.split("#")[0].strip()
if not line:
continue
line_pixels = b"".join(pix_by_char[char] for char in line)
pixel_lines.append(line_pixels)
return pixel_lines
def assert_pixels(name, expected_width, expected_height, expected_pixels,
html):
"""Helper testing the size of the image and the pixels values."""
if isinstance(expected_pixels, str):
expected_pixels = parse_pixels(expected_pixels)
assert len(expected_pixels) == expected_height
assert len(expected_pixels[0]) == expected_width * 4
expected_raw = b''.join(expected_pixels)

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ import itertools
from ... import HTML
from ..testing_utils import assert_no_logs
from . import B, G, R, _, assert_different_renderings, assert_pixels, b, g
from . import PIXELS_BY_CHAR, assert_different_renderings, assert_pixels
@assert_no_logs
@ -41,17 +41,17 @@ def test_borders(margin='10px', prop='border'):
height = 110
margin = 10
border = 10
solid_pixels = [[_] * width for y in range(height)]
solid_pixels = [[PIXELS_BY_CHAR['_']] * width for y in range(height)]
for x in range(margin, width - margin):
for y in itertools.chain(
range(margin, margin + border),
range(height - margin - border, height - margin)):
solid_pixels[y][x] = B
solid_pixels[y][x] = PIXELS_BY_CHAR['B']
for y in range(margin, height - margin):
for x in itertools.chain(
range(margin, margin + border),
range(width - margin - border, width - margin)):
solid_pixels[y][x] = B
solid_pixels[y][x] = PIXELS_BY_CHAR['B']
solid_pixels = [b''.join(line) for line in solid_pixels]
assert_pixels(
prop + '_solid', 140, 110, solid_pixels,
@ -97,23 +97,23 @@ def test_small_borders_2():
@assert_no_logs
def test_margin_boxes():
assert_pixels('margin_boxes', 15, 15, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + G + G + G + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
_ + G + G + G + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('margin_boxes', 15, 15, '''
_______________
_GGG______BBBB_
_GGG______BBBB_
_______________
_____RRRR______
_____RRRR______
_____RRRR______
_____RRRR______
_______________
_bbb______gggg_
_bbb______gggg_
_bbb______gggg_
_bbb______gggg_
_bbb______gggg_
_______________
''', '''
<style>
html { height: 100% }
body { background: #f00; height: 100% }

View File

@ -10,17 +10,17 @@
"""
from ..testing_utils import assert_no_logs, requires
from . import _, a, assert_pixels, r
from . import assert_pixels
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_column_rule_1():
assert_pixels('solid', 5, 3, [
a + _ + r + _ + a,
a + _ + r + _ + a,
_ + _ + _ + _ + _,
], '''
assert_pixels('solid', 5, 3, '''
a_r_a
a_r_a
_____
''', '''
<style>
img { display: inline-block; width: 1px; height: 1px }
div { columns: 2; column-rule-style: solid;
@ -40,11 +40,11 @@ def test_column_rule_1():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_column_rule_2():
assert_pixels('dotted', 5, 3, [
a + _ + r + _ + a,
a + _ + _ + _ + a,
a + _ + r + _ + a,
], '''
assert_pixels('dotted', 5, 3, '''
a_r_a
a___a
a_r_a
''', '''
<style>
img { display: inline-block; width: 1px; height: 1px }
div { columns: 2; column-rule-style: dotted;

View File

@ -10,12 +10,17 @@
"""
from ..testing_utils import assert_no_logs
from . import G, assert_pixels
from . import assert_pixels
GREEN_2x2 = '''
GG
GG
'''
@assert_no_logs
def test_current_color_1():
assert_pixels('background_current_color', 2, 2, [G + G, G + G], '''
assert_pixels('background_current_color', 2, 2, GREEN_2x2, '''
<style>
@page { size: 2px }
html, body { height: 100%; margin: 0 }
@ -27,7 +32,7 @@ def test_current_color_1():
@assert_no_logs
def test_current_color_2():
assert_pixels('border_current_color', 2, 2, [G + G, G + G], '''
assert_pixels('border_current_color', 2, 2, GREEN_2x2, '''
<style>
@page { size: 2px }
html { color: red; border-color: currentColor }
@ -39,7 +44,7 @@ def test_current_color_2():
@assert_no_logs
def test_current_color_3():
assert_pixels('outline_current_color', 2, 2, [G + G, G + G], '''
assert_pixels('outline_current_color', 2, 2, GREEN_2x2, '''
<style>
@page { size: 2px }
html { color: red; outline-color: currentColor }
@ -51,7 +56,7 @@ def test_current_color_3():
@assert_no_logs
def test_current_color_4():
assert_pixels('border_collapse_current_color', 2, 2, [G + G, G + G], '''
assert_pixels('border_collapse_current_color', 2, 2, GREEN_2x2, '''
<style>
@page { size: 2px }
html { color: red; border-color: currentColor; }

View File

@ -10,23 +10,23 @@
"""
from ..testing_utils import assert_no_logs, requires
from . import B, V, _, assert_pixels, html_to_pixels, r, v
from . import B, R, assert_pixels, html_to_pixels
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_1():
assert_pixels('linear_gradient', 5, 9, [
_ + _ + _ + _ + _,
_ + _ + _ + _ + _,
_ + _ + _ + _ + _,
B + B + B + B + B,
B + B + B + B + B,
r + r + r + r + r,
r + r + r + r + r,
r + r + r + r + r,
r + r + r + r + r,
], '''<style>@page { size: 5px 9px; background: linear-gradient(
assert_pixels('linear_gradient', 5, 9, '''
_____
_____
_____
BBBBB
BBBBB
RRRRR
RRRRR
RRRRR
RRRRR
''', '''<style>@page { size: 5px 9px; background: linear-gradient(
white, white 3px, blue 0, blue 5px, red 0, red
)''')
@ -34,17 +34,17 @@ def test_linear_gradients_1():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_2():
assert_pixels('linear_gradient', 5, 9, [
_ + _ + _ + _ + _,
_ + _ + _ + _ + _,
_ + _ + _ + _ + _,
B + B + B + B + B,
B + B + B + B + B,
r + r + r + r + r,
r + r + r + r + r,
r + r + r + r + r,
r + r + r + r + r,
], '''<style>@page { size: 5px 9px; background: linear-gradient(
assert_pixels('linear_gradient', 5, 9, '''
_____
_____
_____
BBBBB
BBBBB
RRRRR
RRRRR
RRRRR
RRRRR
''', '''<style>@page { size: 5px 9px; background: linear-gradient(
white 3px, blue 0, blue 5px, red 0
)''')
@ -52,13 +52,13 @@ def test_linear_gradients_2():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_3():
assert_pixels('linear_gradient', 9, 5, [
_ + _ + _ + B + B + r + r + r + r,
_ + _ + _ + B + B + r + r + r + r,
_ + _ + _ + B + B + r + r + r + r,
_ + _ + _ + B + B + r + r + r + r,
_ + _ + _ + B + B + r + r + r + r,
], '''<style>@page { size: 9px 5px; background: linear-gradient(
assert_pixels('linear_gradient', 9, 5, '''
___BBrrrr
___BBrrrr
___BBrrrr
___BBrrrr
___BBrrrr
''', '''<style>@page { size: 9px 5px; background: linear-gradient(
to right, white 3px, blue 0, blue 5px, red 0
)''')
@ -66,13 +66,13 @@ def test_linear_gradients_3():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_4():
assert_pixels('linear_gradient', 10, 5, [
B + B + B + B + B + B + r + r + r + r,
B + B + B + B + B + B + r + r + r + r,
B + B + B + B + B + B + r + r + r + r,
B + B + B + B + B + B + r + r + r + r,
B + B + B + B + B + B + r + r + r + r,
], '''<style>@page { size: 10px 5px; background: linear-gradient(
assert_pixels('linear_gradient', 10, 5, '''
BBBBBBrrrr
BBBBBBrrrr
BBBBBBrrrr
BBBBBBrrrr
BBBBBBrrrr
''', '''<style>@page { size: 10px 5px; background: linear-gradient(
to right, blue 5px, blue 6px, red 6px, red 9px
)''')
@ -80,13 +80,13 @@ def test_linear_gradients_4():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_5():
assert_pixels('linear_gradient', 10, 5, [
r + B + r + r + r + B + r + r + r + B,
r + B + r + r + r + B + r + r + r + B,
r + B + r + r + r + B + r + r + r + B,
r + B + r + r + r + B + r + r + r + B,
r + B + r + r + r + B + r + r + r + B,
], '''<style>@page { size: 10px 5px; background: repeating-linear-gradient(
assert_pixels('linear_gradient', 10, 5, '''
rBrrrBrrrB
rBrrrBrrrB
rBrrrBrrrB
rBrrrBrrrB
rBrrrBrrrB
''', '''<style>@page { size: 10px 5px; background: repeating-linear-gradient(
to right, blue 50%, blue 60%, red 60%, red 90%
)''')
@ -94,13 +94,13 @@ def test_linear_gradients_5():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_6():
assert_pixels('linear_gradient', 9, 5, [
B + B + B + r + r + r + r + r + r,
B + B + B + r + r + r + r + r + r,
B + B + B + r + r + r + r + r + r,
B + B + B + r + r + r + r + r + r,
B + B + B + r + r + r + r + r + r,
], '''<style>@page { size: 9px 5px; background: linear-gradient(
assert_pixels('linear_gradient', 9, 5, '''
BBBrrrrrr
BBBrrrrrr
BBBrrrrrr
BBBrrrrrr
BBBrrrrrr
''', '''<style>@page { size: 9px 5px; background: linear-gradient(
to right, blue 3px, blue 3px, red 3px, red 3px
)''')
@ -108,13 +108,13 @@ def test_linear_gradients_6():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_7():
assert_pixels('linear_gradient', 9, 5, [
v + v + v + v + v + v + v + v + v,
v + v + v + v + v + v + v + v + v,
v + v + v + v + v + v + v + v + v,
v + v + v + v + v + v + v + v + v,
v + v + v + v + v + v + v + v + v,
], '''<style>@page { size: 9px 5px; background: repeating-linear-gradient(
assert_pixels('linear_gradient', 9, 5, '''
vvvvvvvvv
vvvvvvvvv
vvvvvvvvv
vvvvvvvvv
vvvvvvvvv
''', '''<style>@page { size: 9px 5px; background: repeating-linear-gradient(
to right, blue 3px, blue 3px, red 3px, red 3px
)''')
@ -122,13 +122,13 @@ def test_linear_gradients_7():
@assert_no_logs
@requires('cairo', (1, 14, 0))
def test_linear_gradients_8():
assert_pixels('linear_gradient', 9, 5, [
V + V + V + V + V + V + V + V + V,
V + V + V + V + V + V + V + V + V,
V + V + V + V + V + V + V + V + V,
V + V + V + V + V + V + V + V + V,
V + V + V + V + V + V + V + V + V,
], '''
assert_pixels('linear_gradient', 9, 5, '''
VVVVVVVVV
VVVVVVVVV
VVVVVVVVV
VVVVVVVVV
VVVVVVVVV
''', '''
<style>
@page { size: 9px 5px; background: repeating-linear-gradient(
to right, blue 50%, blue 60%, red 60%, red 90%);
@ -137,27 +137,27 @@ def test_linear_gradients_8():
@assert_no_logs
def test_radial_gradients_1():
assert_pixels('radial_gradient', 6, 6, [
B + B + B + B + B + B,
B + B + B + B + B + B,
B + B + B + B + B + B,
B + B + B + B + B + B,
B + B + B + B + B + B,
B + B + B + B + B + B,
], '''<style>@page { size: 6px; background:
assert_pixels('radial_gradient', 6, 6, '''
BBBBBB
BBBBBB
BBBBBB
BBBBBB
BBBBBB
BBBBBB
''', '''<style>@page { size: 6px; background:
radial-gradient(red -30%, blue -10%)''')
@assert_no_logs
def test_radial_gradients_2():
assert_pixels('radial_gradient', 6, 6, [
r + r + r + r + r + r,
r + r + r + r + r + r,
r + r + r + r + r + r,
r + r + r + r + r + r,
r + r + r + r + r + r,
r + r + r + r + r + r,
], '''<style>@page { size: 6px; background:
assert_pixels('radial_gradient', 6, 6, '''
RRRRRR
RRRRRR
RRRRRR
RRRRRR
RRRRRR
RRRRRR
''', '''<style>@page { size: 6px; background:
radial-gradient(red 110%, blue 130%)''')
@ -177,11 +177,11 @@ def test_radial_gradients_3():
assert pixel(9, 0) == B
assert pixel(0, 15) == B
assert pixel(9, 15) == B
assert pixel(4, 7) == r
assert pixel(4, 8) == r
assert pixel(5, 7) == r
assert pixel(5, 8) == r
assert (pixel(3, 5) not in (B, r)) ^ thin
assert (pixel(3, 9) not in (B, r)) ^ thin
assert (pixel(7, 5) not in (B, r)) ^ thin
assert (pixel(7, 9) not in (B, r)) ^ thin
assert pixel(4, 7) == R
assert pixel(4, 8) == R
assert pixel(5, 7) == R
assert pixel(5, 8) == R
assert (pixel(3, 5) not in (B, R)) ^ thin
assert (pixel(3, 9) not in (B, R)) ^ thin
assert (pixel(7, 5) not in (B, R)) ^ thin
assert (pixel(7, 9) not in (B, R)) ^ thin

View File

@ -12,85 +12,90 @@
import pytest
from ..testing_utils import assert_no_logs, capture_logs
from . import B, _, a, assert_pixels, assert_same_rendering, r
from . import assert_pixels, assert_same_rendering
centered_image = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
blue_image = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + a + a + a + a + _ + _,
_ + _ + a + a + a + a + _ + _,
_ + _ + a + a + a + a + _ + _,
_ + _ + a + a + a + a + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
no_image = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
page_break = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
centered_image = '''
________
________
__rBBB__
__BBBB__
__BBBB__
__BBBB__
________
________
'''
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
blue_image = '''
________
________
__aaaa__
__aaaa__
__aaaa__
__aaaa__
________
________
'''
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
table = [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
no_image = '''
________
________
________
________
________
________
________
________
'''
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
]
page_break = '''
________
________
__rBBB__
__BBBB__
__BBBB__
__BBBB__
________
________
________
________
________
________
________
________
________
________
________
________
__rBBB__
__BBBB__
__BBBB__
__BBBB__
________
________
'''
table = '''
________
________
__rBBB__
__BBBB__
__BBBB__
__BBBB__
________
________
__rBBB__
__BBBB__
__BBBB__
__BBBB__
________
________
________
________
'''
@assert_no_logs
@ -294,20 +299,20 @@ def test_images_shared_pattern():
# The same image is used in a repeating background,
# then in a non-repating <img>.
# If Pattern objects are shared carelessly, the image will be repeated.
assert_pixels('image_shared_pattern', 12, 12, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + a + a + a + a + a + a + a + a + _ + _,
_ + _ + a + a + a + a + a + a + a + a + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_shared_pattern', 12, 12, '''
____________
____________
__aaaaaaaa__
__aaaaaaaa__
____________
__aaaa______
__aaaa______
__aaaa______
__aaaa______
____________
____________
____________
''', '''
<style>
@page { size: 12px }
body { margin: 2px; background: #fff; font-size: 0 }

View File

@ -12,7 +12,7 @@
import pytest
from ..testing_utils import SANS_FONTS, assert_no_logs
from . import B, _, assert_pixels, r
from . import assert_pixels
@assert_no_logs
@ -22,34 +22,34 @@ from . import B, _, assert_pixels, r
# ###### <li> width: 12 - 7 - 2 = 3px
# -- list marker margin: 0.5em = 2px
# ******** list marker image is 4px wide
[
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
]),
'''
____________
____________
__rBBB______
__BBBB______
__BBBB______
__BBBB______
____________
____________
____________
____________
'''),
('inside',
# ++++++++++++++ ++++ <li> horizontal margins: 7px 2px
# ###### <li> width: 12 - 7 - 2 = 3px
# ******** list marker image is 4px wide: overflow
[
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + r + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
])
'''
____________
____________
_______rBBB_
_______BBBB_
_______BBBB_
_______BBBB_
____________
____________
____________
____________
''')
))
def test_list_style_image(position, pixels):
assert_pixels('list_style_image_' + position, 12, 10, pixels, '''
@ -64,18 +64,18 @@ def test_list_style_image(position, pixels):
@assert_no_logs
def test_list_style_image_none():
assert_pixels('list_style_none', 10, 10, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('list_style_none', 10, 10, '''
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
''', '''
<style>
@page { size: 10px }
body { margin: 0; background: white; font-family: %s }

View File

@ -12,22 +12,22 @@
import pytest
from ..testing_utils import assert_no_logs, requires
from . import B, _, assert_pixels, g, r
from . import assert_pixels
@assert_no_logs
def test_overflow_1():
# See test_images
assert_pixels('inline_image_overflow', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('inline_image_overflow', 8, 8, '''
________
________
__rBBB__
__BBBB__
________
________
________
________
''', '''
<style>
@page { size: 8px }
body { margin: 2px 0 0 2px; background: #fff; font-size:0 }
@ -40,16 +40,16 @@ def test_overflow_1():
def test_overflow_2():
# <body> is only 1px high, but its overflow is propageted to the viewport
# ie. the padding edge of the page box.
assert_pixels('inline_image_viewport_overflow', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('inline_image_viewport_overflow', 8, 8, '''
________
________
__rBBB__
__BBBB__
__BBBB__
________
________
________
''', '''
<style>
@page { size: 8px; background: #fff;
margin: 2px;
@ -63,16 +63,16 @@ def test_overflow_2():
@assert_no_logs
def test_overflow_3():
# Assert that the border is not clipped by overflow: hidden
assert_pixels('border_box_overflow', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + _ + _ + B + _ + _,
_ + _ + B + _ + _ + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('border_box_overflow', 8, 8, '''
________
________
__BBBB__
__B__B__
__B__B__
__BBBB__
________
________
''', '''
<style>
@page { size: 8px; background: #fff; margin: 2px; }
div { width: 2px; height: 2px; overflow: hidden;
@ -84,78 +84,78 @@ def test_overflow_3():
@assert_no_logs
@requires('cairo', (1, 12, 0))
@pytest.mark.parametrize('number, css, pixels', (
(1, '5px, 5px, 9px, auto', [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + r + B + B + B + r + B + g + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + B + g + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + B + g + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + B + g + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
]),
(2, '5px, 5px, auto, 10px', [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + g + g + g + g + g + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
]),
(3, '5px, auto, 9px, 10px', [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + g + r + B + B + B + r + B + B + B + r + _ + _ + _,
_ + g + B + B + B + B + B + B + B + B + B + _ + _ + _,
_ + g + B + B + B + B + B + B + B + B + B + _ + _ + _,
_ + g + B + B + B + B + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
]),
(4, 'auto, 5px, 9px, 10px', [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + g + g + g + g + g + _ + _ + _,
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
]),
(1, '5px, 5px, 9px, auto', '''
______________
______________
______________
______________
______________
______________
______rBBBrBg_
______BBBBBBg_
______BBBBBBg_
______BBBBBBg_
______________
______________
______________
______________
______________
______________
'''),
(2, '5px, 5px, auto, 10px', '''
______________
______________
______________
______________
______________
______________
______rBBBr___
______BBBBB___
______BBBBB___
______BBBBB___
______rBBBr___
______BBBBB___
______ggggg___
______________
______________
______________
'''),
(3, '5px, auto, 9px, 10px', '''
______________
______________
______________
______________
______________
______________
_grBBBrBBBr___
_gBBBBBBBBB___
_gBBBBBBBBB___
_gBBBBBBBBB___
______________
______________
______________
______________
______________
______________
'''),
(4, 'auto, 5px, 9px, 10px', '''
______________
______ggggg___
______rBBBr___
______BBBBB___
______BBBBB___
______BBBBB___
______rBBBr___
______BBBBB___
______BBBBB___
______BBBBB___
______________
______________
______________
______________
______________
______________
'''),
))
def test_clip(number, css, pixels):
assert_pixels('background_repeat_clipped_%s' % number, 14, 16, pixels, '''

View File

@ -11,14 +11,21 @@
from ...html import HTML_HANDLERS
from ..testing_utils import assert_no_logs, requires
from . import B, R, S, _, as_pixel, assert_pixels, p
from . import as_pixel, assert_pixels, parse_pixels
PIX_BY_CHAR_OVERRIDES = {
# rgba(255, 0, 0, 0.5) above #fff
'r': as_pixel(b'\xff\x7f\x7f\xff'),
# rgba(0, 255, 0, 0.5) above #fff
'g': as_pixel(b'\x7f\xff\x7f\xff'),
# r above B above #fff.
'b': as_pixel(b'\x80\x00\x7f\xff'),
}
def to_pix(pixels_str):
return parse_pixels(pixels_str, PIX_BY_CHAR_OVERRIDES)
# rgba(255, 0, 0, 0.5) above #fff
r = as_pixel(b'\xff\x7f\x7f\xff')
# rgba(0, 255, 0, 0.5) above #fff
g = as_pixel(b'\x7f\xff\x7f\xff')
# r above B above #fff.
b = as_pixel(b'\x80\x00\x7f\xff')
# TODO: refactor colspan/rowspan into CSS:
# td, th { column-span: attr(colspan integer) }
@ -61,36 +68,36 @@ tables_source = '''
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_1():
assert_pixels('table_borders', 28, 28, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+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+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_borders', 28, 28, to_pix('''
____________________________
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
_B________________________B_
_B________________________B_
_B__rrrrrr_rrrrrr_rrrrrr__B_
_B__r____r_r____r_r____r__B_
_B__r____r_r____r_r____r__B_
_B__r____r_r____r_r____r__B_
_B__r____r_r____r_r____r__B_
_B__rrrrrr_r____r_rrrrrr__B_
_B_________r____r_________B_
_B__rrrrrrrSrrrrS_rrrrrr__B_
_B__r______r____S_r____r__B_
_B__r______r____S_r____r__B_
_B__r______r____S_r____r__B_
_B__r______r____S_r____r__B_
_B__rrrrrrrSSSSSS_rrrrrr__B_
_B________________________B_
_B__rrrrrr_rrrrrr_________B_
_B__r____r_r____r_________B_
_B__r____r_r____r_________B_
_B__r____r_r____r_________B_
_B__r____r_r____r_________B_
_B__rrrrrr_rrrrrr_________B_
_B________________________B_
_B________________________B_
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
____________________________
'''), tables_source % {'extra_css': '''
x-table { border-color: #00f; table-layout: fixed }
x-td { border-color: rgba(255, 0, 0, 0.5) }
'''})
@ -99,36 +106,36 @@ def test_tables_1():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_2():
assert_pixels('table_collapsed_borders', 28, 28, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+r+r+r+r+r+_+_+_+_+r+r+r+r+r+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+r+r+r+r+r+r+r+r+r+r+r+r+r+r+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_collapsed_borders', 28, 28, to_pix('''
____________________________
_BBBBBBBBBBBBBBBBBB_________
_BBBBBBBBBBBBBBBBBB_________
_BB____r____r____BB_________
_BB____r____r____BB_________
_BB____r____r____BB_________
_BB____r____r____BB_________
_BBrrrrr____rrrrrBB_________
_BB_________r____BB_________
_BB_________r____BB_________
_BB_________r____BB_________
_BB_________r____BB_________
_BBrrrrrrrrrrrrrrBB_________
_BB____r____r____BB_________
_BB____r____r____BB_________
_BB____r____r____BB_________
_BB____r____r____BB_________
_BBBBBBBBBBBBBBBBBB_________
_BBBBBBBBBBBBBBBBBB_________
____________________________
____________________________
____________________________
____________________________
____________________________
____________________________
____________________________
____________________________
____________________________
'''), tables_source % {'extra_css': '''
x-table { border: 2px solid #00f; table-layout: fixed;
border-collapse: collapse }
x-td { border-color: #ff7f7f }
@ -138,60 +145,60 @@ def test_tables_2():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_3():
assert_pixels('table_collapsed_borders_paged', 28, 52, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+_, # noqa
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # no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_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
_+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+g+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_collapsed_borders_paged', 28, 52, to_pix('''
____________________________
_gggggggggggggggggggggggggg_
_g________________________g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BB____r____r____BB_____g_
_g_BB____r____r____BB_____g_
_g_BB____r____r____BB_____g_
_g_BB____r____r____BB_____g_
_g_BBrrrrr____rrrrrBB_____g_
_g_BB_________r____BB_____g_
_g_BB_________r____BB_____g_
_g_BB_________r____BB_____g_
_g_BB_________r____BB_____g_
_g_BBrrrrrrrrrrrrrrBB_____g_
_g________________________g_
_g________________________g_
_g________________________g_
_gggggggggggggggggggggggggg_
____________________________
____________________________
_gggggggggggggggggggggggggg_
_g_BBrrrrrrrrrrrrrrBB_____g_
_g_BB____r____r____BB_____g_
_g_BB____r____r____BB_____g_
_g_BB____r____r____BB_____g_
_g_BB____r____r____BB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g_BBBBBBBBBBBBBBBBBB_____g_
_g________________________g_
_g________________________g_
_g________________________g_
_g________________________g_
_g________________________g_
_g________________________g_
_g________________________g_
_g________________________g_
_g________________________g_
_gggggggggggggggggggggggggg_
____________________________
'''), tables_source % {'extra_css': '''
x-table { border: solid #00f; border-width: 8px 2px;
table-layout: fixed; border-collapse: collapse }
x-td { border-color: #ff7f7f }
@ -203,36 +210,36 @@ def test_tables_3():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_4():
assert_pixels('table_td_backgrounds', 28, 28, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+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# noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_td_backgrounds', 28, 28, to_pix('''
____________________________
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
_B________________________B_
_B________________________B_
_B__rrrrrr_rrrrrr_rrrrrr__B_
_B__rrrrrr_rrrrrr_rrrrrr__B_
_B__rrrrrr_rrrrrr_rrrrrr__B_
_B__rrrrrr_rrrrrr_rrrrrr__B_
_B__rrrrrr_rrrrrr_rrrrrr__B_
_B__rrrrrr_rrrrrr_rrrrrr__B_
_B_________rrrrrr_________B_
_B__rrrrrrrSSSSSS_rrrrrr__B_
_B__rrrrrrrSSSSSS_rrrrrr__B_
_B__rrrrrrrSSSSSS_rrrrrr__B_
_B__rrrrrrrSSSSSS_rrrrrr__B_
_B__rrrrrrrSSSSSS_rrrrrr__B_
_B__rrrrrrrSSSSSS_rrrrrr__B_
_B________________________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B________________________B_
_B________________________B_
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
____________________________
'''), tables_source % {'extra_css': '''
x-table { border-color: #00f; table-layout: fixed }
x-td { background: rgba(255, 0, 0, 0.5) }
'''})
@ -241,36 +248,36 @@ def test_tables_4():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_5():
assert_pixels('table_row_backgrounds', 28, 28, [
_+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_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_row_backgrounds', 28, 28, to_pix('''
____________________________
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
_B________________________B_
_B________________________B_
_B__bbbbbb_bbbbbb_bbbbbb__B_
_B__bbbbbb_bbbbbb_bbbbbb__B_
_B__bbbbbb_bbbbbb_bbbbbb__B_
_B__bbbbbb_bbbbbb_bbbbbb__B_
_B__bbbbbb_bbbbbb_bbbbbb__B_
_B__bbbbbb_bbbbbb_bbbbbb__B_
_B_________bbbbbb_________B_
_B__bbbbbbbpppppp_bbbbbb__B_
_B__bbbbbbbpppppp_bbbbbb__B_
_B__bbbbbbbpppppp_bbbbbb__B_
_B__bbbbbbbpppppp_bbbbbb__B_
_B__bbbbbbbpppppp_bbbbbb__B_
_B__bbbbbbbpppppp_bbbbbb__B_
_B________________________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B__rrrrrr_rrrrrr_________B_
_B________________________B_
_B________________________B_
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
____________________________
'''), tables_source % {'extra_css': '''
x-table { border-color: #00f; table-layout: fixed }
x-tbody { background: rgba(0, 0, 255, 1) }
x-tr { background: rgba(255, 0, 0, 0.5) }
@ -280,36 +287,36 @@ def test_tables_5():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_6():
assert_pixels('table_column_backgrounds', 28, 28, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+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+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_column_backgrounds', 28, 28, to_pix('''
____________________________
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
_B________________________B_
_B________________________B_
_B__bbbbbb_bbbbbb_rrrrrr__B_
_B__bbbbbb_bbbbbb_rrrrrr__B_
_B__bbbbbb_bbbbbb_rrrrrr__B_
_B__bbbbbb_bbbbbb_rrrrrr__B_
_B__bbbbbb_bbbbbb_rrrrrr__B_
_B__bbbbbb_bbbbbb_rrrrrr__B_
_B_________bbbbbb_________B_
_B__bbbbbbbpppppp_rrrrrr__B_
_B__bbbbbbbpppppp_rrrrrr__B_
_B__bbbbbbbpppppp_rrrrrr__B_
_B__bbbbbbbpppppp_rrrrrr__B_
_B__bbbbbbbpppppp_rrrrrr__B_
_B__bbbbbbbpppppp_rrrrrr__B_
_B________________________B_
_B__bbbbbb_bbbbbb_________B_
_B__bbbbbb_bbbbbb_________B_
_B__bbbbbb_bbbbbb_________B_
_B__bbbbbb_bbbbbb_________B_
_B__bbbbbb_bbbbbb_________B_
_B__bbbbbb_bbbbbb_________B_
_B________________________B_
_B________________________B_
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
____________________________
'''), tables_source % {'extra_css': '''
x-table { border-color: #00f; table-layout: fixed }
x-colgroup { background: rgba(0, 0, 255, 1) }
x-col { background: rgba(255, 0, 0, 0.5) }
@ -319,36 +326,36 @@ def test_tables_6():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_7():
assert_pixels('table_borders_and_row_backgrounds', 28, 28, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+_+_+_+_+_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_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_borders_and_row_backgrounds', 28, 28, to_pix('''
____________________________
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
_B________________________B_
_B________________________B_
_B__bbbbbb_bbbbbb_bbbbbb__B_
_B__bBBBBb_bBBBBb_bBBBBb__B_
_B__bBBBBb_bBBBBb_bBBBBb__B_
_B__bBBBBb_bBBBBb_bBBBBb__B_
_B__bBBBBb_bBBBBb_bBBBBb__B_
_B__bbbbbb_bBBBBb_bbbbbb__B_
_B_________bBBBBb_________B_
_B__rrrrrrrpbbbbp_rrrrrr__B_
_B__r______bBBBBp_r____r__B_
_B__r______bBBBBp_r____r__B_
_B__r______bBBBBp_r____r__B_
_B__r______bBBBBp_r____r__B_
_B__rrrrrrrpppppp_rrrrrr__B_
_B________________________B_
_B__rrrrrr_rrrrrr_________B_
_B__r____r_r____r_________B_
_B__r____r_r____r_________B_
_B__r____r_r____r_________B_
_B__r____r_r____r_________B_
_B__rrrrrr_rrrrrr_________B_
_B________________________B_
_B________________________B_
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
____________________________
'''), tables_source % {'extra_css': '''
x-table { border-color: #00f; table-layout: fixed }
x-tr:first-child { background: blue }
x-td { border-color: rgba(255, 0, 0, 0.5) }
@ -358,36 +365,36 @@ def test_tables_7():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_8():
assert_pixels('table_borders_and_column_backgrounds', 28, 28, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+r+_+_+_+_+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+b+p+b+b+b+b+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], tables_source % {'extra_css': '''
assert_pixels('table_borders_and_column_backgrounds', 28, 28, to_pix('''
____________________________
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
_B________________________B_
_B________________________B_
_B__bbbbbb_rrrrrr_rrrrrr__B_
_B__bBBBBb_r____r_r____r__B_
_B__bBBBBb_r____r_r____r__B_
_B__bBBBBb_r____r_r____r__B_
_B__bBBBBb_r____r_r____r__B_
_B__bbbbbb_r____r_rrrrrr__B_
_B_________r____r_________B_
_B__bbbbbbbpbbbbp_rrrrrr__B_
_B__bBBBBBBbBBBBp_r____r__B_
_B__bBBBBBBbBBBBp_r____r__B_
_B__bBBBBBBbBBBBp_r____r__B_
_B__bBBBBBBbBBBBp_r____r__B_
_B__bbbbbbbpppppp_rrrrrr__B_
_B________________________B_
_B__bbbbbb_rrrrrr_________B_
_B__bBBBBb_r____r_________B_
_B__bBBBBb_r____r_________B_
_B__bBBBBb_r____r_________B_
_B__bBBBBb_r____r_________B_
_B__bbbbbb_rrrrrr_________B_
_B________________________B_
_B________________________B_
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
____________________________
'''), tables_source % {'extra_css': '''
x-table { border-color: #00f; table-layout: fixed }
x-col:first-child { background: blue }
x-td { border-color: rgba(255, 0, 0, 0.5) }
@ -397,45 +404,44 @@ def test_tables_8():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_9():
r = as_pixel(b'\xff\x00\x00\xff')
assert_pixels('collapsed_border_thead', 22, 36, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
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# noqa
_+_+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], '''
assert_pixels('collapsed_border_thead', 22, 36, '''
______________________
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
__R_____R____R_____R__
__R_____R____R_____R__
__R_____R____R_____R__
__RRRRRRRRRRRRRRRRRR__
__R_____R____R_____R__
__R_____R____R_____R__
__R_____R____R_____R__
__RRRRRRRRRRRRRRRRRR__
______________________
______________________
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
__R_____R____R_____R__
__R_____R____R_____R__
__R_____R____R_____R__
__RRRRRRRRRRRRRRRRRR__
______________________
______________________
______________________
______________________
______________________
______________________
______________________
''', '''
<style>
@page { size: 22px 18px; margin: 1px; background: #fff }
td { border: 1px red solid; width: 4px; height: 3px; }
@ -451,44 +457,44 @@ def test_tables_9():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_tables_10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+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], '''
assert_pixels('collapsed_border_tfoot', 22, 36, '''
______________________
__RRRRRRRRRRRRRRRRRR__
__R_____R____R_____R__
__R_____R____R_____R__
__R_____R____R_____R__
__RRRRRRRRRRRRRRRRRR__
__R_____R____R_____R__
__R_____R____R_____R__
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
______________________
______________________
______________________
______________________
__RRRRRRRRRRRRRRRRRR__
__R_____R____R_____R__
__R_____R____R_____R__
__R_____R____R_____R__
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBB____R____R____BBB_
_BBBBBBBBBBBBBBBBBBBB_
_BBBBBBBBBBBBBBBBBBBB_
______________________
______________________
______________________
______________________
______________________
______________________
''', '''
<style>
@page { size: 22px 18px; margin: 1px; background: #fff }
td { border: 1px red solid; width: 4px; height: 3px; }
@ -508,18 +514,18 @@ def test_tables_11():
# Segression test for inline table with collapsed border and alignment
# rendering borders incorrectly
# https://github.com/Kozea/WeasyPrint/issues/82
assert_pixels('inline_text_align', 20, 10, [
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+R+R+R+R+R+R+R+R+R+R+R+_, # noqa
_+_+_+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+R+_, # noqa
_+_+_+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+R+_, # noqa
_+_+_+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+R+_, # noqa
_+_+_+_+_+_+_+_+R+R+R+R+R+R+R+R+R+R+R+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
], '''
assert_pixels('inline_text_align', 20, 10, '''
____________________
________RRRRRRRRRRR_
________R____R____R_
________R____R____R_
________R____R____R_
________RRRRRRRRRRR_
____________________
____________________
____________________
____________________
''', '''
<style>
@page { size: 20px 10px; margin: 1px; background: #fff }
body { text-align: right; font-size: 0 }

View File

@ -10,21 +10,21 @@
"""
from ..testing_utils import assert_no_logs
from . import B, _, assert_pixels, r
from . import assert_pixels
@assert_no_logs
def test_2d_transform_1():
assert_pixels('image_rotate90', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + r + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_rotate90', 8, 8, '''
________
________
__BBBr__
__BBBB__
__BBBB__
__BBBB__
________
________
''', '''
<style>
@page { size: 8px; margin: 2px; background: #fff; }
div { transform: rotate(90deg); font-size: 0 }
@ -34,20 +34,20 @@ def test_2d_transform_1():
@assert_no_logs
def test_2d_transform_2():
assert_pixels('image_translateX_rotate90', 12, 12, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + B + B + B + r + _ + _ + _,
_ + _ + _ + _ + _ + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + B + B + B + B + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_translateX_rotate90', 12, 12, '''
____________
____________
_____BBBr___
_____BBBB___
_____BBBB___
_____BBBB___
____________
____________
____________
____________
____________
____________
''', '''
<style>
@page { size: 12px; margin: 2px; background: #fff; }
div { transform: translateX(3px) rotate(90deg);
@ -59,20 +59,20 @@ def test_2d_transform_2():
@assert_no_logs
def test_2d_transform_3():
# A translateX after the rotation is actually a translateY
assert_pixels('image_rotate90_translateX', 12, 12, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + r + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_rotate90_translateX', 12, 12, '''
____________
____________
____________
____________
____________
__BBBr______
__BBBB______
__BBBB______
__BBBB______
____________
____________
____________
''', '''
<style>
@page { size: 12px; margin: 2px; background: #fff; }
div { transform: rotate(90deg) translateX(3px);
@ -83,20 +83,20 @@ def test_2d_transform_3():
@assert_no_logs
def test_2d_transform_4():
assert_pixels('nested_rotate90_translateX', 12, 12, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + r + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('nested_rotate90_translateX', 12, 12, '''
____________
____________
____________
____________
____________
__BBBr______
__BBBB______
__BBBB______
__BBBB______
____________
____________
____________
''', '''
<style>
@page { size: 12px; margin: 2px; background: #fff; }
div { transform: rotate(90deg); font-size: 0; width: 4px }
@ -107,16 +107,16 @@ def test_2d_transform_4():
@assert_no_logs
def test_2d_transform_5():
assert_pixels('image_reflection', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + B + B + B + r + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_reflection', 8, 8, '''
________
________
__BBBr__
__BBBB__
__BBBB__
__BBBB__
________
________
''', '''
<style>
@page { size: 8px; margin: 2px; background: #fff; }
div { transform: matrix(-1, 0, 0, 1, 0, 0); font-size: 0 }
@ -126,16 +126,16 @@ def test_2d_transform_5():
@assert_no_logs
def test_2d_transform_6():
assert_pixels('image_translate', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + r + B + B + B + _,
_ + _ + _ + B + B + B + B + _,
_ + _ + _ + B + B + B + B + _,
_ + _ + _ + B + B + B + B + _,
], '''
assert_pixels('image_translate', 8, 8, '''
________
________
________
________
___rBBB_
___BBBB_
___BBBB_
___BBBB_
''', '''
<style>
@page { size: 8px; margin: 2px; background: #fff; }
div { transform: translate(1px, 2px); font-size: 0 }
@ -145,16 +145,16 @@ def test_2d_transform_6():
@assert_no_logs
def test_2d_transform_7():
assert_pixels('image_translate_percentage', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + r + B + B + B + _,
_ + _ + _ + B + B + B + B + _,
_ + _ + _ + B + B + B + B + _,
_ + _ + _ + B + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_translate_percentage', 8, 8, '''
________
________
___rBBB_
___BBBB_
___BBBB_
___BBBB_
________
________
''', '''
<style>
@page { size: 8px; margin: 2px; background: #fff; }
div { transform: translate(25%, 0); font-size: 0 }
@ -164,16 +164,16 @@ def test_2d_transform_7():
@assert_no_logs
def test_2d_transform_8():
assert_pixels('image_translateX', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + r + B + B,
_ + _ + _ + _ + _ + B + B + B,
_ + _ + _ + _ + _ + B + B + B,
_ + _ + _ + _ + _ + B + B + B,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_translateX', 8, 8, '''
________
________
_____rBB
_____BBB
_____BBB
_____BBB
________
________
''', '''
<style>
@page { size: 8px; margin: 2px; background: #fff; }
div { transform: translateX(0.25em); font-size: 12px }
@ -184,16 +184,16 @@ def test_2d_transform_8():
@assert_no_logs
def test_2d_transform_9():
assert_pixels('image_translateY', 8, 8, [
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_translateY', 8, 8, '''
________
__rBBB__
__BBBB__
__BBBB__
__BBBB__
________
________
________
''', '''
<style>
@page { size: 8px; margin: 2px; background: #fff; }
div { transform: translateY(-1px); font-size: 0 }
@ -203,18 +203,18 @@ def test_2d_transform_9():
@assert_no_logs
def test_2d_transform_10():
assert_pixels('image_scale', 10, 10, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + r + r + B + B + B + B + B + B + _,
_ + r + r + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_scale', 10, 10, '''
__________
_rrBBBBBB_
_rrBBBBBB_
_BBBBBBBB_
_BBBBBBBB_
_BBBBBBBB_
_BBBBBBBB_
_BBBBBBBB_
_BBBBBBBB_
__________
''', '''
<style>
@page { size: 10px; margin: 2px; background: #fff; }
div { transform: scale(2, 2);
@ -227,18 +227,18 @@ def test_2d_transform_10():
@assert_no_logs
def test_2d_transform_11():
assert_pixels('image_scale12', 10, 10, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_scale12', 10, 10, '''
__________
__rBBB____
__rBBB____
__BBBB____
__BBBB____
__BBBB____
__BBBB____
__BBBB____
__BBBB____
__________
''', '''
<style>
@page { size: 10px; margin: 2px; background: #fff; }
div { transform: scale(1, 2);
@ -251,18 +251,18 @@ def test_2d_transform_11():
@assert_no_logs
def test_2d_transform_12():
assert_pixels('image_scaleY', 10, 10, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _ + _ + _,
_ + _ + r + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + B + B + B + B + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_scaleY', 10, 10, '''
__________
__rBBB____
__rBBB____
__BBBB____
__BBBB____
__BBBB____
__BBBB____
__BBBB____
__BBBB____
__________
''', '''
<style>
@page { size: 10px; margin: 2px; background: #fff; }
div { transform: scaleY(2);
@ -275,18 +275,18 @@ def test_2d_transform_12():
@assert_no_logs
def test_2d_transform_13():
assert_pixels('image_scaleX', 10, 10, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + r + r + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + B + B + B + B + B + B + B + B + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], '''
assert_pixels('image_scaleX', 10, 10, '''
__________
__________
_rrBBBBBB_
_BBBBBBBB_
_BBBBBBBB_
_BBBBBBBB_
__________
__________
__________
__________
''', '''
<style>
@page { size: 10px; margin: 2px; background: #fff; }
div { transform: scaleX(2);

View File

@ -10,7 +10,7 @@
"""
from ..testing_utils import assert_no_logs
from . import B, _, assert_pixels, r
from . import assert_pixels
visibility_source = '''
<style>
@ -27,39 +27,39 @@ visibility_source = '''
@assert_no_logs
def test_visibility_1():
assert_pixels('visibility_reference', 12, 7, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + r + B + B + B + _ + r + B + B + B + _ + _,
_ + B + B + B + B + _ + B + B + B + B + _ + _,
_ + B + B + B + B + _ + B + B + B + B + _ + _,
_ + B + B + B + B + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], visibility_source % {'extra_css': ''})
assert_pixels('visibility_reference', 12, 7, '''
____________
_rBBB_rBBB__
_BBBB_BBBB__
_BBBB_BBBB__
_BBBB_BBBB__
____________
____________
''', visibility_source % {'extra_css': ''})
@assert_no_logs
def test_visibility_2():
assert_pixels('visibility_hidden', 12, 7, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], visibility_source % {'extra_css': 'div { visibility: hidden }'})
assert_pixels('visibility_hidden', 12, 7, '''
____________
____________
____________
____________
____________
____________
____________
''', visibility_source % {'extra_css': 'div { visibility: hidden }'})
@assert_no_logs
def test_visibility_3():
assert_pixels('visibility_mixed', 12, 7, [
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + r + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + B + B + B + B + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
], visibility_source % {'extra_css': '''div { visibility: hidden }
assert_pixels('visibility_mixed', 12, 7, '''
____________
______rBBB__
______BBBB__
______BBBB__
______BBBB__
____________
____________
''', visibility_source % {'extra_css': '''div { visibility: hidden }
span { visibility: visible } '''})

View File

@ -12,7 +12,7 @@
import pytest
from ..test_boxes import render_pages
from ..test_draw import B, _, assert_pixels, r
from ..test_draw import assert_pixels
from ..testing_utils import assert_no_logs, capture_logs, requires
@ -1771,18 +1771,18 @@ def test_table_row_height_2():
@assert_no_logs
@requires('cairo', (1, 12, 0))
def test_table_vertical_align():
assert_pixels('table_vertical_align', 28, 10, [
r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r, # noqa
r+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+r, # noqa
r+B+r+B+B+_+B+B+_+B+B+_+B+B+_+B+B+r+r+B+B+r+r+B+B+_+B+r, # noqa
r+B+r+B+B+_+B+B+_+B+B+r+B+B+r+B+B+r+r+B+B+r+r+B+B+r+B+r, # noqa
r+B+_+B+B+r+B+B+_+B+B+r+B+B+r+B+B+r+r+B+B+r+r+B+B+r+B+r, # noqa
r+B+_+B+B+r+B+B+_+B+B+_+B+B+_+B+B+r+r+B+B+r+r+B+B+_+B+r, # noqa
r+B+_+B+B+_+B+B+r+B+B+_+B+B+_+B+B+_+_+B+B+_+_+B+B+_+B+r, # noqa
r+B+_+B+B+_+B+B+r+B+B+_+B+B+_+B+B+_+_+B+B+_+_+B+B+_+B+r, # noqa
r+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+r, # noqa
r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r, # noqa
], '''
assert_pixels('table_vertical_align', 28, 10, '''
rrrrrrrrrrrrrrrrrrrrrrrrrrrr
rBBBBBBBBBBBBBBBBBBBBBBBBBBr
rBrBB_BB_BB_BB_BBrrBBrrBB_Br
rBrBB_BB_BBrBBrBBrrBBrrBBrBr
rB_BBrBB_BBrBBrBBrrBBrrBBrBr
rB_BBrBB_BB_BB_BBrrBBrrBB_Br
rB_BB_BBrBB_BB_BB__BB__BB_Br
rB_BB_BBrBB_BB_BB__BB__BB_Br
rBBBBBBBBBBBBBBBBBBBBBBBBBBr
rrrrrrrrrrrrrrrrrrrrrrrrrrrr
''', '''
<style>
@font-face { src: url(AHEM____.TTF); font-family: ahem }
@page { size: 28px 10px }