mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
Add parsing tests for radial gradient
This commit is contained in:
parent
89850e6efa
commit
00244a2248
2 changed files with 109 additions and 0 deletions
|
@ -31,8 +31,30 @@ macro_rules! assert_roundtrip {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! assert_roundtrip_with_context {
|
||||
($fun:expr, $string:expr) => {
|
||||
assert_roundtrip_with_context!($fun, $string, $string);
|
||||
};
|
||||
($fun:expr,$input:expr, $output:expr) => {
|
||||
let url = Url::parse("http://localhost").unwrap();
|
||||
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||
let mut parser = Parser::new($input);
|
||||
let parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let serialized = ::cssparser::ToCss::to_css_string(&parsed);
|
||||
assert_eq!(serialized, $output);
|
||||
|
||||
let mut parser = Parser::new(&serialized);
|
||||
let re_parsed = $fun(&context, &mut parser)
|
||||
.expect(&format!("Failed to parse {}", $input));
|
||||
let re_serialized = ::cssparser::ToCss::to_css_string(&re_parsed);
|
||||
assert_eq!(serialized, re_serialized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mod basic_shape;
|
||||
mod image;
|
||||
mod mask;
|
||||
mod position;
|
||||
mod selectors;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue