Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap to screen pixels instead of px #7667

Merged
merged 2 commits into from Sep 18, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Allow setting device-pixel-ratio for reftests

  • Loading branch information
mbrubeck committed Sep 18, 2015
commit 186ab5aa245862c686ba6349ba2af9e4662ad02f
@@ -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),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.