Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #13860 - canaltinova:text-emphasis-style, r=Manishearth…
…,emilio Implement parsing/serialization and gecko glue for text-emphasis-style <!-- Please describe your changes on the following line: --> Implementation of parsing/serialization and gecko glue for text-emphasis-style. r? @Manishearth --- <!-- 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 #13853 (github issue number if applicable). <!-- Either: --> - [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/13860) <!-- Reviewable:end -->
- Loading branch information
Showing
5 changed files
with
297 additions
and
2 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
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,46 @@ | ||
/* 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 text_emphasis_style_longhand_should_parse_properly() { | ||
use style::properties::longhands::text_emphasis_style; | ||
use style::properties::longhands::text_emphasis_style::{ShapeKeyword, SpecifiedValue, KeywordValue}; | ||
|
||
let none = parse_longhand!(text_emphasis_style, "none"); | ||
assert_eq!(none, SpecifiedValue::None); | ||
|
||
let fill = parse_longhand!(text_emphasis_style, "open"); | ||
let fill_struct = SpecifiedValue::Keyword(KeywordValue::Fill(false)); | ||
assert_eq!(fill, fill_struct); | ||
|
||
let shape = parse_longhand!(text_emphasis_style, "triangle"); | ||
let shape_struct = SpecifiedValue::Keyword(KeywordValue::Shape(ShapeKeyword::Triangle)); | ||
assert_eq!(shape, shape_struct); | ||
|
||
let fill_shape = parse_longhand!(text_emphasis_style, "filled dot"); | ||
let fill_shape_struct = SpecifiedValue::Keyword(KeywordValue::FillAndShape(true, ShapeKeyword::Dot)); | ||
assert_eq!(fill_shape, fill_shape_struct); | ||
|
||
let shape_fill = parse_longhand!(text_emphasis_style, "dot filled"); | ||
let shape_fill_struct = SpecifiedValue::Keyword(KeywordValue::FillAndShape(true, ShapeKeyword::Dot)); | ||
assert_eq!(shape_fill, shape_fill_struct); | ||
|
||
let a_string = parse_longhand!(text_emphasis_style, "\"a\""); | ||
let a_string_struct = SpecifiedValue::String("a".to_string()); | ||
assert_eq!(a_string, a_string_struct); | ||
|
||
let chinese_string = parse_longhand!(text_emphasis_style, "\"点\""); | ||
let chinese_string_struct = SpecifiedValue::String("点".to_string()); | ||
assert_eq!(chinese_string, chinese_string_struct); | ||
|
||
let unicode_string = parse_longhand!(text_emphasis_style, "\"\\25B2\""); | ||
let unicode_string_struct = SpecifiedValue::String("▲".to_string()); | ||
assert_eq!(unicode_string, unicode_string_struct); | ||
} |
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