mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-05 00:21:15 +03:00
Ignore tests with dom or interact flag
This commit is contained in:
parent
6cbdab0799
commit
9b3e66ccbe
@ -26,14 +26,16 @@ import pystacia
|
||||
from weasyprint import HTML, CSS
|
||||
from weasyprint.compat import urlopen
|
||||
|
||||
from .web import read_testinfo
|
||||
|
||||
|
||||
TEST_SUITE_VERSION = '20110323'
|
||||
|
||||
#BASE_URL = 'http://test.csswg.org/suites/css2.1/{}/html4/'
|
||||
# Download and extract the zip file from http://test.csswg.org/suites/css2.1/
|
||||
BASE_URL = 'file://' + os.path.expanduser('~/css2.1_test_suite/{}/html4/')
|
||||
|
||||
BASE_URL = BASE_URL.format(TEST_SUITE_VERSION)
|
||||
BASE_PATH = os.path.expanduser(
|
||||
'~/css2.1_test_suite/{}/html4/').format(TEST_SUITE_VERSION)
|
||||
BASE_URL = 'file://' + BASE_PATH
|
||||
|
||||
RESULTS_DIRECTORY = os.path.join(os.path.dirname(__file__), 'test_results')
|
||||
|
||||
@ -41,6 +43,8 @@ PAGE_SIZE_STYLESHEET = CSS(string='''
|
||||
@page { margin: 0; -weasy-size: 640px }
|
||||
''')
|
||||
|
||||
IGNORED_FLAGS = {'interact', 'dom'}
|
||||
|
||||
|
||||
def get_url(url):
|
||||
return closing(urlopen(BASE_URL + url))
|
||||
@ -73,8 +77,8 @@ def make_test_suite():
|
||||
rendered = {} # Memoize
|
||||
|
||||
def render(name):
|
||||
result = rendered.get(name)
|
||||
if result is None:
|
||||
raw = rendered.get(name)
|
||||
if raw is None:
|
||||
# name is sometimes "support/something.htm"
|
||||
basename = os.path.basename(name)
|
||||
png_filename = os.path.join(RESULTS_DIRECTORY, basename + '.png')
|
||||
@ -83,7 +87,11 @@ def make_test_suite():
|
||||
with closing(pystacia.read(png_filename)) as image:
|
||||
raw = image.get_raw('rgba')
|
||||
rendered[name] = raw
|
||||
return result
|
||||
return raw
|
||||
|
||||
flags_by_id = {
|
||||
test['test_id'] + '.htm': test['flags']
|
||||
for test in read_testinfo(BASE_PATH)}
|
||||
|
||||
for equal, test, references in get_test_list():
|
||||
# Use default parameter values to bind to the current values,
|
||||
@ -93,7 +101,8 @@ def make_test_suite():
|
||||
references_render = map(render, references)
|
||||
return all((test_render != ref_render) ^ equal
|
||||
for ref_render in references_render)
|
||||
yield test, test_function
|
||||
if not set(flags_by_id[test]).intersection(IGNORED_FLAGS):
|
||||
yield test, test_function
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -24,7 +24,7 @@ from weasyprint import HTML, CSS
|
||||
|
||||
|
||||
def split(something):
|
||||
return something.split(',') if something else ''
|
||||
return something.split(',') if something else []
|
||||
|
||||
|
||||
def read_testinfo(suite_directory):
|
||||
|
Loading…
Reference in New Issue
Block a user