Maintain Corner type, add None type to AngleOrCorner

This commit is contained in:
Nick Price 2016-12-13 20:39:05 -05:00
parent 0530e648af
commit 5d56946bc2
6 changed files with 113 additions and 49 deletions

View file

@ -12,12 +12,10 @@ use style_traits::ToCss;
#[test]
fn test_linear_gradient() {
// Parsing from the right
assert_roundtrip_with_context!(Image::parse, "linear-gradient(to left, red, green)",
"linear-gradient(4.712389rad, red, green)");
assert_roundtrip_with_context!(Image::parse, "linear-gradient(to left, red, green)");
// Parsing from the left
assert_roundtrip_with_context!(Image::parse, "linear-gradient(to right, red, green)",
"linear-gradient(1.5707964rad, red, green)");
assert_roundtrip_with_context!(Image::parse, "linear-gradient(to right, red, green)");
// Parsing with two values for <side-or-corner>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(to right top, red, green)");
@ -26,17 +24,14 @@ fn test_linear_gradient() {
assert_roundtrip_with_context!(Image::parse, "linear-gradient(45deg, red, green)",
"linear-gradient(0.7853982rad, red, green)");
// Parsing with more than two entries in <color-stop-list>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, yellow, green)",
"linear-gradient(3.1415927rad, red, yellow, green)");
// Parsing with more than two entries in <color-stop-list>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, yellow, green)");
// Parsing with percentage in the <color-stop-list>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, green, yellow 50%)",
"linear-gradient(3.1415927rad, red, green, yellow 50%)");
// Parsing with percentage in the <color-stop-list>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, green, yellow 50%)");
// Parsing without <angle> and <side-or-corner>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, green)",
"linear-gradient(3.1415927rad, red, green)");
assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, green)");
}
#[test]