mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix unit tests for media queries.
This commit is contained in:
parent
b278fc2284
commit
a48c780d22
1 changed files with 3 additions and 2 deletions
|
@ -311,12 +311,13 @@ mod tests {
|
|||
use geom::size::TypedSize2D;
|
||||
use properties::common_types::*;
|
||||
use stylesheets::{iter_stylesheet_media_rules, iter_stylesheet_style_rules, Stylesheet};
|
||||
use selector_matching::AuthorOrigin;
|
||||
use super::*;
|
||||
use url::Url;
|
||||
|
||||
fn test_media_rule(css: &str, callback: |&MediaQueryList, &str|) {
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let stylesheet = Stylesheet::from_str(css, url);
|
||||
let stylesheet = Stylesheet::from_str(css, url, AuthorOrigin);
|
||||
let mut rule_count: int = 0;
|
||||
iter_stylesheet_media_rules(&stylesheet, |rule| {
|
||||
rule_count += 1;
|
||||
|
@ -327,7 +328,7 @@ mod tests {
|
|||
|
||||
fn media_query_test(device: &Device, css: &str, expected_rule_count: int) {
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let ss = Stylesheet::from_str(css, url);
|
||||
let ss = Stylesheet::from_str(css, url, AuthorOrigin);
|
||||
let mut rule_count: int = 0;
|
||||
iter_stylesheet_style_rules(&ss, device, |_| rule_count += 1);
|
||||
assert!(rule_count == expected_rule_count, css.to_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue