mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 00:21:15 +03:00
refactor: add and use parse_pixels in tests
This commit is contained in:
parent
ec4504d23f
commit
d687c12ff7
@ -25,7 +25,7 @@ import pytest
|
|||||||
|
|
||||||
from .. import CSS, HTML, __main__, default_url_fetcher
|
from .. import CSS, HTML, __main__, default_url_fetcher
|
||||||
from ..urls import path2url
|
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 (
|
from .testing_utils import (
|
||||||
FakeHTML, assert_no_logs, capture_logs, http_server, resource_filename)
|
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):
|
def check_png_pattern(png_bytes, x2=False, blank=False, rotated=False):
|
||||||
if blank:
|
if blank:
|
||||||
expected_pixels = [
|
expected_pixels = '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
]
|
'''
|
||||||
size = 8
|
size = 8
|
||||||
elif x2:
|
elif x2:
|
||||||
expected_pixels = [
|
expected_pixels = '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
_ + _ + _ + _ + r + r + B + B + B + B + B + B + _ + _ + _ + _,
|
____rrBBBBBB____
|
||||||
_ + _ + _ + _ + r + r + B + B + B + B + B + B + _ + _ + _ + _,
|
____rrBBBBBB____
|
||||||
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
|
____BBBBBBBB____
|
||||||
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
|
____BBBBBBBB____
|
||||||
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
|
____BBBBBBBB____
|
||||||
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
|
____BBBBBBBB____
|
||||||
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
|
____BBBBBBBB____
|
||||||
_ + _ + _ + _ + B + B + B + B + B + B + B + B + _ + _ + _ + _,
|
____BBBBBBBB____
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
________________
|
||||||
]
|
'''
|
||||||
size = 16
|
size = 16
|
||||||
elif rotated:
|
elif rotated:
|
||||||
expected_pixels = [
|
expected_pixels = '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + r + B + B + B + _ + _,
|
__rBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
]
|
'''
|
||||||
size = 8
|
size = 8
|
||||||
else:
|
else:
|
||||||
expected_pixels = [
|
expected_pixels = '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + r + B + B + B + _ + _,
|
__rBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
]
|
'''
|
||||||
size = 8
|
size = 8
|
||||||
surface = cairo.ImageSurface.create_from_png(io.BytesIO(png_bytes))
|
surface = cairo.ImageSurface.create_from_png(io.BytesIO(png_bytes))
|
||||||
assert_pixels_equal('api_png', size, size,
|
assert_pixels_equal('api_png', size, size,
|
||||||
image_to_pixels(surface, size, size),
|
image_to_pixels(surface, size, size),
|
||||||
b''.join(expected_pixels))
|
b"".join(parse_pixels(expected_pixels)))
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
|
@ -26,19 +26,56 @@ _ = as_pixel(b'\xff\xff\xff\xff') # white
|
|||||||
R = as_pixel(b'\xff\x00\x00\xff') # red
|
R = as_pixel(b'\xff\x00\x00\xff') # red
|
||||||
B = as_pixel(b'\x00\x00\xff\xff') # blue
|
B = as_pixel(b'\x00\x00\xff\xff') # blue
|
||||||
G = as_pixel(b'\x00\xff\x00\xff') # lime green
|
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.
|
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
|
S = as_pixel(b'\xff\x3f\x3f\xff') # R above R above #fff
|
||||||
r = as_pixel(b'\xff\x00\x00\xff') # red
|
r = as_pixel(b'\xff\x00\x00\xff') # red
|
||||||
g = as_pixel(b'\x00\x80\x00\xff') # half green
|
g = as_pixel(b'\x00\x80\x00\xff') # half green
|
||||||
b = as_pixel(b'\x00\x00\x80\xff') # half blue
|
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...
|
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,
|
def assert_pixels(name, expected_width, expected_height, expected_pixels,
|
||||||
html):
|
html):
|
||||||
"""Helper testing the size of the image and the pixels values."""
|
"""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) == expected_height
|
||||||
assert len(expected_pixels[0]) == expected_width * 4
|
assert len(expected_pixels[0]) == expected_width * 4
|
||||||
expected_raw = b''.join(expected_pixels)
|
expected_raw = b''.join(expected_pixels)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,7 @@ import itertools
|
|||||||
|
|
||||||
from ... import HTML
|
from ... import HTML
|
||||||
from ..testing_utils import assert_no_logs
|
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
|
@assert_no_logs
|
||||||
@ -41,17 +41,17 @@ def test_borders(margin='10px', prop='border'):
|
|||||||
height = 110
|
height = 110
|
||||||
margin = 10
|
margin = 10
|
||||||
border = 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 x in range(margin, width - margin):
|
||||||
for y in itertools.chain(
|
for y in itertools.chain(
|
||||||
range(margin, margin + border),
|
range(margin, margin + border),
|
||||||
range(height - margin - border, height - margin)):
|
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 y in range(margin, height - margin):
|
||||||
for x in itertools.chain(
|
for x in itertools.chain(
|
||||||
range(margin, margin + border),
|
range(margin, margin + border),
|
||||||
range(width - margin - border, width - margin)):
|
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]
|
solid_pixels = [b''.join(line) for line in solid_pixels]
|
||||||
assert_pixels(
|
assert_pixels(
|
||||||
prop + '_solid', 140, 110, solid_pixels,
|
prop + '_solid', 140, 110, solid_pixels,
|
||||||
@ -97,23 +97,23 @@ def test_small_borders_2():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_margin_boxes():
|
def test_margin_boxes():
|
||||||
assert_pixels('margin_boxes', 15, 15, [
|
assert_pixels('margin_boxes', 15, 15, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
_______________
|
||||||
_ + G + G + G + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
|
_GGG______BBBB_
|
||||||
_ + G + G + G + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
|
_GGG______BBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
_______________
|
||||||
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
|
_____RRRR______
|
||||||
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
|
_____RRRR______
|
||||||
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
|
_____RRRR______
|
||||||
_ + _ + _ + _ + _ + R + R + R + R + _ + _ + _ + _ + _ + _,
|
_____RRRR______
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
_______________
|
||||||
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
|
_bbb______gggg_
|
||||||
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
|
_bbb______gggg_
|
||||||
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
|
_bbb______gggg_
|
||||||
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
|
_bbb______gggg_
|
||||||
_ + b + b + b + _ + _ + _ + _ + _ + _ + g + g + g + g + _,
|
_bbb______gggg_
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
_______________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
html { height: 100% }
|
html { height: 100% }
|
||||||
body { background: #f00; height: 100% }
|
body { background: #f00; height: 100% }
|
||||||
|
@ -10,17 +10,17 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from ..testing_utils import assert_no_logs, requires
|
from ..testing_utils import assert_no_logs, requires
|
||||||
from . import _, a, assert_pixels, r
|
from . import assert_pixels
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_column_rule_1():
|
def test_column_rule_1():
|
||||||
assert_pixels('solid', 5, 3, [
|
assert_pixels('solid', 5, 3, '''
|
||||||
a + _ + r + _ + a,
|
a_r_a
|
||||||
a + _ + r + _ + a,
|
a_r_a
|
||||||
_ + _ + _ + _ + _,
|
_____
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
img { display: inline-block; width: 1px; height: 1px }
|
img { display: inline-block; width: 1px; height: 1px }
|
||||||
div { columns: 2; column-rule-style: solid;
|
div { columns: 2; column-rule-style: solid;
|
||||||
@ -40,11 +40,11 @@ def test_column_rule_1():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_column_rule_2():
|
def test_column_rule_2():
|
||||||
assert_pixels('dotted', 5, 3, [
|
assert_pixels('dotted', 5, 3, '''
|
||||||
a + _ + r + _ + a,
|
a_r_a
|
||||||
a + _ + _ + _ + a,
|
a___a
|
||||||
a + _ + r + _ + a,
|
a_r_a
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
img { display: inline-block; width: 1px; height: 1px }
|
img { display: inline-block; width: 1px; height: 1px }
|
||||||
div { columns: 2; column-rule-style: dotted;
|
div { columns: 2; column-rule-style: dotted;
|
||||||
|
@ -10,12 +10,17 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from ..testing_utils import assert_no_logs
|
from ..testing_utils import assert_no_logs
|
||||||
from . import G, assert_pixels
|
from . import assert_pixels
|
||||||
|
|
||||||
|
GREEN_2x2 = '''
|
||||||
|
GG
|
||||||
|
GG
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_current_color_1():
|
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>
|
<style>
|
||||||
@page { size: 2px }
|
@page { size: 2px }
|
||||||
html, body { height: 100%; margin: 0 }
|
html, body { height: 100%; margin: 0 }
|
||||||
@ -27,7 +32,7 @@ def test_current_color_1():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_current_color_2():
|
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>
|
<style>
|
||||||
@page { size: 2px }
|
@page { size: 2px }
|
||||||
html { color: red; border-color: currentColor }
|
html { color: red; border-color: currentColor }
|
||||||
@ -39,7 +44,7 @@ def test_current_color_2():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_current_color_3():
|
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>
|
<style>
|
||||||
@page { size: 2px }
|
@page { size: 2px }
|
||||||
html { color: red; outline-color: currentColor }
|
html { color: red; outline-color: currentColor }
|
||||||
@ -51,7 +56,7 @@ def test_current_color_3():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_current_color_4():
|
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>
|
<style>
|
||||||
@page { size: 2px }
|
@page { size: 2px }
|
||||||
html { color: red; border-color: currentColor; }
|
html { color: red; border-color: currentColor; }
|
||||||
|
@ -10,23 +10,23 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from ..testing_utils import assert_no_logs, requires
|
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
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_1():
|
def test_linear_gradients_1():
|
||||||
assert_pixels('linear_gradient', 5, 9, [
|
assert_pixels('linear_gradient', 5, 9, '''
|
||||||
_ + _ + _ + _ + _,
|
_____
|
||||||
_ + _ + _ + _ + _,
|
_____
|
||||||
_ + _ + _ + _ + _,
|
_____
|
||||||
B + B + B + B + B,
|
BBBBB
|
||||||
B + B + B + B + B,
|
BBBBB
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
], '''<style>@page { size: 5px 9px; background: linear-gradient(
|
''', '''<style>@page { size: 5px 9px; background: linear-gradient(
|
||||||
white, white 3px, blue 0, blue 5px, red 0, red
|
white, white 3px, blue 0, blue 5px, red 0, red
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@ -34,17 +34,17 @@ def test_linear_gradients_1():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_2():
|
def test_linear_gradients_2():
|
||||||
assert_pixels('linear_gradient', 5, 9, [
|
assert_pixels('linear_gradient', 5, 9, '''
|
||||||
_ + _ + _ + _ + _,
|
_____
|
||||||
_ + _ + _ + _ + _,
|
_____
|
||||||
_ + _ + _ + _ + _,
|
_____
|
||||||
B + B + B + B + B,
|
BBBBB
|
||||||
B + B + B + B + B,
|
BBBBB
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
r + r + r + r + r,
|
RRRRR
|
||||||
], '''<style>@page { size: 5px 9px; background: linear-gradient(
|
''', '''<style>@page { size: 5px 9px; background: linear-gradient(
|
||||||
white 3px, blue 0, blue 5px, red 0
|
white 3px, blue 0, blue 5px, red 0
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@ -52,13 +52,13 @@ def test_linear_gradients_2():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_3():
|
def test_linear_gradients_3():
|
||||||
assert_pixels('linear_gradient', 9, 5, [
|
assert_pixels('linear_gradient', 9, 5, '''
|
||||||
_ + _ + _ + B + B + r + r + r + r,
|
___BBrrrr
|
||||||
_ + _ + _ + B + B + r + r + r + r,
|
___BBrrrr
|
||||||
_ + _ + _ + B + B + r + r + r + r,
|
___BBrrrr
|
||||||
_ + _ + _ + B + B + r + r + r + r,
|
___BBrrrr
|
||||||
_ + _ + _ + B + B + r + r + r + r,
|
___BBrrrr
|
||||||
], '''<style>@page { size: 9px 5px; background: linear-gradient(
|
''', '''<style>@page { size: 9px 5px; background: linear-gradient(
|
||||||
to right, white 3px, blue 0, blue 5px, red 0
|
to right, white 3px, blue 0, blue 5px, red 0
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@ -66,13 +66,13 @@ def test_linear_gradients_3():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_4():
|
def test_linear_gradients_4():
|
||||||
assert_pixels('linear_gradient', 10, 5, [
|
assert_pixels('linear_gradient', 10, 5, '''
|
||||||
B + B + B + B + B + B + r + r + r + r,
|
BBBBBBrrrr
|
||||||
B + B + B + B + B + B + r + r + r + r,
|
BBBBBBrrrr
|
||||||
B + B + B + B + B + B + r + r + r + r,
|
BBBBBBrrrr
|
||||||
B + B + B + B + B + B + r + r + r + r,
|
BBBBBBrrrr
|
||||||
B + B + B + B + B + B + r + r + r + r,
|
BBBBBBrrrr
|
||||||
], '''<style>@page { size: 10px 5px; background: linear-gradient(
|
''', '''<style>@page { size: 10px 5px; background: linear-gradient(
|
||||||
to right, blue 5px, blue 6px, red 6px, red 9px
|
to right, blue 5px, blue 6px, red 6px, red 9px
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@ -80,13 +80,13 @@ def test_linear_gradients_4():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_5():
|
def test_linear_gradients_5():
|
||||||
assert_pixels('linear_gradient', 10, 5, [
|
assert_pixels('linear_gradient', 10, 5, '''
|
||||||
r + B + r + r + r + B + r + r + r + B,
|
rBrrrBrrrB
|
||||||
r + B + r + r + r + B + r + r + r + B,
|
rBrrrBrrrB
|
||||||
r + B + r + r + r + B + r + r + r + B,
|
rBrrrBrrrB
|
||||||
r + B + r + r + r + B + r + r + r + B,
|
rBrrrBrrrB
|
||||||
r + B + r + r + r + B + r + r + r + B,
|
rBrrrBrrrB
|
||||||
], '''<style>@page { size: 10px 5px; background: repeating-linear-gradient(
|
''', '''<style>@page { size: 10px 5px; background: repeating-linear-gradient(
|
||||||
to right, blue 50%, blue 60%, red 60%, red 90%
|
to right, blue 50%, blue 60%, red 60%, red 90%
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@ -94,13 +94,13 @@ def test_linear_gradients_5():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_6():
|
def test_linear_gradients_6():
|
||||||
assert_pixels('linear_gradient', 9, 5, [
|
assert_pixels('linear_gradient', 9, 5, '''
|
||||||
B + B + B + r + r + r + r + r + r,
|
BBBrrrrrr
|
||||||
B + B + B + r + r + r + r + r + r,
|
BBBrrrrrr
|
||||||
B + B + B + r + r + r + r + r + r,
|
BBBrrrrrr
|
||||||
B + B + B + r + r + r + r + r + r,
|
BBBrrrrrr
|
||||||
B + B + B + r + r + r + r + r + r,
|
BBBrrrrrr
|
||||||
], '''<style>@page { size: 9px 5px; background: linear-gradient(
|
''', '''<style>@page { size: 9px 5px; background: linear-gradient(
|
||||||
to right, blue 3px, blue 3px, red 3px, red 3px
|
to right, blue 3px, blue 3px, red 3px, red 3px
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@ -108,13 +108,13 @@ def test_linear_gradients_6():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_7():
|
def test_linear_gradients_7():
|
||||||
assert_pixels('linear_gradient', 9, 5, [
|
assert_pixels('linear_gradient', 9, 5, '''
|
||||||
v + v + v + v + v + v + v + v + v,
|
vvvvvvvvv
|
||||||
v + v + v + v + v + v + v + v + v,
|
vvvvvvvvv
|
||||||
v + v + v + v + v + v + v + v + v,
|
vvvvvvvvv
|
||||||
v + v + v + v + v + v + v + v + v,
|
vvvvvvvvv
|
||||||
v + v + v + v + v + v + v + v + v,
|
vvvvvvvvv
|
||||||
], '''<style>@page { size: 9px 5px; background: repeating-linear-gradient(
|
''', '''<style>@page { size: 9px 5px; background: repeating-linear-gradient(
|
||||||
to right, blue 3px, blue 3px, red 3px, red 3px
|
to right, blue 3px, blue 3px, red 3px, red 3px
|
||||||
)''')
|
)''')
|
||||||
|
|
||||||
@ -122,13 +122,13 @@ def test_linear_gradients_7():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 14, 0))
|
@requires('cairo', (1, 14, 0))
|
||||||
def test_linear_gradients_8():
|
def test_linear_gradients_8():
|
||||||
assert_pixels('linear_gradient', 9, 5, [
|
assert_pixels('linear_gradient', 9, 5, '''
|
||||||
V + V + V + V + V + V + V + V + V,
|
VVVVVVVVV
|
||||||
V + V + V + V + V + V + V + V + V,
|
VVVVVVVVV
|
||||||
V + V + V + V + V + V + V + V + V,
|
VVVVVVVVV
|
||||||
V + V + V + V + V + V + V + V + V,
|
VVVVVVVVV
|
||||||
V + V + V + V + V + V + V + V + V,
|
VVVVVVVVV
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 9px 5px; background: repeating-linear-gradient(
|
@page { size: 9px 5px; background: repeating-linear-gradient(
|
||||||
to right, blue 50%, blue 60%, red 60%, red 90%);
|
to right, blue 50%, blue 60%, red 60%, red 90%);
|
||||||
@ -137,27 +137,27 @@ def test_linear_gradients_8():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_radial_gradients_1():
|
def test_radial_gradients_1():
|
||||||
assert_pixels('radial_gradient', 6, 6, [
|
assert_pixels('radial_gradient', 6, 6, '''
|
||||||
B + B + B + B + B + B,
|
BBBBBB
|
||||||
B + B + B + B + B + B,
|
BBBBBB
|
||||||
B + B + B + B + B + B,
|
BBBBBB
|
||||||
B + B + B + B + B + B,
|
BBBBBB
|
||||||
B + B + B + B + B + B,
|
BBBBBB
|
||||||
B + B + B + B + B + B,
|
BBBBBB
|
||||||
], '''<style>@page { size: 6px; background:
|
''', '''<style>@page { size: 6px; background:
|
||||||
radial-gradient(red -30%, blue -10%)''')
|
radial-gradient(red -30%, blue -10%)''')
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_radial_gradients_2():
|
def test_radial_gradients_2():
|
||||||
assert_pixels('radial_gradient', 6, 6, [
|
assert_pixels('radial_gradient', 6, 6, '''
|
||||||
r + r + r + r + r + r,
|
RRRRRR
|
||||||
r + r + r + r + r + r,
|
RRRRRR
|
||||||
r + r + r + r + r + r,
|
RRRRRR
|
||||||
r + r + r + r + r + r,
|
RRRRRR
|
||||||
r + r + r + r + r + r,
|
RRRRRR
|
||||||
r + r + r + r + r + r,
|
RRRRRR
|
||||||
], '''<style>@page { size: 6px; background:
|
''', '''<style>@page { size: 6px; background:
|
||||||
radial-gradient(red 110%, blue 130%)''')
|
radial-gradient(red 110%, blue 130%)''')
|
||||||
|
|
||||||
|
|
||||||
@ -177,11 +177,11 @@ def test_radial_gradients_3():
|
|||||||
assert pixel(9, 0) == B
|
assert pixel(9, 0) == B
|
||||||
assert pixel(0, 15) == B
|
assert pixel(0, 15) == B
|
||||||
assert pixel(9, 15) == B
|
assert pixel(9, 15) == B
|
||||||
assert pixel(4, 7) == r
|
assert pixel(4, 7) == R
|
||||||
assert pixel(4, 8) == r
|
assert pixel(4, 8) == R
|
||||||
assert pixel(5, 7) == r
|
assert pixel(5, 7) == R
|
||||||
assert pixel(5, 8) == r
|
assert pixel(5, 8) == R
|
||||||
assert (pixel(3, 5) not in (B, r)) ^ thin
|
assert (pixel(3, 5) not in (B, R)) ^ thin
|
||||||
assert (pixel(3, 9) 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, 5) not in (B, R)) ^ thin
|
||||||
assert (pixel(7, 9) not in (B, r)) ^ thin
|
assert (pixel(7, 9) not in (B, R)) ^ thin
|
||||||
|
@ -12,85 +12,90 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ..testing_utils import assert_no_logs, capture_logs
|
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 = [
|
centered_image = '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + r + B + B + B + _ + _,
|
__rBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
]
|
'''
|
||||||
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 + _ + _,
|
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
|
||||||
|
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
blue_image = '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
__aaaa__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
__aaaa__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
__aaaa__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
__aaaa__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
|
________
|
||||||
|
'''
|
||||||
|
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
no_image = '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + 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 + _ + _,
|
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
|
||||||
|
|
||||||
_ + _ + r + B + B + B + _ + _,
|
page_break = '''
|
||||||
_ + _ + B + B + B + B + _ + _,
|
________
|
||||||
_ + _ + B + B + B + B + _ + _,
|
________
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__rBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
]
|
________
|
||||||
|
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
|
||||||
|
________
|
||||||
|
________
|
||||||
|
__rBBB__
|
||||||
|
__BBBB__
|
||||||
|
__BBBB__
|
||||||
|
__BBBB__
|
||||||
|
________
|
||||||
|
________
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
table = '''
|
||||||
|
________
|
||||||
|
________
|
||||||
|
__rBBB__
|
||||||
|
__BBBB__
|
||||||
|
__BBBB__
|
||||||
|
__BBBB__
|
||||||
|
________
|
||||||
|
________
|
||||||
|
|
||||||
|
__rBBB__
|
||||||
|
__BBBB__
|
||||||
|
__BBBB__
|
||||||
|
__BBBB__
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
________
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@ -294,20 +299,20 @@ def test_images_shared_pattern():
|
|||||||
# The same image is used in a repeating background,
|
# The same image is used in a repeating background,
|
||||||
# then in a non-repating <img>.
|
# then in a non-repating <img>.
|
||||||
# If Pattern objects are shared carelessly, the image will be repeated.
|
# If Pattern objects are shared carelessly, the image will be repeated.
|
||||||
assert_pixels('image_shared_pattern', 12, 12, [
|
assert_pixels('image_shared_pattern', 12, 12, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + a + a + a + a + a + a + a + a + _ + _,
|
__aaaaaaaa__
|
||||||
_ + _ + a + a + a + a + a + a + a + a + _ + _,
|
__aaaaaaaa__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
|
__aaaa______
|
||||||
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
|
__aaaa______
|
||||||
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
|
__aaaa______
|
||||||
_ + _ + a + a + a + a + _ + _ + _ + _ + _ + _,
|
__aaaa______
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 12px }
|
@page { size: 12px }
|
||||||
body { margin: 2px; background: #fff; font-size: 0 }
|
body { margin: 2px; background: #fff; font-size: 0 }
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ..testing_utils import SANS_FONTS, assert_no_logs
|
from ..testing_utils import SANS_FONTS, assert_no_logs
|
||||||
from . import B, _, assert_pixels, r
|
from . import assert_pixels
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@ -22,34 +22,34 @@ from . import B, _, assert_pixels, r
|
|||||||
# ###### <li> width: 12 - 7 - 2 = 3px
|
# ###### <li> width: 12 - 7 - 2 = 3px
|
||||||
# -- list marker margin: 0.5em = 2px
|
# -- list marker margin: 0.5em = 2px
|
||||||
# ******** list marker image is 4px wide
|
# ******** list marker image is 4px wide
|
||||||
[
|
'''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + r + B + B + B + _ + _ + _ + _ + _ + _,
|
__rBBB______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
]),
|
'''),
|
||||||
('inside',
|
('inside',
|
||||||
# ++++++++++++++ ++++ <li> horizontal margins: 7px 2px
|
# ++++++++++++++ ++++ <li> horizontal margins: 7px 2px
|
||||||
# ###### <li> width: 12 - 7 - 2 = 3px
|
# ###### <li> width: 12 - 7 - 2 = 3px
|
||||||
# ******** list marker image is 4px wide: overflow
|
# ******** list marker image is 4px wide: overflow
|
||||||
[
|
'''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + r + B + B + B + _,
|
_______rBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
|
_______BBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
|
_______BBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + B + B + B + B + _,
|
_______BBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
])
|
''')
|
||||||
))
|
))
|
||||||
def test_list_style_image(position, pixels):
|
def test_list_style_image(position, pixels):
|
||||||
assert_pixels('list_style_image_' + position, 12, 10, pixels, '''
|
assert_pixels('list_style_image_' + position, 12, 10, pixels, '''
|
||||||
@ -64,18 +64,18 @@ def test_list_style_image(position, pixels):
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_list_style_image_none():
|
def test_list_style_image_none():
|
||||||
assert_pixels('list_style_none', 10, 10, [
|
assert_pixels('list_style_none', 10, 10, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 10px }
|
@page { size: 10px }
|
||||||
body { margin: 0; background: white; font-family: %s }
|
body { margin: 0; background: white; font-family: %s }
|
||||||
|
@ -12,22 +12,22 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ..testing_utils import assert_no_logs, requires
|
from ..testing_utils import assert_no_logs, requires
|
||||||
from . import B, _, assert_pixels, g, r
|
from . import assert_pixels
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_overflow_1():
|
def test_overflow_1():
|
||||||
# See test_images
|
# See test_images
|
||||||
assert_pixels('inline_image_overflow', 8, 8, [
|
assert_pixels('inline_image_overflow', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + r + B + B + B + _ + _,
|
__rBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px }
|
@page { size: 8px }
|
||||||
body { margin: 2px 0 0 2px; background: #fff; font-size:0 }
|
body { margin: 2px 0 0 2px; background: #fff; font-size:0 }
|
||||||
@ -40,16 +40,16 @@ def test_overflow_1():
|
|||||||
def test_overflow_2():
|
def test_overflow_2():
|
||||||
# <body> is only 1px high, but its overflow is propageted to the viewport
|
# <body> is only 1px high, but its overflow is propageted to the viewport
|
||||||
# ie. the padding edge of the page box.
|
# ie. the padding edge of the page box.
|
||||||
assert_pixels('inline_image_viewport_overflow', 8, 8, [
|
assert_pixels('inline_image_viewport_overflow', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + r + B + B + B + _ + _,
|
__rBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; background: #fff;
|
@page { size: 8px; background: #fff;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
@ -63,16 +63,16 @@ def test_overflow_2():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_overflow_3():
|
def test_overflow_3():
|
||||||
# Assert that the border is not clipped by overflow: hidden
|
# Assert that the border is not clipped by overflow: hidden
|
||||||
assert_pixels('border_box_overflow', 8, 8, [
|
assert_pixels('border_box_overflow', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + _ + _ + B + _ + _,
|
__B__B__
|
||||||
_ + _ + B + _ + _ + B + _ + _,
|
__B__B__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; background: #fff; margin: 2px; }
|
@page { size: 8px; background: #fff; margin: 2px; }
|
||||||
div { width: 2px; height: 2px; overflow: hidden;
|
div { width: 2px; height: 2px; overflow: hidden;
|
||||||
@ -84,78 +84,78 @@ def test_overflow_3():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
@pytest.mark.parametrize('number, css, pixels', (
|
@pytest.mark.parametrize('number, css, pixels', (
|
||||||
(1, '5px, 5px, 9px, auto', [
|
(1, '5px, 5px, 9px, auto', '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + r + B + B + B + r + B + g + _,
|
______rBBBrBg_
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + B + g + _,
|
______BBBBBBg_
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + B + g + _,
|
______BBBBBBg_
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + B + g + _,
|
______BBBBBBg_
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
]),
|
'''),
|
||||||
(2, '5px, 5px, auto, 10px', [
|
(2, '5px, 5px, auto, 10px', '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
|
______rBBBr___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
|
______rBBBr___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + g + g + g + g + g + _ + _ + _,
|
______ggggg___
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
]),
|
'''),
|
||||||
(3, '5px, auto, 9px, 10px', [
|
(3, '5px, auto, 9px, 10px', '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + g + r + B + B + B + r + B + B + B + r + _ + _ + _,
|
_grBBBrBBBr___
|
||||||
_ + g + B + B + B + B + B + B + B + B + B + _ + _ + _,
|
_gBBBBBBBBB___
|
||||||
_ + g + B + B + B + B + B + B + B + B + B + _ + _ + _,
|
_gBBBBBBBBB___
|
||||||
_ + g + B + B + B + B + B + B + B + B + B + _ + _ + _,
|
_gBBBBBBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
]),
|
'''),
|
||||||
(4, 'auto, 5px, 9px, 10px', [
|
(4, 'auto, 5px, 9px, 10px', '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + g + g + g + g + g + _ + _ + _,
|
______ggggg___
|
||||||
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
|
______rBBBr___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + r + B + B + B + r + _ + _ + _,
|
______rBBBr___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + B + _ + _ + _,
|
______BBBBB___
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
______________
|
||||||
]),
|
'''),
|
||||||
))
|
))
|
||||||
def test_clip(number, css, pixels):
|
def test_clip(number, css, pixels):
|
||||||
assert_pixels('background_repeat_clipped_%s' % number, 14, 16, pixels, '''
|
assert_pixels('background_repeat_clipped_%s' % number, 14, 16, pixels, '''
|
||||||
|
@ -11,14 +11,21 @@
|
|||||||
|
|
||||||
from ...html import HTML_HANDLERS
|
from ...html import HTML_HANDLERS
|
||||||
from ..testing_utils import assert_no_logs, requires
|
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:
|
# TODO: refactor colspan/rowspan into CSS:
|
||||||
# td, th { column-span: attr(colspan integer) }
|
# td, th { column-span: attr(colspan integer) }
|
||||||
@ -61,36 +68,36 @@ tables_source = '''
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_1():
|
def test_tables_1():
|
||||||
assert_pixels('table_borders', 28, 28, [
|
assert_pixels('table_borders', 28, 28, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r____r_r____r_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r____r_r____r_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r____r_r____r_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r____r_r____r_r____r__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+_+_+_+_+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_r____r_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B_________r____r_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+r+r+r+r+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSrrrrS_rrrrrr__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+r+_+_+_+_+S+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______r____S_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+r+_+_+_+_+S+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______r____S_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+r+_+_+_+_+S+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______r____S_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+r+_+_+_+_+S+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______r____S_r____r__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+S+S+S+S+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSSSSSS_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border-color: #00f; table-layout: fixed }
|
x-table { border-color: #00f; table-layout: fixed }
|
||||||
x-td { border-color: rgba(255, 0, 0, 0.5) }
|
x-td { border-color: rgba(255, 0, 0, 0.5) }
|
||||||
'''})
|
'''})
|
||||||
@ -99,36 +106,36 @@ def test_tables_1():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_2():
|
def test_tables_2():
|
||||||
assert_pixels('table_collapsed_borders', 28, 28, [
|
assert_pixels('table_collapsed_borders', 28, 28, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BBBBBBBBBBBBBBBBBB_________
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BBBBBBBBBBBBBBBBBB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+r+r+r+r+r+_+_+_+_+r+r+r+r+r+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BBrrrrr____rrrrrBB_________
|
||||||
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB_________r____BB_________
|
||||||
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB_________r____BB_________
|
||||||
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB_________r____BB_________
|
||||||
_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB_________r____BB_________
|
||||||
_+B+B+r+r+r+r+r+r+r+r+r+r+r+r+r+r+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BBrrrrrrrrrrrrrrBB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BB____r____r____BB_________
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BBBBBBBBBBBBBBBBBB_________
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+_+_+_+_, # noqa
|
_BBBBBBBBBBBBBBBBBB_________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border: 2px solid #00f; table-layout: fixed;
|
x-table { border: 2px solid #00f; table-layout: fixed;
|
||||||
border-collapse: collapse }
|
border-collapse: collapse }
|
||||||
x-td { border-color: #ff7f7f }
|
x-td { border-color: #ff7f7f }
|
||||||
@ -138,60 +145,60 @@ def test_tables_2():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_3():
|
def test_tables_3():
|
||||||
assert_pixels('table_collapsed_borders_paged', 28, 52, [
|
assert_pixels('table_collapsed_borders_paged', 28, 52, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_gggggggggggggggggggggggggg_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+r+r+r+r+r+_+_+_+_+r+r+r+r+r+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBrrrrr____rrrrrBB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB_________r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB_________r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB_________r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB_________r____BB_____g_
|
||||||
_+g+_+B+B+r+r+r+r+r+r+r+r+r+r+r+r+r+r+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBrrrrrrrrrrrrrrBB_____g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+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+g+g+_, # noqa
|
_gggggggggggggggggggggggggg_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_gggggggggggggggggggggggggg_
|
||||||
_+g+_+B+B+r+r+r+r+r+r+r+r+r+r+r+r+r+r+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBrrrrrrrrrrrrrrBB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BB____r____r____BB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_+_+_+_+_+g+_, # noqa
|
_g_BBBBBBBBBBBBBBBBBB_____g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+g+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+g+_, # noqa
|
_g________________________g_
|
||||||
_+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+g+g+_, # noqa
|
_gggggggggggggggggggggggggg_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border: solid #00f; border-width: 8px 2px;
|
x-table { border: solid #00f; border-width: 8px 2px;
|
||||||
table-layout: fixed; border-collapse: collapse }
|
table-layout: fixed; border-collapse: collapse }
|
||||||
x-td { border-color: #ff7f7f }
|
x-td { border-color: #ff7f7f }
|
||||||
@ -203,36 +210,36 @@ def test_tables_3():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_4():
|
def test_tables_4():
|
||||||
assert_pixels('table_td_backgrounds', 28, 28, [
|
assert_pixels('table_td_backgrounds', 28, 28, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B_________rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+S+S+S+S+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSSSSSS_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+S+S+S+S+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSSSSSS_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+S+S+S+S+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSSSSSS_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+S+S+S+S+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSSSSSS_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+S+S+S+S+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSSSSSS_rrrrrr__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+S+S+S+S+S+S+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrSSSSSS_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border-color: #00f; table-layout: fixed }
|
x-table { border-color: #00f; table-layout: fixed }
|
||||||
x-td { background: rgba(255, 0, 0, 0.5) }
|
x-td { background: rgba(255, 0, 0, 0.5) }
|
||||||
'''})
|
'''})
|
||||||
@ -241,36 +248,36 @@ def test_tables_4():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_5():
|
def test_tables_5():
|
||||||
assert_pixels('table_row_backgrounds', 28, 28, [
|
assert_pixels('table_row_backgrounds', 28, 28, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+b+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_bbbbbb__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B_________bbbbbb_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_bbbbbb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_bbbbbb__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border-color: #00f; table-layout: fixed }
|
x-table { border-color: #00f; table-layout: fixed }
|
||||||
x-tbody { background: rgba(0, 0, 255, 1) }
|
x-tbody { background: rgba(0, 0, 255, 1) }
|
||||||
x-tr { background: rgba(255, 0, 0, 0.5) }
|
x-tr { background: rgba(255, 0, 0, 0.5) }
|
||||||
@ -280,36 +287,36 @@ def test_tables_5():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_6():
|
def test_tables_6():
|
||||||
assert_pixels('table_column_backgrounds', 28, 28, [
|
assert_pixels('table_column_backgrounds', 28, 28, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B_________bbbbbb_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_rrrrrr__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+b+b+b+b+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border-color: #00f; table-layout: fixed }
|
x-table { border-color: #00f; table-layout: fixed }
|
||||||
x-colgroup { background: rgba(0, 0, 255, 1) }
|
x-colgroup { background: rgba(0, 0, 255, 1) }
|
||||||
x-col { background: rgba(255, 0, 0, 0.5) }
|
x-col { background: rgba(255, 0, 0, 0.5) }
|
||||||
@ -319,36 +326,36 @@ def test_tables_6():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_7():
|
def test_tables_7():
|
||||||
assert_pixels('table_borders_and_row_backgrounds', 28, 28, [
|
assert_pixels('table_borders_and_row_backgrounds', 28, 28, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+b+_+_+B+_, # noqa
|
_B__bbbbbb_bbbbbb_bbbbbb__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+_+B+_, # noqa
|
_B__bBBBBb_bBBBBb_bBBBBb__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+_+B+_, # noqa
|
_B__bBBBBb_bBBBBb_bBBBBb__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+_+B+_, # noqa
|
_B__bBBBBb_bBBBBb_bBBBBb__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+b+B+B+B+B+b+_+_+B+_, # noqa
|
_B__bBBBBb_bBBBBb_bBBBBb__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+b+B+B+B+B+b+_+b+b+b+b+b+b+_+_+B+_, # noqa
|
_B__bbbbbb_bBBBBb_bbbbbb__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+b+B+B+B+B+b+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B_________bBBBBb_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+p+b+b+b+b+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrpbbbbp_rrrrrr__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______bBBBBp_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______bBBBBp_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______bBBBBp_r____r__B_
|
||||||
_+B+_+_+r+_+_+_+_+_+_+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__r______bBBBBp_r____r__B_
|
||||||
_+B+_+_+r+r+r+r+r+r+r+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__rrrrrrrpppppp_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__r____r_r____r_________B_
|
||||||
_+B+_+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__rrrrrr_rrrrrr_________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border-color: #00f; table-layout: fixed }
|
x-table { border-color: #00f; table-layout: fixed }
|
||||||
x-tr:first-child { background: blue }
|
x-tr:first-child { background: blue }
|
||||||
x-td { border-color: rgba(255, 0, 0, 0.5) }
|
x-td { border-color: rgba(255, 0, 0, 0.5) }
|
||||||
@ -358,36 +365,36 @@ def test_tables_7():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_8():
|
def test_tables_8():
|
||||||
assert_pixels('table_borders_and_column_backgrounds', 28, 28, [
|
assert_pixels('table_borders_and_column_backgrounds', 28, 28, to_pix('''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # 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
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_rrrrrr_rrrrrr__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_r____r__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_r____r__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_r____r__B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_r____r__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+r+_+_+_+_+r+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbb_r____r_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B_________r____r_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+b+b+b+b+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpbbbbp_rrrrrr__B_
|
||||||
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBBBbBBBBp_r____r__B_
|
||||||
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBBBbBBBBp_r____r__B_
|
||||||
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBBBbBBBBp_r____r__B_
|
||||||
_+B+_+_+b+B+B+B+B+B+B+b+B+B+B+B+p+_+r+_+_+_+_+r+_+_+B+_, # noqa
|
_B__bBBBBBBbBBBBp_r____r__B_
|
||||||
_+B+_+_+b+b+b+b+b+b+b+p+p+p+p+p+p+_+r+r+r+r+r+r+_+_+B+_, # noqa
|
_B__bbbbbbbpppppp_rrrrrr__B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B________________________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_rrrrrr_________B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_________B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_________B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_________B_
|
||||||
_+B+_+_+b+B+B+B+B+b+_+r+_+_+_+_+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bBBBBb_r____r_________B_
|
||||||
_+B+_+_+b+b+b+b+b+b+_+r+r+r+r+r+r+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_B__bbbbbb_rrrrrr_________B_
|
||||||
_+B+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+B+_, # noqa
|
_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+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________________
|
||||||
], tables_source % {'extra_css': '''
|
'''), tables_source % {'extra_css': '''
|
||||||
x-table { border-color: #00f; table-layout: fixed }
|
x-table { border-color: #00f; table-layout: fixed }
|
||||||
x-col:first-child { background: blue }
|
x-col:first-child { background: blue }
|
||||||
x-td { border-color: rgba(255, 0, 0, 0.5) }
|
x-td { border-color: rgba(255, 0, 0, 0.5) }
|
||||||
@ -397,45 +404,44 @@ def test_tables_8():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_9():
|
def test_tables_9():
|
||||||
r = as_pixel(b'\xff\x00\x00\xff')
|
assert_pixels('collapsed_border_thead', 22, 36, '''
|
||||||
assert_pixels('collapsed_border_thead', 22, 36, [
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__RRRRRRRRRRRRRRRRRR__
|
||||||
_+_+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__RRRRRRRRRRRRRRRRRR__
|
||||||
_+_+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+r+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+r+_+_+_+_+r+_+_+_+_+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+r+_+_+_+_+_+r+_+_+_+_+r+_+_+_+_+_+r+_+_, # noqa
|
__RRRRRRRRRRRRRRRRRR__
|
||||||
_+_+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
|
''', '''
|
||||||
], '''
|
|
||||||
<style>
|
<style>
|
||||||
@page { size: 22px 18px; margin: 1px; background: #fff }
|
@page { size: 22px 18px; margin: 1px; background: #fff }
|
||||||
td { border: 1px red solid; width: 4px; height: 3px; }
|
td { border: 1px red solid; width: 4px; height: 3px; }
|
||||||
@ -451,44 +457,44 @@ def test_tables_9():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_tables_10():
|
def test_tables_10():
|
||||||
assert_pixels('collapsed_border_tfoot', 22, 36, [
|
assert_pixels('collapsed_border_tfoot', 22, 36, '''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+_+_, # noqa
|
__RRRRRRRRRRRRRRRRRR__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+_+_, # noqa
|
__RRRRRRRRRRRRRRRRRR__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+R+_+_, # noqa
|
__RRRRRRRRRRRRRRRRRR__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+_+R+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+_+R+_+_, # noqa
|
__R_____R____R_____R__
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+_+_+_+_+R+_+_+_+_+R+_+_+_+_+B+B+B+_, # noqa
|
_BBB____R____R____BBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+B+_, # noqa
|
_BBBBBBBBBBBBBBBBBBBB_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
______________________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 22px 18px; margin: 1px; background: #fff }
|
@page { size: 22px 18px; margin: 1px; background: #fff }
|
||||||
td { border: 1px red solid; width: 4px; height: 3px; }
|
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
|
# Segression test for inline table with collapsed border and alignment
|
||||||
# rendering borders incorrectly
|
# rendering borders incorrectly
|
||||||
# https://github.com/Kozea/WeasyPrint/issues/82
|
# https://github.com/Kozea/WeasyPrint/issues/82
|
||||||
assert_pixels('inline_text_align', 20, 10, [
|
assert_pixels('inline_text_align', 20, 10, '''
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________
|
||||||
_+_+_+_+_+_+_+_+R+R+R+R+R+R+R+R+R+R+R+_, # noqa
|
________RRRRRRRRRRR_
|
||||||
_+_+_+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+R+_, # noqa
|
________R____R____R_
|
||||||
_+_+_+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+R+_, # noqa
|
________R____R____R_
|
||||||
_+_+_+_+_+_+_+_+R+_+_+_+_+R+_+_+_+_+R+_, # noqa
|
________R____R____R_
|
||||||
_+_+_+_+_+_+_+_+R+R+R+R+R+R+R+R+R+R+R+_, # noqa
|
________RRRRRRRRRRR_
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________
|
||||||
_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_, # noqa
|
____________________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 20px 10px; margin: 1px; background: #fff }
|
@page { size: 20px 10px; margin: 1px; background: #fff }
|
||||||
body { text-align: right; font-size: 0 }
|
body { text-align: right; font-size: 0 }
|
||||||
|
@ -10,21 +10,21 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from ..testing_utils import assert_no_logs
|
from ..testing_utils import assert_no_logs
|
||||||
from . import B, _, assert_pixels, r
|
from . import assert_pixels
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_1():
|
def test_2d_transform_1():
|
||||||
assert_pixels('image_rotate90', 8, 8, [
|
assert_pixels('image_rotate90', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + B + B + B + r + _ + _,
|
__BBBr__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; margin: 2px; background: #fff; }
|
@page { size: 8px; margin: 2px; background: #fff; }
|
||||||
div { transform: rotate(90deg); font-size: 0 }
|
div { transform: rotate(90deg); font-size: 0 }
|
||||||
@ -34,20 +34,20 @@ def test_2d_transform_1():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_2():
|
def test_2d_transform_2():
|
||||||
assert_pixels('image_translateX_rotate90', 12, 12, [
|
assert_pixels('image_translateX_rotate90', 12, 12, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + B + B + B + r + _ + _ + _,
|
_____BBBr___
|
||||||
_ + _ + _ + _ + _ + B + B + B + B + _ + _ + _,
|
_____BBBB___
|
||||||
_ + _ + _ + _ + _ + B + B + B + B + _ + _ + _,
|
_____BBBB___
|
||||||
_ + _ + _ + _ + _ + B + B + B + B + _ + _ + _,
|
_____BBBB___
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 12px; margin: 2px; background: #fff; }
|
@page { size: 12px; margin: 2px; background: #fff; }
|
||||||
div { transform: translateX(3px) rotate(90deg);
|
div { transform: translateX(3px) rotate(90deg);
|
||||||
@ -59,20 +59,20 @@ def test_2d_transform_2():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_3():
|
def test_2d_transform_3():
|
||||||
# A translateX after the rotation is actually a translateY
|
# A translateX after the rotation is actually a translateY
|
||||||
assert_pixels('image_rotate90_translateX', 12, 12, [
|
assert_pixels('image_rotate90_translateX', 12, 12, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + B + B + B + r + _ + _ + _ + _ + _ + _,
|
__BBBr______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 12px; margin: 2px; background: #fff; }
|
@page { size: 12px; margin: 2px; background: #fff; }
|
||||||
div { transform: rotate(90deg) translateX(3px);
|
div { transform: rotate(90deg) translateX(3px);
|
||||||
@ -83,20 +83,20 @@ def test_2d_transform_3():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_4():
|
def test_2d_transform_4():
|
||||||
assert_pixels('nested_rotate90_translateX', 12, 12, [
|
assert_pixels('nested_rotate90_translateX', 12, 12, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + B + B + B + r + _ + _ + _ + _ + _ + _,
|
__BBBr______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _ + _ + _,
|
__BBBB______
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 12px; margin: 2px; background: #fff; }
|
@page { size: 12px; margin: 2px; background: #fff; }
|
||||||
div { transform: rotate(90deg); font-size: 0; width: 4px }
|
div { transform: rotate(90deg); font-size: 0; width: 4px }
|
||||||
@ -107,16 +107,16 @@ def test_2d_transform_4():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_5():
|
def test_2d_transform_5():
|
||||||
assert_pixels('image_reflection', 8, 8, [
|
assert_pixels('image_reflection', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + B + B + B + r + _ + _,
|
__BBBr__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; margin: 2px; background: #fff; }
|
@page { size: 8px; margin: 2px; background: #fff; }
|
||||||
div { transform: matrix(-1, 0, 0, 1, 0, 0); font-size: 0 }
|
div { transform: matrix(-1, 0, 0, 1, 0, 0); font-size: 0 }
|
||||||
@ -126,16 +126,16 @@ def test_2d_transform_5():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_6():
|
def test_2d_transform_6():
|
||||||
assert_pixels('image_translate', 8, 8, [
|
assert_pixels('image_translate', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + r + B + B + B + _,
|
___rBBB_
|
||||||
_ + _ + _ + B + B + B + B + _,
|
___BBBB_
|
||||||
_ + _ + _ + B + B + B + B + _,
|
___BBBB_
|
||||||
_ + _ + _ + B + B + B + B + _,
|
___BBBB_
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; margin: 2px; background: #fff; }
|
@page { size: 8px; margin: 2px; background: #fff; }
|
||||||
div { transform: translate(1px, 2px); font-size: 0 }
|
div { transform: translate(1px, 2px); font-size: 0 }
|
||||||
@ -145,16 +145,16 @@ def test_2d_transform_6():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_7():
|
def test_2d_transform_7():
|
||||||
assert_pixels('image_translate_percentage', 8, 8, [
|
assert_pixels('image_translate_percentage', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + r + B + B + B + _,
|
___rBBB_
|
||||||
_ + _ + _ + B + B + B + B + _,
|
___BBBB_
|
||||||
_ + _ + _ + B + B + B + B + _,
|
___BBBB_
|
||||||
_ + _ + _ + B + B + B + B + _,
|
___BBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; margin: 2px; background: #fff; }
|
@page { size: 8px; margin: 2px; background: #fff; }
|
||||||
div { transform: translate(25%, 0); font-size: 0 }
|
div { transform: translate(25%, 0); font-size: 0 }
|
||||||
@ -164,16 +164,16 @@ def test_2d_transform_7():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_8():
|
def test_2d_transform_8():
|
||||||
assert_pixels('image_translateX', 8, 8, [
|
assert_pixels('image_translateX', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + r + B + B,
|
_____rBB
|
||||||
_ + _ + _ + _ + _ + B + B + B,
|
_____BBB
|
||||||
_ + _ + _ + _ + _ + B + B + B,
|
_____BBB
|
||||||
_ + _ + _ + _ + _ + B + B + B,
|
_____BBB
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; margin: 2px; background: #fff; }
|
@page { size: 8px; margin: 2px; background: #fff; }
|
||||||
div { transform: translateX(0.25em); font-size: 12px }
|
div { transform: translateX(0.25em); font-size: 12px }
|
||||||
@ -184,16 +184,16 @@ def test_2d_transform_8():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_9():
|
def test_2d_transform_9():
|
||||||
assert_pixels('image_translateY', 8, 8, [
|
assert_pixels('image_translateY', 8, 8, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + r + B + B + B + _ + _,
|
__rBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + B + B + B + B + _ + _,
|
__BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _,
|
________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 8px; margin: 2px; background: #fff; }
|
@page { size: 8px; margin: 2px; background: #fff; }
|
||||||
div { transform: translateY(-1px); font-size: 0 }
|
div { transform: translateY(-1px); font-size: 0 }
|
||||||
@ -203,18 +203,18 @@ def test_2d_transform_9():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_10():
|
def test_2d_transform_10():
|
||||||
assert_pixels('image_scale', 10, 10, [
|
assert_pixels('image_scale', 10, 10, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + r + r + B + B + B + B + B + B + _,
|
_rrBBBBBB_
|
||||||
_ + r + r + B + B + B + B + B + B + _,
|
_rrBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 10px; margin: 2px; background: #fff; }
|
@page { size: 10px; margin: 2px; background: #fff; }
|
||||||
div { transform: scale(2, 2);
|
div { transform: scale(2, 2);
|
||||||
@ -227,18 +227,18 @@ def test_2d_transform_10():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_11():
|
def test_2d_transform_11():
|
||||||
assert_pixels('image_scale12', 10, 10, [
|
assert_pixels('image_scale12', 10, 10, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + r + B + B + B + _ + _ + _ + _,
|
__rBBB____
|
||||||
_ + _ + r + B + B + B + _ + _ + _ + _,
|
__rBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 10px; margin: 2px; background: #fff; }
|
@page { size: 10px; margin: 2px; background: #fff; }
|
||||||
div { transform: scale(1, 2);
|
div { transform: scale(1, 2);
|
||||||
@ -251,18 +251,18 @@ def test_2d_transform_11():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_12():
|
def test_2d_transform_12():
|
||||||
assert_pixels('image_scaleY', 10, 10, [
|
assert_pixels('image_scaleY', 10, 10, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + r + B + B + B + _ + _ + _ + _,
|
__rBBB____
|
||||||
_ + _ + r + B + B + B + _ + _ + _ + _,
|
__rBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + B + B + B + B + _ + _ + _ + _,
|
__BBBB____
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 10px; margin: 2px; background: #fff; }
|
@page { size: 10px; margin: 2px; background: #fff; }
|
||||||
div { transform: scaleY(2);
|
div { transform: scaleY(2);
|
||||||
@ -275,18 +275,18 @@ def test_2d_transform_12():
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_2d_transform_13():
|
def test_2d_transform_13():
|
||||||
assert_pixels('image_scaleX', 10, 10, [
|
assert_pixels('image_scaleX', 10, 10, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + r + r + B + B + B + B + B + B + _,
|
_rrBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + B + B + B + B + B + B + B + B + _,
|
_BBBBBBBB_
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
__________
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@page { size: 10px; margin: 2px; background: #fff; }
|
@page { size: 10px; margin: 2px; background: #fff; }
|
||||||
div { transform: scaleX(2);
|
div { transform: scaleX(2);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from ..testing_utils import assert_no_logs
|
from ..testing_utils import assert_no_logs
|
||||||
from . import B, _, assert_pixels, r
|
from . import assert_pixels
|
||||||
|
|
||||||
visibility_source = '''
|
visibility_source = '''
|
||||||
<style>
|
<style>
|
||||||
@ -27,39 +27,39 @@ visibility_source = '''
|
|||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_visibility_1():
|
def test_visibility_1():
|
||||||
assert_pixels('visibility_reference', 12, 7, [
|
assert_pixels('visibility_reference', 12, 7, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + r + B + B + B + _ + r + B + B + B + _ + _,
|
_rBBB_rBBB__
|
||||||
_ + B + B + B + B + _ + B + B + B + B + _ + _,
|
_BBBB_BBBB__
|
||||||
_ + B + B + B + B + _ + B + B + B + B + _ + _,
|
_BBBB_BBBB__
|
||||||
_ + B + B + B + B + _ + B + B + B + B + _ + _,
|
_BBBB_BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
], visibility_source % {'extra_css': ''})
|
''', visibility_source % {'extra_css': ''})
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_visibility_2():
|
def test_visibility_2():
|
||||||
assert_pixels('visibility_hidden', 12, 7, [
|
assert_pixels('visibility_hidden', 12, 7, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
], visibility_source % {'extra_css': 'div { visibility: hidden }'})
|
''', visibility_source % {'extra_css': 'div { visibility: hidden }'})
|
||||||
|
|
||||||
|
|
||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
def test_visibility_3():
|
def test_visibility_3():
|
||||||
assert_pixels('visibility_mixed', 12, 7, [
|
assert_pixels('visibility_mixed', 12, 7, '''
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + r + B + B + B + _ + _,
|
______rBBB__
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + _ + _,
|
______BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + _ + _,
|
______BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + B + B + B + B + _ + _,
|
______BBBB__
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
_ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _ + _,
|
____________
|
||||||
], visibility_source % {'extra_css': '''div { visibility: hidden }
|
''', visibility_source % {'extra_css': '''div { visibility: hidden }
|
||||||
span { visibility: visible } '''})
|
span { visibility: visible } '''})
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ..test_boxes import render_pages
|
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
|
from ..testing_utils import assert_no_logs, capture_logs, requires
|
||||||
|
|
||||||
|
|
||||||
@ -1771,18 +1771,18 @@ def test_table_row_height_2():
|
|||||||
@assert_no_logs
|
@assert_no_logs
|
||||||
@requires('cairo', (1, 12, 0))
|
@requires('cairo', (1, 12, 0))
|
||||||
def test_table_vertical_align():
|
def test_table_vertical_align():
|
||||||
assert_pixels('table_vertical_align', 28, 10, [
|
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
|
rrrrrrrrrrrrrrrrrrrrrrrrrrrr
|
||||||
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
|
rBBBBBBBBBBBBBBBBBBBBBBBBBBr
|
||||||
r+B+r+B+B+_+B+B+_+B+B+_+B+B+_+B+B+r+r+B+B+r+r+B+B+_+B+r, # noqa
|
rBrBB_BB_BB_BB_BBrrBBrrBB_Br
|
||||||
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
|
rBrBB_BB_BBrBBrBBrrBBrrBBrBr
|
||||||
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
|
rB_BBrBB_BBrBBrBBrrBBrrBBrBr
|
||||||
r+B+_+B+B+r+B+B+_+B+B+_+B+B+_+B+B+r+r+B+B+r+r+B+B+_+B+r, # noqa
|
rB_BBrBB_BB_BB_BBrrBBrrBB_Br
|
||||||
r+B+_+B+B+_+B+B+r+B+B+_+B+B+_+B+B+_+_+B+B+_+_+B+B+_+B+r, # noqa
|
rB_BB_BBrBB_BB_BB__BB__BB_Br
|
||||||
r+B+_+B+B+_+B+B+r+B+B+_+B+B+_+B+B+_+_+B+B+_+_+B+B+_+B+r, # noqa
|
rB_BB_BBrBB_BB_BB__BB__BB_Br
|
||||||
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
|
rBBBBBBBBBBBBBBBBBBBBBBBBBBr
|
||||||
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
|
rrrrrrrrrrrrrrrrrrrrrrrrrrrr
|
||||||
], '''
|
''', '''
|
||||||
<style>
|
<style>
|
||||||
@font-face { src: url(AHEM____.TTF); font-family: ahem }
|
@font-face { src: url(AHEM____.TTF); font-family: ahem }
|
||||||
@page { size: 28px 10px }
|
@page { size: 28px 10px }
|
||||||
|
Loading…
Reference in New Issue
Block a user