1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-08-24 20:37:41 +00:00
pdf2htmlEX/test/test_local_browser.py
Lu Wang 757810f170 travis debug
Update README.md

track travis branch on CI

install ttfautohint; run ctest with output-on-failure

check more c++11 features

use local browser to test

install selenium through pip in travis

refactor tests

use html instead of png as reference
2014-11-18 13:17:22 +08:00

34 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python
import unittest
import os
import subprocess
import shutil
from PIL import Image, ImageChops
from selenium import webdriver
from browser_tests import BrowserTests
class test_local_browser(BrowserTests, unittest.TestCase):
@classmethod
def setUpClass(cls):
super(test_local_browser, cls).setUpClass()
if not cls.GENERATING_MODE:
cls.browser = webdriver.Firefox()
cls.browser.maximize_window()
size = cls.browser.get_window_size()
assert ((size['width'] >= cls.BROWSER_WIDTH) and (size['height'] >= cls.BROWSER_HEIGHT)), 'Screen is not large enough'
cls.browser.set_window_size(cls.BROWSER_WIDTH, cls.BROWSER_HEIGHT)
@classmethod
def tearDownClass(cls):
if not cls.GENERATING_MODE:
cls.browser.quit()
super(test_local_browser, cls).tearDownClass()
def generate_image(self, html_file, png_file):
assert not self.GENERATING_MODE
self.browser.get('file://' + html_file)
self.browser.save_screenshot(png_file)