Fix parsing of ClipRect

This commit is contained in:
Nazım Can Altınova 2017-02-24 23:31:48 +03:00
parent 050d9d9097
commit d7c227f614
No known key found for this signature in database
GPG key ID: AF9BCD7CE6449954
6 changed files with 94 additions and 27 deletions

View file

@ -0,0 +1,35 @@
/* 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 servo_url::ServoUrl;
use style::parser::ParserContext;
use style::stylesheets::Origin;
use style_traits::ToCss;
#[test]
fn test_clip() {
use style::properties::longhands::clip;
assert_roundtrip_with_context!(clip::parse, "auto");
assert_roundtrip_with_context!(clip::parse, "rect(1px, 2px, 3px, 4px)");
assert_roundtrip_with_context!(clip::parse, "rect(1px, auto, auto, 4px)");
assert_roundtrip_with_context!(clip::parse, "rect(auto, auto, auto, auto)");
// Non-standard syntax
assert_roundtrip_with_context!(clip::parse,
"rect(1px 2px 3px 4px)",
"rect(1px, 2px, 3px, 4px)");
assert_roundtrip_with_context!(clip::parse,
"rect(auto 2px 3px auto)",
"rect(auto, 2px, 3px, auto)");
assert_roundtrip_with_context!(clip::parse,
"rect(1px auto auto 4px)",
"rect(1px, auto, auto, 4px)");
assert_roundtrip_with_context!(clip::parse,
"rect(auto auto auto auto)",
"rect(auto, auto, auto, auto)");
}