diff options
author | Matt Brubeck <mbrubeck@limpet.net> | 2015-09-18 02:14:06 -0700 |
---|---|---|
committer | Matt Brubeck <mbrubeck@limpet.net> | 2015-09-18 02:48:59 -0700 |
commit | 186ab5aa245862c686ba6349ba2af9e4662ad02f (patch) | |
tree | 955e3d739306450c01209b9edb52503fd978e4ec | |
parent | acde10f005f9d4c2062fe5480be163b2c6dfe823 (diff) | |
download | servo-186ab5aa245862c686ba6349ba2af9e4662ad02f.tar.gz servo-186ab5aa245862c686ba6349ba2af9e4662ad02f.zip |
Allow setting device-pixel-ratio for reftests
-rw-r--r-- | tests/reftest.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/reftest.rs b/tests/reftest.rs index 05fc484bfc1..3241aaca543 100644 --- a/tests/reftest.rs +++ b/tests/reftest.rs @@ -10,6 +10,7 @@ #![feature(append)] #![feature(fs_walk)] #![feature(path_ext)] +#![feature(result_expect)] #![feature(slice_patterns)] #![feature(test)] @@ -143,6 +144,7 @@ struct Reftest { prefs: Vec<String>, fragment_identifier: Option<String>, resolution: Option<String>, + pixel_ratio: Option<f32>, } struct TestLine<'a> { @@ -201,6 +203,7 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o let mut prefs = vec![]; let mut fragment_identifier = None; let mut resolution = None; + let mut pixel_ratio = None; for condition in conditions_list { match condition { "flaky_cpu" => flakiness.insert(CPU_RENDERING), @@ -220,6 +223,10 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o if condition.starts_with("resolution=") { resolution = Some(condition["resolution=".len() ..].to_string()); } + if condition.starts_with("device-pixel-ratio=") { + pixel_ratio = Some(condition["device-pixel-ratio=".len() ..].to_string() + .parse().expect("Invalid device-pixel-ratio")); + } } let reftest = Reftest { @@ -233,6 +240,7 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o prefs: prefs, fragment_identifier: fragment_identifier, resolution: resolution, + pixel_ratio: pixel_ratio, }; tests.push(make_test(reftest)); @@ -287,6 +295,10 @@ fn capture(reftest: &Reftest, side: usize) -> (u32, u32, Vec<u8>) { command.arg("--resolution"); command.arg(resolution); } + if let Some(pixel_ratio) = reftest.pixel_ratio { + command.arg("--device-pixel-ratio"); + command.arg(pixel_ratio.to_string()); + } let retval = match command.status() { Ok(status) => status, Err(e) => panic!("failed to execute process: {}", e), |