diff options
Diffstat (limited to 'tests/unit/style/parsing')
-rw-r--r-- | tests/unit/style/parsing/image.rs | 1 | ||||
-rw-r--r-- | tests/unit/style/parsing/inherited_box.rs | 2 | ||||
-rw-r--r-- | tests/unit/style/parsing/length.rs | 17 |
3 files changed, 18 insertions, 2 deletions
diff --git a/tests/unit/style/parsing/image.rs b/tests/unit/style/parsing/image.rs index 3e3bce84f89..68ccec16a5f 100644 --- a/tests/unit/style/parsing/image.rs +++ b/tests/unit/style/parsing/image.rs @@ -53,6 +53,7 @@ fn test_linear_gradient() { layout_parent_style: initial_style, style: initial_style.clone(), font_metrics_provider: &ServoMetricsProvider, + in_media_query: false, }; assert_eq!(specified::AngleOrCorner::None.to_computed_value(&specified_context), computed::AngleOrCorner::Angle(Angle::from_radians(PI))); diff --git a/tests/unit/style/parsing/inherited_box.rs b/tests/unit/style/parsing/inherited_box.rs index dbe364b7adf..749641c79cf 100644 --- a/tests/unit/style/parsing/inherited_box.rs +++ b/tests/unit/style/parsing/inherited_box.rs @@ -17,7 +17,7 @@ fn image_orientation_longhand_should_parse_properly() { assert_eq!(from_image, SpecifiedValue { angle: None, flipped: false }); let flip = parse_longhand!(image_orientation, "flip"); - assert_eq!(flip, SpecifiedValue { angle: None, flipped: true }); + assert_eq!(flip, SpecifiedValue { angle: Some(Angle::from_degrees(0.0)), flipped: true }); let zero = parse_longhand!(image_orientation, "0deg"); assert_eq!(zero, SpecifiedValue { angle: Some(Angle::from_degrees(0.0)), flipped: false }); diff --git a/tests/unit/style/parsing/length.rs b/tests/unit/style/parsing/length.rs index eda3b3425e3..39407441aaf 100644 --- a/tests/unit/style/parsing/length.rs +++ b/tests/unit/style/parsing/length.rs @@ -2,9 +2,13 @@ * 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 media_queries::CSSErrorReporterTest; use parsing::parse; -use style::parser::Parse; +use style::parser::{Parse, ParserContext}; +use style::stylesheets::Origin; use style::values::specified::length::Length; +use style_traits::ToCss; #[test] fn test_calc() { @@ -13,3 +17,14 @@ fn test_calc() { assert!(parse(Length::parse, "calc(1px + 2px )").is_ok()); assert!(parse(Length::parse, "calc( 1px + 2px)").is_ok()); } + +#[test] +fn test_length_literals() { + assert_roundtrip_with_context!(Length::parse, "0.33px", "0.33px"); + assert_roundtrip_with_context!(Length::parse, "0.33in", "0.33in"); + assert_roundtrip_with_context!(Length::parse, "0.33cm", "0.33cm"); + assert_roundtrip_with_context!(Length::parse, "0.33mm", "0.33mm"); + assert_roundtrip_with_context!(Length::parse, "0.33q", "0.33q"); + assert_roundtrip_with_context!(Length::parse, "0.33pt", "0.33pt"); + assert_roundtrip_with_context!(Length::parse, "0.33pc", "0.33pc"); +} |