mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
More work on ref test harness
This commit is contained in:
parent
4f6d4f3561
commit
5cc03c7618
1 changed files with 39 additions and 2 deletions
|
@ -1,13 +1,17 @@
|
|||
use std;
|
||||
use servo;
|
||||
|
||||
import result::{ok, err};
|
||||
import std::test{test_opts, run_tests_console, test_desc};
|
||||
import std::getopts::{getopts, reqopt, opt_opt, fail_str};
|
||||
import std::path::connect;
|
||||
import os::list_dir_path;
|
||||
|
||||
fn main(args: [str]) {
|
||||
let config = parse_config(args);
|
||||
let opts = test_options(config);
|
||||
let tests = find_tests(config);
|
||||
install_rasterize_js();
|
||||
run_tests_console(opts, tests);
|
||||
}
|
||||
|
||||
|
@ -35,7 +39,7 @@ fn parse_config(args: [str]) -> Config {
|
|||
}
|
||||
}
|
||||
|
||||
fn test_options(config: config) -> test_opts {
|
||||
fn test_options(config: Config) -> test_opts {
|
||||
{
|
||||
filter: none,
|
||||
run_ignored: false,
|
||||
|
@ -43,9 +47,42 @@ fn test_options(config: config) -> test_opts {
|
|||
}
|
||||
}
|
||||
|
||||
fn find_tests(config: config) -> [test_desc] {
|
||||
fn find_tests(config: Config) -> [test_desc] {
|
||||
let html_files = list_dir_path(config.source_dir).filter({ |file| file.ends_with(".html") });
|
||||
ret html_files.map({ |file| make_test(config, file) });
|
||||
}
|
||||
|
||||
fn make_test(config: Config, file: str) -> test_desc {
|
||||
{
|
||||
name: file,
|
||||
fn: { || run_test(config, file) },
|
||||
ignore: false,
|
||||
should_fail: false
|
||||
}
|
||||
}
|
||||
|
||||
fn run_test(config: Config, file: str) {
|
||||
let servo_render = render_servo(config, file);
|
||||
let ref_render = render_ref(config, file);
|
||||
if !servo_render.eq(ref_render) {
|
||||
fail;
|
||||
}
|
||||
}
|
||||
|
||||
type Render = [u8];
|
||||
|
||||
fn render_servo(config: Config, file: str) -> Render {
|
||||
let infile = connect(config.work_dir, file);
|
||||
let outfile = infile + ".png";
|
||||
run_pipeline_png(infile, outfile);
|
||||
fail;
|
||||
}
|
||||
|
||||
fn render_ref(config: Config, file: str) -> Render {
|
||||
fail
|
||||
}
|
||||
|
||||
fn install_rasterize_js() { fail }
|
||||
|
||||
// This is the script that uses phantom.js to render pages
|
||||
fn rasterize_js() -> str { #include_str("rasterize.js") }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue