Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds parsing test for linear-gradient #13886

Merged
merged 1 commit into from Oct 30, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -9,6 +9,36 @@ use style::stylesheets::Origin;
use style::values::specified::image::*;
use url::Url;

#[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)");

// Parsing from the left
assert_roundtrip_with_context!(Image::parse, "linear-gradient(to right, red, green)",
"linear-gradient(1.5707964rad, red, green)");

// Parsing with two values for <side-or-corner>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(to right top, red, green)");

// Parsing with <angle>
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 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 without <angle> and <side-or-corner>
assert_roundtrip_with_context!(Image::parse, "linear-gradient(red, green)",
"linear-gradient(3.1415927rad, red, green)");
}

#[test]
fn test_radial_gradient() {
// Parsing with all values
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.