Change KeywordValue to enum

This commit is contained in:
Nazım Can Altınova 2016-10-23 02:38:36 +03:00
parent 769129f5c2
commit 6dc2c36310
2 changed files with 48 additions and 49 deletions

View file

@ -11,37 +11,25 @@ use url::Url;
#[test]
fn text_emphasis_style_longhand_should_parse_properly() {
use style::properties::longhands::text_emphasis_style;
use style::properties::longhands::text_emphasis_style::{ShapeKeyword, SpecifiedValue, Keyword};
use style::properties::longhands::text_emphasis_style::{ShapeKeyword, SpecifiedValue, KeywordValue};
let none = parse_longhand!(text_emphasis_style, "none");
assert_eq!(none, SpecifiedValue::None);
let fill = parse_longhand!(text_emphasis_style, "open");
let fill_struct = SpecifiedValue::Keyword(Keyword {
fill: Some(false),
shape: None
});
let fill_struct = SpecifiedValue::Keyword(KeywordValue::Fill(false));
assert_eq!(fill, fill_struct);
let shape = parse_longhand!(text_emphasis_style, "triangle");
let shape_struct = SpecifiedValue::Keyword(Keyword {
fill: None,
shape: Some(ShapeKeyword::Triangle)
});
let shape_struct = SpecifiedValue::Keyword(KeywordValue::Shape(ShapeKeyword::Triangle));
assert_eq!(shape, shape_struct);
let fill_shape = parse_longhand!(text_emphasis_style, "filled dot");
let fill_shape_struct = SpecifiedValue::Keyword(Keyword {
fill: Some(true),
shape: Some(ShapeKeyword::Dot)
});
let fill_shape_struct = SpecifiedValue::Keyword(KeywordValue::FillAndShape(true, ShapeKeyword::Dot));
assert_eq!(fill_shape, fill_shape_struct);
let shape_fill = parse_longhand!(text_emphasis_style, "dot filled");
let shape_fill_struct = SpecifiedValue::Keyword(Keyword {
fill: Some(true),
shape: Some(ShapeKeyword::Dot)
});
let shape_fill_struct = SpecifiedValue::Keyword(KeywordValue::FillAndShape(true, ShapeKeyword::Dot));
assert_eq!(shape_fill, shape_fill_struct);
let a_string = parse_longhand!(text_emphasis_style, "\"a\"");