mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Work on the ref test harness
This commit is contained in:
parent
e4b13553f8
commit
96dfe6173e
3 changed files with 36 additions and 7 deletions
|
@ -1,13 +1,21 @@
|
||||||
import sys
|
import sys, os
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
|
||||||
input = sys.argv[1]
|
input = sys.argv[1]
|
||||||
output = sys.argv[2]
|
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 = webdriver.Firefox()
|
||||||
|
|
||||||
driver.set_window_size(800, 600)
|
driver.set_window_size(800, 700)
|
||||||
driver.get(file)
|
driver.get(input)
|
||||||
|
|
||||||
screenshot = driver.get_screenshot_as_file(output)
|
screenshot = driver.get_screenshot_as_file(output)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn main(args: ~[~str]) {
|
||||||
let config = parse_config(args);
|
let config = parse_config(args);
|
||||||
let opts = test_options(config);
|
let opts = test_options(config);
|
||||||
let tests = find_tests(config);
|
let tests = find_tests(config);
|
||||||
install_rasterize_py();
|
install_rasterize_py(config);
|
||||||
run_tests_console(opts, tests);
|
run_tests_console(opts, tests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,14 +77,30 @@ fn render_servo(config: Config, file: ~str) -> Render {
|
||||||
let infile = file;
|
let infile = file;
|
||||||
let outfile = connect(config.work_dir, basename(file) + ".png");
|
let outfile = connect(config.work_dir, basename(file) + ".png");
|
||||||
run_pipeline_png(infile, outfile);
|
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 {
|
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
|
// This is the script that uses phantom.js to render pages
|
||||||
fn rasterize_py() -> ~str { #include_str("rasterize.py") }
|
fn rasterize_py() -> ~str { #include_str("rasterize.py") }
|
||||||
|
|
5
src/test/blank.html
Normal file
5
src/test/blank.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue