mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Allow negative values for letter-spacing and word-spacing. Inline Length parse functions.
Signed-off-by: Sam <sam@sam.uk.net> Use existing parse functions for any length parsing of letter-spacing and word-spacing. Signed-off-by: Sam <sam@sam.uk.net> Add letter-spacing test Signed-off-by: Sam <sam@sam.uk.net> Add tests for letter-spacing and word-spacing negative parsing. Signed-off-by: Sam <sam@sam.uk.net> Remove extra line. Signed-off-by: Sam <sam@sam.uk.net> Remove _ of _context. Signed-off-by: Sam <sam@sam.uk.net> Refactor tests to use new NoCalcLength Signed-off-by: Sam <sam@sam.uk.net> Remove unused import. Signed-off-by: Sam <sam@sam.uk.net> Remove un-needed use.
This commit is contained in:
parent
fb4f421c8b
commit
3682434828
5 changed files with 28 additions and 11 deletions
|
@ -7,6 +7,29 @@ use media_queries::CSSErrorReporterTest;
|
|||
use style::parser::ParserContext;
|
||||
use style::stylesheets::Origin;
|
||||
|
||||
#[test]
|
||||
fn negative_letter_spacing_should_parse_properly() {
|
||||
use style::properties::longhands::letter_spacing;
|
||||
use style::properties::longhands::letter_spacing::SpecifiedValue;
|
||||
use style::values::specified::length::{Length, NoCalcLength, FontRelativeLength};
|
||||
|
||||
let negative_value = parse_longhand!(letter_spacing, "-0.5em");
|
||||
let expected = SpecifiedValue::Specified(Length::NoCalc(NoCalcLength::FontRelative(FontRelativeLength::Em(-0.5))));
|
||||
assert_eq!(negative_value, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn negative_word_spacing_should_parse_properly() {
|
||||
use style::properties::longhands::word_spacing;
|
||||
use style::properties::longhands::word_spacing::SpecifiedValue;
|
||||
use style::values::specified::length::{NoCalcLength, LengthOrPercentage, FontRelativeLength};
|
||||
|
||||
let negative_value = parse_longhand!(word_spacing, "-0.5em");
|
||||
let expected = SpecifiedValue::Specified(LengthOrPercentage::Length(NoCalcLength::FontRelative(
|
||||
FontRelativeLength::Em(-0.5))));
|
||||
assert_eq!(negative_value, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_emphasis_style_longhand_should_parse_properly() {
|
||||
use style::properties::longhands::text_emphasis_style;
|
||||
|
@ -79,7 +102,6 @@ fn test_text_emphasis_position() {
|
|||
assert_eq!(left_under, SpecifiedValue(HorizontalWritingModeValue::Under, VerticalWritingModeValue::Left));
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn webkit_text_stroke_shorthand_should_parse_properly() {
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[text-word-spacing-001.htm]
|
||||
type: reftest
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[c542-letter-sp-001.htm]
|
||||
type: reftest
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue