mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Auto merge of #17058 - Manishearth:stylo-randomprops, r=emilio
stylo: Support remaning longhands r=xidorn https://bugzilla.mozilla.org/show_bug.cgi?id=1367275 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17058) <!-- Reviewable:end -->
This commit is contained in:
commit
369d5cf124
14 changed files with 425 additions and 166 deletions
|
@ -5,8 +5,7 @@
|
|||
use parsing::parse;
|
||||
use style::properties::longhands::{font_feature_settings, font_weight};
|
||||
use style::properties::longhands::font_feature_settings::SpecifiedValue;
|
||||
use style::properties::longhands::font_feature_settings::computed_value;
|
||||
use style::properties::longhands::font_feature_settings::computed_value::FeatureTagValue;
|
||||
use style::values::generics::{FontSettings, FontSettingTag, FontSettingTagInt};
|
||||
use style_traits::ToCss;
|
||||
|
||||
#[test]
|
||||
|
@ -15,7 +14,7 @@ fn font_feature_settings_should_parse_properly() {
|
|||
use std::io::Cursor;
|
||||
|
||||
let normal = parse_longhand!(font_feature_settings, "normal");
|
||||
let normal_computed = SpecifiedValue::Value(computed_value::T::Normal);
|
||||
let normal_computed = SpecifiedValue::Value(FontSettings::Normal);
|
||||
assert_eq!(normal, normal_computed);
|
||||
|
||||
let mut a_d_bytes = Cursor::new(b"abcd");
|
||||
|
@ -25,33 +24,33 @@ fn font_feature_settings_should_parse_properly() {
|
|||
let efgh = e_h_bytes.read_u32::<BigEndian>().unwrap();
|
||||
|
||||
let on = parse_longhand!(font_feature_settings, "\"abcd\" on");
|
||||
let on_computed = SpecifiedValue::Value(computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: abcd, value: 1 }
|
||||
let on_computed = SpecifiedValue::Value(FontSettings::Tag(vec![
|
||||
FontSettingTag { tag: abcd, value: FontSettingTagInt(1) }
|
||||
]));
|
||||
assert_eq!(on, on_computed);
|
||||
|
||||
let off = parse_longhand!(font_feature_settings, "\"abcd\" off");
|
||||
let off_computed = SpecifiedValue::Value(computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: abcd, value: 0 }
|
||||
let off_computed = SpecifiedValue::Value(FontSettings::Tag(vec![
|
||||
FontSettingTag { tag: abcd, value: FontSettingTagInt(0) }
|
||||
]));
|
||||
assert_eq!(off, off_computed);
|
||||
|
||||
let no_value = parse_longhand!(font_feature_settings, "\"abcd\"");
|
||||
let no_value_computed = SpecifiedValue::Value(computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: abcd, value: 1 }
|
||||
let no_value_computed = SpecifiedValue::Value(FontSettings::Tag(vec![
|
||||
FontSettingTag { tag: abcd, value: FontSettingTagInt(1) }
|
||||
]));
|
||||
assert_eq!(no_value, no_value_computed);
|
||||
|
||||
let pos_integer = parse_longhand!(font_feature_settings, "\"abcd\" 100");
|
||||
let pos_integer_computed = SpecifiedValue::Value(computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: abcd, value: 100 }
|
||||
let pos_integer_computed = SpecifiedValue::Value(FontSettings::Tag(vec![
|
||||
FontSettingTag { tag: abcd, value: FontSettingTagInt(100) }
|
||||
]));
|
||||
assert_eq!(pos_integer, pos_integer_computed);
|
||||
|
||||
let multiple = parse_longhand!(font_feature_settings, "\"abcd\" off, \"efgh\"");
|
||||
let multiple_computed = SpecifiedValue::Value(computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: abcd, value: 0 },
|
||||
FeatureTagValue { tag: efgh, value: 1 }
|
||||
let multiple_computed = SpecifiedValue::Value(FontSettings::Tag(vec![
|
||||
FontSettingTag { tag: abcd, value: FontSettingTagInt(0) },
|
||||
FontSettingTag { tag: efgh, value: FontSettingTagInt(1) }
|
||||
]));
|
||||
assert_eq!(multiple, multiple_computed);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue