Work on the ref test harness

This commit is contained in:
Brian Anderson 2012-08-20 18:41:56 -07:00
parent e4b13553f8
commit 96dfe6173e
3 changed files with 36 additions and 7 deletions

View file

@ -1,13 +1,21 @@
import sys
import sys, os
from selenium import webdriver
input = sys.argv[1]
output = sys.argv[2]
input = os.path.abspath(input)
output = os.path.abspath(output)
input = "file://" + input
print input
print output
driver = webdriver.Firefox()
driver.set_window_size(800, 600)
driver.get(file)
driver.set_window_size(800, 700)
driver.get(input)
screenshot = driver.get_screenshot_as_file(output)

View file

@ -12,7 +12,7 @@ fn main(args: ~[~str]) {
let config = parse_config(args);
let opts = test_options(config);
let tests = find_tests(config);
install_rasterize_py();
install_rasterize_py(config);
run_tests_console(opts, tests);
}
@ -77,14 +77,30 @@ fn render_servo(config: Config, file: ~str) -> Render {
let infile = file;
let outfile = connect(config.work_dir, basename(file) + ".png");
run_pipeline_png(infile, outfile);
fail;
let buf = io::read_whole_file(outfile).get();
return servo::image::base::load_from_memory(buf).get().data;
}
fn render_ref(config: Config, file: ~str) -> Render {
fail
let infile = file;
let outfile = connect(config.work_dir, basename(file) + ".ref.png");
let rasterize_path = rasterize_path(config);
let prog = run::start_program("python", ~[rasterize_path, infile, outfile]);
prog.finish();
let buf = io::read_whole_file(outfile).get();
return servo::image::base::load_from_memory(buf).get().data;
}
fn install_rasterize_py() { }
fn install_rasterize_py(config: Config) {
import io::WriterUtil;
let path = rasterize_path(config);
let writer = io::file_writer(path, ~[io::Create, io::Truncate]).get();
writer.write_str(rasterize_py());
}
fn rasterize_path(config: Config) -> ~str {
connect(config.work_dir, ~"rasterize.py")
}
// This is the script that uses phantom.js to render pages
fn rasterize_py() -> ~str { #include_str("rasterize.py") }

5
src/test/blank.html Normal file
View file

@ -0,0 +1,5 @@
<!DOCTYPE html>
<html>
<body>
</body>
</html>