mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Move some tests to test/ref. Make ref tests ignorable
This commit is contained in:
parent
afd9efbe5a
commit
23e50b392c
5 changed files with 36 additions and 2 deletions
|
@ -55,14 +55,46 @@ fn find_tests(config: Config) -> ~[test_desc] {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_test(config: Config, file: ~str) -> test_desc {
|
fn make_test(config: Config, file: ~str) -> test_desc {
|
||||||
|
let directives = load_test_directives(file);
|
||||||
|
|
||||||
{
|
{
|
||||||
name: file,
|
name: file,
|
||||||
fn: fn~() { run_test(config, file) },
|
fn: fn~() { run_test(config, file) },
|
||||||
ignore: false,
|
ignore: directives.ignore,
|
||||||
should_fail: false
|
should_fail: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Directives {
|
||||||
|
ignore: bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load_test_directives(file: ~str) -> Directives {
|
||||||
|
let data = match io::read_whole_file_str(file) {
|
||||||
|
result::ok(data) => data,
|
||||||
|
result::err(*) => fail #fmt("unable to load directives for %s", file)
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut ignore = false;
|
||||||
|
|
||||||
|
for str::lines(data).each |line| {
|
||||||
|
if is_comment(line) {
|
||||||
|
if line.contains("ignore") {
|
||||||
|
ignore = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_comment(line: ~str) -> bool {
|
||||||
|
line.starts_with("<!--")
|
||||||
|
}
|
||||||
|
|
||||||
|
return Directives {
|
||||||
|
ignore: ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn run_test(config: Config, file: ~str) {
|
fn run_test(config: Config, file: ~str) {
|
||||||
let servo_render = render_servo(config, file);
|
let servo_render = render_servo(config, file);
|
||||||
let ref_render = render_ref(config, file);
|
let ref_render = render_ref(config, file);
|
||||||
|
@ -77,7 +109,7 @@ const WIDTH: uint = 800;
|
||||||
const HEIGHT: uint = 600;
|
const HEIGHT: uint = 600;
|
||||||
|
|
||||||
fn render_servo(config: Config, file: ~str) -> Render {
|
fn render_servo(config: Config, file: ~str) -> Render {
|
||||||
let infile = file;
|
let infile = ~"file://" + os::make_absolute(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);
|
||||||
return sanitize_image(outfile);
|
return sanitize_image(outfile);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- ignore -->
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="height_width.css" />
|
<link rel="stylesheet" href="height_width.css" />
|
||||||
</head>
|
</head>
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- ignore -->
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="height.css" />
|
<link rel="stylesheet" href="height.css" />
|
||||||
</head>
|
</head>
|
Loading…
Add table
Add a link
Reference in a new issue