diff options
-rwxr-xr-x | wfs.py | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -109,7 +109,7 @@ def extract(path, fonts, screenshots): height = DRIVER.execute_script(''.join([ "let style = document.createElement('style'); style.innerHTML = '", ''.join(gen_font_face(font) for font in fonts), - "'; document.body.appendChild(style); return document.body.parentNode.scrollHeight"])) + "'; document.body.appendChild(style); return document.documentElement.scrollHeight"])) logger.info('taking pre-screenshot for %s', path) DRIVER.set_window_size(1920, height) screenshot = DRIVER.get_screenshot_as_png() @@ -155,21 +155,11 @@ def verify(path, screenshot_begin_png): DRIVER.set_window_size(*screenshot_begin.size) screenshot_end_png = DRIVER.get_screenshot_as_png() - logger.info('checking screenshot for %s', path) screenshot_end = Image.open(BytesIO(screenshot_end_png), formats=('PNG',)).convert('RGB') + logger.info('checking %s screenshots for %s', 'x'.join(map(str, screenshot_end.size)), path) if ImageChops.difference(screenshot_begin, screenshot_end).getbbox(): raise Exception(f'screenshots do not match for {path}') -class LocalPool: - def __init__(self, driver_name): - start_wworker(driver_name) - - def starmap(self, func, args, *_): - return [func(*arg) for arg in args] - - def close(self): - stop_driver() - def main(argv): parser = argparse.ArgumentParser(description='Web Font Subsetter', epilog='see pyftsubset --help for additional options') parser.add_argument('--driver', help='selenium driver name (chrome or firefox)', default='chrome') |