mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Fixed 'on' bug, to_css bug; added tests
This commit is contained in:
parent
b9e03f3f4b
commit
89020022a3
3 changed files with 59 additions and 5 deletions
43
tests/unit/style/parsing/font.rs
Normal file
43
tests/unit/style/parsing/font.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* 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;
|
||||
use url::Url;
|
||||
|
||||
#[test]
|
||||
fn font_feature_settings_should_parse_properly() {
|
||||
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;
|
||||
|
||||
let normal = parse_longhand!(font_feature_settings, "normal");
|
||||
let normal_computed = computed_value::T::Normal;
|
||||
assert_eq!(normal, normal_computed);
|
||||
|
||||
let on = parse_longhand!(font_feature_settings, "\"abcd\" on");
|
||||
let on_computed = computed_value::T::Computed(vec![FeatureTagValue{ tag:String::from("abcd"), value: 1 }]);
|
||||
assert_eq!(on, on_computed);
|
||||
|
||||
let off = parse_longhand!(font_feature_settings, "\"abcd\" off");
|
||||
let off_computed = computed_value::T::Computed(vec![FeatureTagValue{ tag:String::from("abcd"), value: 0 }]);
|
||||
assert_eq!(off, off_computed);
|
||||
|
||||
let empty = parse_longhand!(font_feature_settings, "\"abcd\"");
|
||||
let empty_computed = computed_value::T::Computed(vec![FeatureTagValue{ tag:String::from("abcd"), value: 1 }]);
|
||||
assert_eq!(empty, empty_computed);
|
||||
|
||||
let pos_integer = parse_longhand!(font_feature_settings, "\"abcd\" 100");
|
||||
let pos_integer_computed = computed_value::T::Computed(vec![FeatureTagValue{ tag:String::from("abcd"), value: 100 }]);
|
||||
assert_eq!(pos_integer, pos_integer_computed);
|
||||
|
||||
let pos_integer = parse_longhand!(font_feature_settings, "\"abcd\" off, \"efgh\"");
|
||||
let pos_integer_computed = computed_value::T::Computed(vec![
|
||||
FeatureTagValue{ tag:String::from("abcd"), value: 0 },
|
||||
FeatureTagValue{ tag:String::from("efgh"), value: 1 }
|
||||
]);
|
||||
assert_eq!(pos_integer, pos_integer_computed);
|
||||
}
|
|
@ -62,6 +62,7 @@ macro_rules! parse_longhand {
|
|||
}
|
||||
|
||||
mod basic_shape;
|
||||
mod font;
|
||||
mod image;
|
||||
mod mask;
|
||||
mod position;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue