Commit 9e38f656 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

CSS: WPT for basic-shape <position> parsing

Test that basic shapes support the <position> grammar
https://drafts.csswg.org/css-shapes/#typedef-basic-shape
https://drafts.csswg.org/css-values-4/#typedef-position

and not the additional forms allowed by the <bg-position> grammar
https://drafts.csswg.org/css-backgrounds-3/#propdef-background-position

Blink has deprecated <bg-position> support in basic shapes
(and other contexts other than background-position), so the expected
failures are while we wait for removal in M68.

BUG=804187

Change-Id: Ifcaa72f42f2b63730ec761bf4fff4d4557f82b75
Reviewed-on: https://chromium-review.googlesource.com/897071Reviewed-by: default avatarnainar <nainar@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533849}
parent 685b3cd4
This is a testharness.js-based test.
FAIL e.style['shape-outside'] = "circle(at center left 1px)" should not set the property value assert_equals: expected "" but got "circle(at 1px 50%)"
FAIL e.style['shape-outside'] = "circle(at center top 2px)" should not set the property value assert_equals: expected "" but got "circle(at 50% 2px)"
FAIL e.style['shape-outside'] = "circle(at right 3% center)" should not set the property value assert_equals: expected "" but got "circle(at 97% 50%)"
FAIL e.style['shape-outside'] = "circle(at left 4px top)" should not set the property value assert_equals: expected "" but got "circle(at 4px 0%)"
FAIL e.style['shape-outside'] = "circle(at right top 5px)" should not set the property value assert_equals: expected "" but got "circle(at 100% 5px)"
FAIL e.style['shape-outside'] = "circle(at bottom 6% center)" should not set the property value assert_equals: expected "" but got "circle(at 50% 94%)"
FAIL e.style['shape-outside'] = "circle(at bottom 7% left)" should not set the property value assert_equals: expected "" but got "circle(at 0% 93%)"
FAIL e.style['shape-outside'] = "circle(at bottom right 8%)" should not set the property value assert_equals: expected "" but got "circle(at 92% 100%)"
Harness: the test ran to completion.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Shapes Module Level 1: parsing shape-outside with invalid position values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#typedef-position">
<meta name="assert" content="shape-outside positions support only the '<position>' grammar.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
// The following were supported in an earlier version of the spec.
// https://github.com/w3c/csswg-drafts/issues/2140
// Deprecated in Blink with support to be removed in M68, around July 2018.
test_invalid_value("shape-outside", "circle(at center left 1px)");
test_invalid_value("shape-outside", "circle(at center top 2px)");
test_invalid_value("shape-outside", "circle(at right 3% center)");
test_invalid_value("shape-outside", "circle(at left 4px top)");
test_invalid_value("shape-outside", "circle(at right top 5px)");
test_invalid_value("shape-outside", "circle(at bottom 6% center)");
test_invalid_value("shape-outside", "circle(at bottom 7% left)");
test_invalid_value("shape-outside", "circle(at bottom right 8%)");
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Shapes Module Level 1: parsing shape-outside with valid position values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#typedef-position">
<meta name="assert" content="shape-outside positions support the full '<position>' grammar.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/parsing-testcommon.js"></script>
</head>
<body>
<script>
// First serialization is being returned by Firefox/Edge, second by Blink/WebKit.
test_valid_value("shape-outside", "circle(at 10%)", ["circle(at 10%)", "circle(at 10% 50%)"]);
test_valid_value("shape-outside", "circle(at 20% 30px)");
test_valid_value("shape-outside", "circle(at 30px center)", ["circle(at 30px center)", "circle(at 30px 50%)"]);
test_valid_value("shape-outside", "circle(at 40px top)", ["circle(at 40px top)", "circle(at 40px 0%)"]);
test_valid_value("shape-outside", "circle(at bottom 10% right 20%)", ["circle(at bottom 10% right 20%)", "circle(at 80% 90%)"]);
test_valid_value("shape-outside", "circle(at bottom right)", ["circle(at bottom right)", "circle(at 100% 100%)"]);
test_valid_value("shape-outside", "circle(at center)", ["circle(at center)", "circle(at 50% 50%)"]);
test_valid_value("shape-outside", "circle(at center 50px)", ["circle(at center 50px)", "circle(at 50% 50px)"]);
test_valid_value("shape-outside", "circle(at center bottom)", ["circle(at center bottom)", "circle(at 50% 100%)"]);
test_valid_value("shape-outside", "circle(at center center)", ["circle(at center center)", "circle(at 50% 50%)"]);
test_valid_value("shape-outside", "circle(at center left)", ["circle(at center left)", "circle(at 0% 50%)"]);
test_valid_value("shape-outside", "circle(at left)", ["circle(at left)", "circle(at 0% 50%)"]);
test_valid_value("shape-outside", "circle(at left bottom)", ["circle(at left bottom)", "circle(at 0% 100%)"]);
test_valid_value("shape-outside", "circle(at left center)", ["circle(at left center)", "circle(at 0% 50%)"]);
test_valid_value("shape-outside", "circle(at right 40%)", ["circle(at right 40%)", "circle(at 100% 40%)"]);
test_valid_value("shape-outside", "circle(at right 30% top 60px)", ["circle(at right 30% top 60px)", "circle(at 70% 60px)"]);
test_valid_value("shape-outside", "circle(at top)", ["circle(at top)", "circle(at 50% 0%)"]);
test_valid_value("shape-outside", "circle(at top center)", ["circle(at top center)", "circle(at 50% 0%)"]);
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment