mirror of
https://github.com/servo/servo.git
synced 2025-08-14 18:05:36 +01:00
Auto merge of #16568 - WholeGrainGoats:master, r=Manishearth
font-feature-settings gecko glue code <!-- Please describe your changes on the following line: --> FeatureTagValue value property changed to use u32. ToCss for FeatureTagValue changed to allow conversion from u32 to string. Parse for the same struct updated to convert from string to u32. Added two functions to transfer settings to gecko and copy settings. --- <!-- 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 #15975 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- 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/16568) <!-- Reviewable:end -->
This commit is contained in:
commit
01f169d8c1
6 changed files with 79 additions and 17 deletions
|
@ -13,6 +13,7 @@ doctest = false
|
|||
testing = ["style/testing"]
|
||||
|
||||
[dependencies]
|
||||
byteorder = "1.0"
|
||||
app_units = "0.4"
|
||||
cssparser = "0.13"
|
||||
euclid = "0.11"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#![feature(plugin, test)]
|
||||
|
||||
extern crate app_units;
|
||||
extern crate byteorder;
|
||||
extern crate cssparser;
|
||||
extern crate euclid;
|
||||
#[macro_use] extern crate html5ever;
|
||||
|
|
|
@ -10,38 +10,47 @@ use style_traits::ToCss;
|
|||
|
||||
#[test]
|
||||
fn font_feature_settings_should_parse_properly() {
|
||||
use byteorder::{ReadBytesExt, NativeEndian};
|
||||
use std::io::Cursor;
|
||||
|
||||
let normal = parse_longhand!(font_feature_settings, "normal");
|
||||
let normal_computed = computed_value::T::Normal;
|
||||
assert_eq!(normal, normal_computed);
|
||||
|
||||
let mut a_d_bytes = Cursor::new(b"abcd");
|
||||
let mut e_h_bytes = Cursor::new(b"efgh");
|
||||
|
||||
let abcd = a_d_bytes.read_u32::<NativeEndian>().unwrap();
|
||||
let efgh = e_h_bytes.read_u32::<NativeEndian>().unwrap();
|
||||
|
||||
let on = parse_longhand!(font_feature_settings, "\"abcd\" on");
|
||||
let on_computed = computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: String::from("abcd"), value: 1 }
|
||||
FeatureTagValue { tag: abcd, value: 1 }
|
||||
]);
|
||||
assert_eq!(on, on_computed);
|
||||
|
||||
let off = parse_longhand!(font_feature_settings, "\"abcd\" off");
|
||||
let off_computed = computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: String::from("abcd"), value: 0 }
|
||||
FeatureTagValue { tag: abcd, value: 0 }
|
||||
]);
|
||||
assert_eq!(off, off_computed);
|
||||
|
||||
let no_value = parse_longhand!(font_feature_settings, "\"abcd\"");
|
||||
let no_value_computed = computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: String::from("abcd"), value: 1 }
|
||||
FeatureTagValue { tag: abcd, value: 1 }
|
||||
]);
|
||||
assert_eq!(no_value, no_value_computed);
|
||||
|
||||
let pos_integer = parse_longhand!(font_feature_settings, "\"abcd\" 100");
|
||||
let pos_integer_computed = computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: String::from("abcd"), value: 100 }
|
||||
FeatureTagValue { tag: abcd, value: 100 }
|
||||
]);
|
||||
assert_eq!(pos_integer, pos_integer_computed);
|
||||
|
||||
let multiple = parse_longhand!(font_feature_settings, "\"abcd\" off, \"efgh\"");
|
||||
let multiple_computed = computed_value::T::Tag(vec![
|
||||
FeatureTagValue { tag: String::from("abcd"), value: 0 },
|
||||
FeatureTagValue { tag: String::from("efgh"), value: 1 }
|
||||
FeatureTagValue { tag: abcd, value: 0 },
|
||||
FeatureTagValue { tag: efgh, value: 1 }
|
||||
]);
|
||||
assert_eq!(multiple, multiple_computed);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue