Auto merge of #13950 - bheart:parse-font-language-override-property, r=emilio

Implement parsing for font-language-override property

Implement and test parsing of the `font-language-override` style property.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #13874
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13950)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-10-28 11:23:39 -05:00 committed by GitHub
commit c6ef48ccc1
2 changed files with 74 additions and 0 deletions

View file

@ -76,3 +76,31 @@ fn font_feature_settings_to_css() {
assert_roundtrip_with_context!(font_feature_settings::parse, "\"abcd\" 4");
assert_roundtrip_with_context!(font_feature_settings::parse, "\"abcd\", \"efgh\"");
}
#[test]
fn font_language_override_should_parse_properly() {
use style::properties::longhands::font_language_override::{self, SpecifiedValue};
let normal = parse_longhand!(font_language_override, "normal");
assert_eq!(normal, SpecifiedValue::Normal);
let empty_str = parse_longhand!(font_language_override, "\"\"");
assert_eq!(empty_str, SpecifiedValue::Override("".to_string()));
let normal_str = parse_longhand!(font_language_override, "\"normal\"");
assert_eq!(normal_str, SpecifiedValue::Override("normal".to_string()));
let turkic = parse_longhand!(font_language_override, "\"TRK\"");
assert_eq!(turkic, SpecifiedValue::Override("TRK".to_string()));
let danish = parse_longhand!(font_language_override, "\"DAN\"");
assert_eq!(danish, SpecifiedValue::Override("DAN".to_string()));
}
#[test]
#[should_panic]
fn font_language_override_should_fail_on_empty_str() {
use style::properties::longhands::font_language_override::{self, SpecifiedValue};
parse_longhand!(font_language_override, "");
}