Skip to content

Commit

Permalink
Resync 'svg/types/scripted/' from WPT upstream
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=263281

Reviewed by Tim Nguyen.

This PR is to upstream all tests from 'svg/types/scripted/' directory based on WPT ToT hash:

Upstream hash: bbb13dc253827791419344169e822c1af8c2cd82

* LayoutTests/imported/w3c/web-platform-tests/__init__.py:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/event-handler-all-document-element-events.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/event-handler-all-document-element-events-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedEnumeration-SVGFECompositeElement.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted//SVGAnimatedEnumeration-SVGFECompositeElement-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedEnumeration-SVGMarkerElement.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted//SVGAnimatedEnumeration-SVGMarkerElement-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedRect.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGAnimatedRect-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGElement.className-01.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGElement.className-01-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-02.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-02.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-03-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-03.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-04.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-04-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-05.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-05-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInFill-01.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInFill-01-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGeometryElement.isPointInStroke-01.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement-clone-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement-clone.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement.getBBox-03-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement.getBBox-03.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGGraphicsElement.svg:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-cap-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-cap.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-ch-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-ch.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-ic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-ic.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-lh-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-lh.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-px-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-px-with-context-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-px-with-context.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-px.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-rem-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-rem.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/svglength-value-access-when-in-detached-document-crash.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-viewport-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGLength-viewport.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGPoint-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/SVGPoint.html:
* LayoutTests/imported/w3c/web-platform-tests/svg/types/scripted/w3c-import.log

Canonical link: https://commits.webkit.org/269468@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Oct 18, 2023
1 parent 2ad2ad3 commit 8a42f71
Show file tree
Hide file tree
Showing 47 changed files with 851 additions and 130 deletions.
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

0 comments on commit 8a42f71

Please sign in to comment.