Skip to content

Commit

Permalink
Fix some tests relying on installed fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Apr 24, 2015
1 parent b5080d2 commit 54fde80
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions weasyprint/tests/test_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2876,7 +2876,6 @@ def test_word_spacing():
body, = html.children
line, = body.children
strong_1, = line.children
assert 200 <= strong_1.width <= 250

# TODO: Pango gives only half of word-spacing to a space at the end
# of a TextBox. Is this what we want?
Expand All @@ -2899,7 +2898,6 @@ def test_letter_spacing():
body, = html.children
line, = body.children
strong_1, = line.children
assert 250 <= strong_1.width <= 300

page, = parse('''
<style>strong { letter-spacing: 11px }</style>
Expand Down Expand Up @@ -3535,7 +3533,7 @@ def test_preferred_widths():
"""Unit tests for preferred widths."""
def get_float_width(body_width):
page, = parse('''
<body style="width: %spx">
<body style="width: %spx; font-family: ahem">
<p style="white-space: pre-line; float: left">
Lorem ipsum dolor sit amet,
consectetur elit
Expand All @@ -3546,11 +3544,10 @@ def get_float_width(body_width):
body, = html.children
paragraph, = body.children
return paragraph.width
# Not exact, depends on the installed fonts
# Preferred minimum width:
assert 120 < get_float_width(10) < 140
assert get_float_width(10) == len('consectetur elit') * 16
# Preferred width:
assert 220 < get_float_width(10000) < 240
assert get_float_width(1000000) == len('Lorem ipsum dolor sit amet,') * 16

# Non-regression test:
# Incorrect whitespace handling in preferred width used to cause
Expand Down

0 comments on commit 54fde80

Please sign in to comment.