Cleanup formatting in reftest.rs.

This commit is contained in:
Ms2ger 2014-08-19 16:43:33 +02:00
parent 5c3b8f99d1
commit 2123fb4238

View file

@ -106,25 +106,19 @@ fn parse_lists(file: &String, servo_args: &[String], render_mode: RenderMode) ->
let parts: Vec<&str> = line.split(' ').filter(|p| !p.is_empty()).collect(); let parts: Vec<&str> = line.split(' ').filter(|p| !p.is_empty()).collect();
let test_line = match parts.len() { let test_line = match parts.len() {
3 => { 3 => TestLine {
TestLine {
conditions: "", conditions: "",
kind: parts[0], kind: parts[0],
file_left: parts[1], file_left: parts[1],
file_right: parts[2], file_right: parts[2],
}
}, },
4 => { 4 => TestLine {
TestLine {
conditions: parts[0], conditions: parts[0],
kind: parts[1], kind: parts[1],
file_left: parts[2], file_left: parts[2],
file_right: parts[3], file_right: parts[3],
}
}, },
_ => { _ => fail!("reftest line: '{:s}' doesn't match '[CONDITIONS] KIND LEFT RIGHT'", line),
fail!("reftest line: '{:s}' doesn't match '[CONDITIONS] KIND LEFT RIGHT'", line);
}
}; };
let kind = match test_line.kind { let kind = match test_line.kind {
@ -141,13 +135,9 @@ fn parse_lists(file: &String, servo_args: &[String], render_mode: RenderMode) ->
let mut flakiness = 0; let mut flakiness = 0;
for condition in conditions_list { for condition in conditions_list {
match condition { match condition {
"flaky_cpu" => { "flaky_cpu" => flakiness |= CpuRendering as uint,
flakiness |= CpuRendering as uint; "flaky_gpu" => flakiness |= GpuRendering as uint,
}, _ => (),
"flaky_gpu" => {
flakiness |= GpuRendering as uint;
},
_ => {}
} }
} }
@ -204,7 +194,7 @@ fn check_reftest(reftest: Reftest) {
let left = capture(&reftest, 0); let left = capture(&reftest, 0);
let right = capture(&reftest, 1); let right = capture(&reftest, 1);
let pixels: Vec<u8> = left.pixels.iter().zip(right.pixels.iter()).map(|(&a, &b)| { let pixels = left.pixels.iter().zip(right.pixels.iter()).map(|(&a, &b)| {
if a as i8 - b as i8 == 0 { if a as i8 - b as i8 == 0 {
// White for correct // White for correct
0xFF 0xFF
@ -215,7 +205,7 @@ fn check_reftest(reftest: Reftest) {
// scaling but does not require reconstructing the actual RGBA pixel. // scaling but does not require reconstructing the actual RGBA pixel.
0xC0 0xC0
} }
}).collect(); }).collect::<Vec<u8>>();
let test_is_flaky = (reftest.render_mode as uint & reftest.flakiness) != 0; let test_is_flaky = (reftest.render_mode as uint & reftest.flakiness) != 0;