mirror of
https://github.com/servo/servo.git
synced 2025-09-21 12:20:20 +01:00
Cleanup formatting in reftest.rs.
This commit is contained in:
parent
5c3b8f99d1
commit
2123fb4238
1 changed files with 76 additions and 86 deletions
|
@ -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 test_line = match parts.len() {
|
||||
3 => {
|
||||
TestLine {
|
||||
3 => TestLine {
|
||||
conditions: "",
|
||||
kind: parts[0],
|
||||
file_left: parts[1],
|
||||
file_right: parts[2],
|
||||
}
|
||||
},
|
||||
4 => {
|
||||
TestLine {
|
||||
4 => TestLine {
|
||||
conditions: parts[0],
|
||||
kind: parts[1],
|
||||
file_left: parts[2],
|
||||
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 {
|
||||
|
@ -141,13 +135,9 @@ fn parse_lists(file: &String, servo_args: &[String], render_mode: RenderMode) ->
|
|||
let mut flakiness = 0;
|
||||
for condition in conditions_list {
|
||||
match condition {
|
||||
"flaky_cpu" => {
|
||||
flakiness |= CpuRendering as uint;
|
||||
},
|
||||
"flaky_gpu" => {
|
||||
flakiness |= GpuRendering as uint;
|
||||
},
|
||||
_ => {}
|
||||
"flaky_cpu" => flakiness |= CpuRendering as uint,
|
||||
"flaky_gpu" => flakiness |= GpuRendering as uint,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +194,7 @@ fn check_reftest(reftest: Reftest) {
|
|||
let left = capture(&reftest, 0);
|
||||
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 {
|
||||
// White for correct
|
||||
0xFF
|
||||
|
@ -215,7 +205,7 @@ fn check_reftest(reftest: Reftest) {
|
|||
// scaling but does not require reconstructing the actual RGBA pixel.
|
||||
0xC0
|
||||
}
|
||||
}).collect();
|
||||
}).collect::<Vec<u8>>();
|
||||
|
||||
let test_is_flaky = (reftest.render_mode as uint & reftest.flakiness) != 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue