diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2015-03-05 16:47:23 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2015-03-05 16:52:16 +0100 |
commit | c066377fc5f7669dd8604a49cb7215513ad1eb3c (patch) | |
tree | f2bdde4e1732c8c88d27a72372e70c50c125b21b | |
parent | bc1c44bbc2245d84e1b948506a1024ab1308ab8d (diff) | |
download | servo-c066377fc5f7669dd8604a49cb7215513ad1eb3c.tar.gz servo-c066377fc5f7669dd8604a49cb7215513ad1eb3c.zip |
Add support for changing the viewport size in reftests.
Usage example, in `*.list` files:
resolution=200x300 == something.html something_ref.html
-rw-r--r-- | tests/reftest.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/reftest.rs b/tests/reftest.rs index 3908217c556..f4fe8e51037 100644 --- a/tests/reftest.rs +++ b/tests/reftest.rs @@ -136,6 +136,7 @@ struct Reftest { is_flaky: bool, experimental: bool, fragment_identifier: Option<String>, + resolution: Option<String>, } struct TestLine<'a> { @@ -195,6 +196,7 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o let mut flakiness = RenderMode::empty(); let mut experimental = false; let mut fragment_identifier = None; + let mut resolution = None; for condition in conditions_list { match condition { "flaky_cpu" => flakiness.insert(CPU_RENDERING), @@ -207,6 +209,9 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o if condition.starts_with("fragment=") { fragment_identifier = Some(condition.slice_from("fragment=".len()).to_string()); } + if condition.starts_with("resolution=") { + resolution = Some(condition.slice_from("resolution=".len()).to_string()); + } } let reftest = Reftest { @@ -219,6 +224,7 @@ fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_o is_flaky: render_mode.intersects(flakiness), experimental: experimental, fragment_identifier: fragment_identifier, + resolution: resolution, }; tests.push(make_test(reftest)); @@ -265,6 +271,10 @@ fn capture(reftest: &Reftest, side: usize) -> (u32, u32, Vec<u8>) { if reftest.experimental { command.arg("--experimental"); } + if let Some(ref resolution) = reftest.resolution { + command.arg("--resolution"); + command.arg(resolution); + } let retval = match command.status() { Ok(status) => status, Err(e) => panic!("failed to execute process: {}", e), |