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

Make use of Servo-specific ToCss everywhere! #14089

Merged
merged 3 commits into from Nov 7, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Fix the unit tests to make use of local ToCss

  • Loading branch information
wafflespeanut committed Nov 7, 2016
commit 5ac1c11e9e4c6c3515355a8e4a3193091e25e364
@@ -5,6 +5,7 @@
use parsing::parse;
use style::parser::Parse;
use style::values::specified::basic_shape::*;
use style_traits::ToCss;

// Ensure that basic-shape sub-functions parse as both basic shapes
// and their individual components
@@ -21,14 +22,14 @@ macro_rules! assert_border_radius_values {
let input = parse(BorderRadius::parse, $input)
.expect(&format!("Failed parsing {} as border radius",
$input));
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_left.0.width), $tlw);
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_right.0.width), $trw);
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_right.0.width), $brw);
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_left.0.width), $blw);
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_left.0.height), $tlh);
assert_eq!(::cssparser::ToCss::to_css_string(&input.top_right.0.height), $trh);
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_right.0.height), $brh);
assert_eq!(::cssparser::ToCss::to_css_string(&input.bottom_left.0.height), $blh);
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_left.0.width), $tlw);
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_right.0.width), $trw);
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_right.0.width), $brw);
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_left.0.width), $blw);
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_left.0.height), $tlh);
assert_eq!(::style_traits::ToCss::to_css_string(&input.top_right.0.height), $trh);
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_right.0.height), $brh);
assert_eq!(::style_traits::ToCss::to_css_string(&input.bottom_left.0.height), $blh);
}
}

@@ -9,6 +9,7 @@ use style::properties::longhands::font_feature_settings;
use style::properties::longhands::font_feature_settings::computed_value;
use style::properties::longhands::font_feature_settings::computed_value::FeatureTagValue;
use style::stylesheets::Origin;
use style_traits::ToCss;
use url::Url;

#[test]
@@ -100,7 +101,7 @@ fn font_language_override_should_parse_properly() {
#[test]
#[should_panic]
fn font_language_override_should_fail_on_empty_str() {
use style::properties::longhands::font_language_override::{self, SpecifiedValue};
use style::properties::longhands::font_language_override;

parse_longhand!(font_language_override, "");
}
@@ -7,6 +7,7 @@ use media_queries::CSSErrorReporterTest;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style::values::specified::image::*;
use style_traits::ToCss;
use url::Url;

#[test]
@@ -21,12 +21,12 @@ macro_rules! assert_roundtrip {
($fun:expr, $input:expr, $output:expr) => {
let parsed = $crate::parsing::parse($fun, $input)
.expect(&format!("Failed to parse {}", $input));
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
let serialized = ToCss::to_css_string(&parsed);
assert_eq!(serialized, $output);

let re_parsed = $crate::parsing::parse($fun, &serialized)
.expect(&format!("Failed to parse serialization {}", $input));
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
let re_serialized = ToCss::to_css_string(&re_parsed);
assert_eq!(serialized, re_serialized);
}
}
@@ -41,13 +41,13 @@ macro_rules! assert_roundtrip_with_context {
let mut parser = Parser::new($input);
let parsed = $fun(&context, &mut parser)
.expect(&format!("Failed to parse {}", $input));
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
let serialized = ToCss::to_css_string(&parsed);
assert_eq!(serialized, $output);

let mut parser = Parser::new(&serialized);
let re_parsed = $fun(&context, &mut parser)
.expect(&format!("Failed to parse {}", $input));
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
let re_serialized = ToCss::to_css_string(&re_parsed);
assert_eq!(serialized, re_serialized);
}
}
@@ -4,6 +4,7 @@

use parsing::parse;
use style::values::specified::position::*;
use style_traits::ToCss;

#[test]
fn test_position() {
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use cssparser::Parser;
use cssparser::{Parser, ToCss};
use selectors::parser::{Selector, ParserContext, parse_selector_list};
use style::selector_impl::TheSelectorImpl;

@@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

pub use cssparser::ToCss;
pub use std::sync::Arc;
pub use style::computed_values::display::T::inline_block;
pub use style::properties::{DeclaredValue, PropertyDeclaration, PropertyDeclarationBlock, Importance};
@@ -11,6 +10,7 @@ pub use style::values::specified::{LengthOrPercentage, LengthOrPercentageOrAuto,
pub use style::properties::longhands::outline_color::computed_value::T as ComputedColor;
pub use style::values::RGBA;
pub use style::values::specified::UrlExtraData;
pub use style_traits::ToCss;
pub use url::Url;

#[test]
@@ -11,6 +11,7 @@ extern crate libc;
#[macro_use] extern crate log;
extern crate parking_lot;
extern crate style;
extern crate style_traits;
extern crate url;

mod sanity_checks;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.