Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed 'on' bug, to_css bug; added tests
- Loading branch information
1 parent
b9e03f3
commit 8902002
Showing
3 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ macro_rules! parse_longhand { | |
} | ||
|
||
mod basic_shape; | ||
mod font; | ||
mod image; | ||
mod mask; | ||
mod position; | ||
|