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

Resync 'svg/types/scripted/' from WPT upstream #19188

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions LayoutTests/imported/w3c/web-platform-tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file is required for Python to search this directory for modules.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

PASS Use of SVGAnimatedEnumeration within SVGFECompositeElement
FAIL Use of SVGAnimatedEnumeration within SVGFECompositeElement Type error

Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@
assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_XOR);
assert_equals(feCompositeElement.getAttribute('operator'), "xor");

// Switch to 'lighter'.
feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_LIGHTER;
assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_LIGHTER);
assert_equals(feCompositeElement.getAttribute('operator'), "lighter");

// Switch to 'arithmetic'.
feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC;
assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic");

// Try setting invalid values.
assert_throws_js(TypeError, function() { feCompositeElement.operator.baseVal = 7; });
assert_throws_js(TypeError, function() { feCompositeElement.operator.baseVal = 8; });
assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic");

Expand All @@ -56,10 +61,5 @@
feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OVER;
assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OVER);
assert_equals(feCompositeElement.getAttribute('operator'), "over");

// Switch to 'lighter'.
assert_equals(SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_LIGHTER, undefined);
feCompositeElement.setAttribute("operator", "lighter");
assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_UNKNOWN);
});
</script>
</script>
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@

PASS Use of SVGAnimatedEnumeration within SVGMarkerElement
PASS Test SVGAnimatedEnumeration
PASS Test SVGOrient
PASS Test grad units
FAIL Test turn units assert_equals: expected 360 but got 0
FAIL Test auto-start-reverse Type error

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
// This test checks the use of SVGAnimatedEnumeration within SVGMarkerElement.

var markerElement = document.createElementNS("http://www.w3.org/2000/svg", "marker");
function createMarker() {
let markerElement = document.createElementNS("http://www.w3.org/2000/svg", "marker");
markerElement.setAttribute("markerUnits", "userSpaceOnUse");
markerElement.setAttribute("orient", "auto");
return markerElement;
}

var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
function createSVGAngle() {
let svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
return svgElement.createSVGAngle();
}

test(function() {
// This test checks the use of SVGAnimatedEnumeration within SVGMarkerElement.

let markerElement = createMarker();

// markerUnits
// Check initial 'markerUnits' value.
Expand Down Expand Up @@ -40,6 +48,10 @@
markerElement.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE;
assert_equals(markerElement.markerUnits.baseVal, SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE);
assert_equals(markerElement.getAttribute('markerUnits'), "userSpaceOnUse");
}, "Test SVGAnimatedEnumeration");

test(function() {
let markerElement = createMarker();

// orientType
// Check initial 'orient' value.
Expand All @@ -50,7 +62,7 @@
assert_equals(markerElement.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO);

// Switch to 'Pi/2 rad' value - via setOrientToAngle().
anglePiHalfRad = svgElement.createSVGAngle();
let anglePiHalfRad = createSVGAngle();
anglePiHalfRad.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD, (Math.PI / 2).toFixed(2));
markerElement.setOrientToAngle(anglePiHalfRad);
assert_equals(markerElement.orientAngle.baseVal.value.toFixed(1), "90.0");
Expand All @@ -66,7 +78,7 @@
assert_equals(markerElement.getAttribute('orient'), "auto");

// Switch to '20deg' value - via setOrientToAngle().
angle20deg = svgElement.createSVGAngle();
let angle20deg = createSVGAngle();
angle20deg.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 20);
markerElement.setOrientToAngle(angle20deg);
assert_equals(markerElement.orientAngle.baseVal.value, 20);
Expand All @@ -91,7 +103,7 @@
markerElement.setAttribute('orient', '10deg');

// Try setting invalid values.
assert_throws_js(TypeError, function() { markerElement.orientType.baseVal = 3; });
assert_throws_js(TypeError, function() { markerElement.orientType.baseVal = 4; });
assert_equals(markerElement.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE);
assert_equals(markerElement.getAttribute('orient'), "10deg");

Expand All @@ -109,5 +121,38 @@
assert_equals(markerElement.orientAngle.baseVal.unitType, SVGAngle.SVG_ANGLETYPE_UNSPECIFIED);
assert_equals(markerElement.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO);
assert_equals(markerElement.getAttribute('orient'), "auto");
});
</script>
}, "Test SVGOrient");

test(function() {
let markerElement = createMarker();

markerElement.setAttribute('orient', '400grad');
assert_equals(markerElement.orientAngle.baseVal.value, 360);
assert_equals(markerElement.orientAngle.baseVal.unitType, SVGAngle.SVG_ANGLETYPE_GRAD);
}, "Test grad units");

test(function() {
let markerElement = createMarker();

markerElement.setAttribute('orient', '1turn');
assert_equals(markerElement.orientAngle.baseVal.value, 360);
assert_equals(markerElement.orientAngle.baseVal.unitType, SVGAngle.SVG_ANGLETYPE_UNKNOWN);

let angle = createSVGAngle();
angle = markerElement.orientAngle.baseVal;
angle.value = 720;
markerElement.setOrientToAngle(angle);
assert_equals(markerElement.getAttribute('orient'), "2turn");
}, "Test turn units");

test(function() {
let markerElement = createMarker();

// Switch to 'auto-start-reverse' value - by modifying orientType.
markerElement.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO_START_REVERSE;
assert_equals(markerElement.orientAngle.baseVal.value, 0);
assert_equals(markerElement.orientAngle.baseVal.unitType, SVGAngle.SVG_ANGLETYPE_UNSPECIFIED);
assert_equals(markerElement.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO_START_REVERSE);
assert_equals(markerElement.getAttribute('orient'), "auto-start-reverse");
}, "Test auto-start-reverse");
</script>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

FAIL SVGAnimatedRect interface - utilizing the viewBox property of SVGSVGElement assert_true: expected true got false
PASS SVGAnimatedRect interface - utilizing the viewBox property of SVGSVGElement

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

// Check initial viewBox value.
assert_true(svgElement.viewBox instanceof SVGAnimatedRect);
assert_true(svgElement.viewBox.baseVal instanceof DOMRect);
assert_true(svgElement.viewBox.baseVal instanceof SVGRect);
assert_equals(svgElement.viewBox.baseVal.x, 0);
assert_true(svgElement.viewBox.animVal instanceof DOMRectReadOnly);
assert_true(svgElement.viewBox.animVal instanceof SVGRect);

// Check that rects are dynamic, caching value in a local variable and modifying it, should take effect.
var numRef = svgElement.viewBox.baseVal;
Expand All @@ -29,6 +29,6 @@
assert_equals(svgElement.viewBox.baseVal.x, 100);

// Check that the viewBox baseVal type has not been changed.
assert_true(svgElement.viewBox.baseVal instanceof DOMRect);
assert_true(svgElement.viewBox.baseVal instanceof SVGRect);
});
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

PASS SVGElement.prototype.className: Reflects to .classList

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

FAIL When SVGGeometryElement.getPointAtLength is called with an element that is not in the document, either succeed or throw exception with SVGPathElement assert_throws_dom: function "function() { pathElement.getPointAtLength(700) }" did not throw
PASS When SVGGeometryElement.getPointAtLength is called with an element that is not in the document, either succeed or throw exception with SVGRectElement
PASS When SVGGeometryElement.getPointAtLength is called with an element that is not in the document, either succeed or throw exception with SVGCircleElement

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

PASS SVGGeometryElement.getPointAtLength: 'display' and a valid path, path with display: default
PASS SVGGeometryElement.getPointAtLength: 'display' and a valid path, path with display: none
FAIL SVGGeometryElement.getPointAtLength: 'display' and a valid path, path with display: none and inline style assert_approx_equals: expected 50 +/- 0.00001 but got 0
PASS SVGGeometryElement.getPointAtLength: 'display' and a valid path, rect with display: default
FAIL SVGGeometryElement.getPointAtLength: 'display' and a valid path, rect with display: none The object is in an invalid state.
PASS SVGGeometryElement.getPointAtLength: 'display' and a valid path, circle with display: default
FAIL SVGGeometryElement.getPointAtLength: 'display' and a valid path, circle with display: none The object is in an invalid state.
PASS SVGGeometryElement.getPointAtLength: 'display' and a valid path, polygon with display: default
FAIL SVGGeometryElement.getPointAtLength: 'display' and a valid path, polygon with display: none The object is in an invalid state.
PASS SVGGeometryElement.getPointAtLength: 'display' and a valid path, polyline with display: default
FAIL SVGGeometryElement.getPointAtLength: 'display' and a valid path, polyline with display: none The object is in an invalid state.
PASS SVGGeometryElement.getPointAtLength: 'display' and a valid path, ellipse with display: default
FAIL SVGGeometryElement.getPointAtLength: 'display' and a valid path, ellipse with display: none The object is in an invalid state.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

FAIL SVGGeometryElement.getPointAtLength: 'display' and empty path, path with display: default and an empty path assert_throws_dom: function "function() { element.getPointAtLength(300); }" did not throw
FAIL SVGGeometryElement.getPointAtLength: 'display' and empty path, path with display: none and an empty path assert_throws_dom: function "function() { element.getPointAtLength(300); }" did not throw
FAIL SVGGeometryElement.getPointAtLength: 'display' and empty path, rect with display: default and an empty path assert_throws_dom: function "function() { element.getPointAtLength(300); }" did not throw
PASS SVGGeometryElement.getPointAtLength: 'display' and empty path, rect with display: none and an empty path
FAIL SVGGeometryElement.getPointAtLength: 'display' and empty path, circle with display: default and an empty path assert_throws_dom: function "function() { element.getPointAtLength(300); }" did not throw
PASS SVGGeometryElement.getPointAtLength: 'display' and empty path, circle with display: none and an empty path
FAIL SVGGeometryElement.getPointAtLength: 'display' and empty path, polygon with display: default and an empty path assert_throws_dom: function "function() { element.getPointAtLength(300); }" did not throw
PASS SVGGeometryElement.getPointAtLength: 'display' and empty path, polygon with display: none and an empty path
FAIL SVGGeometryElement.getPointAtLength: 'display' and empty path, polyline with display: default and an empty path assert_throws_dom: function "function() { element.getPointAtLength(300); }" did not throw
PASS SVGGeometryElement.getPointAtLength: 'display' and empty path, polyline with display: none and an empty path
FAIL SVGGeometryElement.getPointAtLength: 'display' and empty path, ellipse with display: default and an empty path assert_throws_dom: function "function() { element.getPointAtLength(300); }" did not throw
PASS SVGGeometryElement.getPointAtLength: 'display' and empty path, ellipse with display: none and an empty path