mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
add tests
This commit is contained in:
parent
e165d1f885
commit
6d311c5465
1 changed files with 21 additions and 0 deletions
|
@ -8,6 +8,7 @@ use servo_url::ServoUrl;
|
|||
use style::parser::ParserContext;
|
||||
use style::stylesheets::Origin;
|
||||
use style_traits::ToCss;
|
||||
use style::properties::longhands;
|
||||
|
||||
#[test]
|
||||
fn test_clip() {
|
||||
|
@ -33,3 +34,23 @@ fn test_clip() {
|
|||
"rect(auto, auto, auto, auto)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_longhands_parse_origin() {
|
||||
let url = ServoUrl::parse("http://localhost").unwrap();
|
||||
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
|
||||
|
||||
let mut parser = Parser::new("1px 2px rubbish");
|
||||
let parsed = longhands::parse_origin(&context, &mut parser);
|
||||
assert_eq!(parsed.is_ok(), true);
|
||||
assert_eq!(parser.is_exhausted(), false);
|
||||
|
||||
let mut parser = Parser::new("1px 2px");
|
||||
let parsed = longhands::parse_origin(&context, &mut parser);
|
||||
assert_eq!(parsed.is_ok(), true);
|
||||
assert_eq!(parser.is_exhausted(), true);
|
||||
|
||||
let mut parser = Parser::new("1px");
|
||||
let parsed = longhands::parse_origin(&context, &mut parser);
|
||||
assert_eq!(parsed.is_ok(), true);
|
||||
assert_eq!(parser.is_exhausted(), true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue