Added image-orientation property

This commit is contained in:
Sumant Manne 2016-12-08 05:36:49 -06:00
parent 0fe94a6724
commit faddb0c3bb
3 changed files with 165 additions and 0 deletions

View file

@ -0,0 +1,31 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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 style::parser::ParserContext;
use style::stylesheets::Origin;
#[test]
fn image_orientation_longhand_should_parse_properly() {
use std::f32::consts::PI;
use style::properties::longhands::image_orientation;
use style::properties::longhands::image_orientation::SpecifiedValue;
use style::values::specified::Angle;
let from_image = parse_longhand!(image_orientation, "from-image");
assert_eq!(from_image, SpecifiedValue { angle: None, flipped: false });
let flip = parse_longhand!(image_orientation, "flip");
assert_eq!(flip, SpecifiedValue { angle: None, flipped: true });
let zero = parse_longhand!(image_orientation, "0deg");
assert_eq!(zero, SpecifiedValue { angle: Some(Angle::from_radians(0.0)), flipped: false });
let negative_rad = parse_longhand!(image_orientation, "-1rad");
assert_eq!(negative_rad, SpecifiedValue { angle: Some(Angle::from_radians(-1.0)), flipped: false });
let flip_with_180 = parse_longhand!(image_orientation, "180deg flip");
assert_eq!(flip_with_180, SpecifiedValue { angle: Some(Angle::from_radians(PI)), flipped: true });
}

View file

@ -52,6 +52,7 @@ mod basic_shape;
mod border;
mod font;
mod image;
mod inherited_box;
mod inherited_text;
mod mask;
mod position;