commit bb9e38836d00591173d43a206ea58e485bed8744
parent 8d25f4ff4068806cae43f85db47022b68e6aab5d
Author: Fredrik Söderquist <fs@opera.com>
Date: Fri, 3 Oct 2025 09:30:24 +0000
Bug 1991162 [wpt PR 55108] - Reland "Move/migrate SVGRect and SVGPoint tests to WPT", a=testonly
Automatic update from web-platform-tests
Reland "Move/migrate SVGRect and SVGPoint tests to WPT"
This is a reland of commit 799ef6f917fdff7bab826deb742949e73b3a9b61
Change from original CL: Keep matrixTransform() tests local.
Original change's description:
> Move/migrate SVGRect and SVGPoint tests to WPT
>
> Bug: 40779000
> Change-Id: If95877c56ddfd4bc1ec34c13e53a99281452ec30
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6983405
> Reviewed-by: Philip Rogers <pdr@chromium.org>
> Auto-Submit: Fredrik Söderquist <fs@opera.com>
> Commit-Queue: Philip Rogers <pdr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1520548}
Bug: 40779000
Change-Id: Iaef9d3f5440b64178940b45d795ee74dde933dad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6988309
Reviewed-by: Philip Rogers <pdr@chromium.org>
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1521369}
--
wpt-commits: 3d29e5a2a14777cdf35c53820baf14a04d3ecf72
wpt-pr: 55108
Diffstat:
2 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/testing/web-platform/tests/svg/types/scripted/SVGPoint.html b/testing/web-platform/tests/svg/types/scripted/SVGPoint.html
@@ -4,22 +4,35 @@
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
- let svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
- let point = svgElement.createSVGPoint();
+ const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ const point = svgElement.createSVGPoint();
// Check initial point values.
assert_equals(point.x, 0);
assert_equals(point.y, 0);
- point.y = 2;
-
- // Check setting valid arguments.
- assert_equals(point.x, 0);
- assert_equals(point.y, 2);
+ // Check assigning points.
+ point.x = 100;
+ assert_equals(point.x, 100);
+ point.y = 200;
+ assert_equals(point.y, 200);
+ point.y = null;
+ assert_equals(point.y, 0);
+ point.y = 200;
// Check setting invalid arguments.
+ assert_throws_js(TypeError, function() { point.x = point; });
+ assert_equals(point.x, 100);
assert_throws_js(TypeError, function() { point.x = NaN; });
+ assert_equals(point.x, 100);
assert_throws_js(TypeError, function() { point.x = Infinity; });
- assert_equals(point.x, 0);
-});
+ assert_equals(point.x, 100);
+
+ assert_throws_js(TypeError, function() { point.y = point; });
+ assert_equals(point.y, 200);
+ assert_throws_js(TypeError, function() { point.y = NaN; });
+ assert_equals(point.y, 200);
+ assert_throws_js(TypeError, function() { point.y = Infinity; });
+ assert_equals(point.y, 200);
+}, `${document.title}, 'x' and 'y' attributes`);
</script>
diff --git a/testing/web-platform/tests/svg/types/scripted/SVGRect.html b/testing/web-platform/tests/svg/types/scripted/SVGRect.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<title>SVGRect interface</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ setup(() => {
+ window.svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ });
+
+ test(t => {
+ const rect = svgElement.createSVGRect();
+ assert_equals(rect.x, 0, 'initial x');
+ assert_equals(rect.y, 0, 'initial y');
+ assert_equals(rect.width, 0, 'initial width');
+ assert_equals(rect.height, 0, 'initial height');
+ }, `${document.title}, initial values`);
+
+ test(t => {
+ const rect = svgElement.createSVGRect();
+ rect.x = 100;
+ rect.y = 200;
+ rect.width = 300;
+ rect.height = 400;
+ assert_equals(rect.x, 100);
+ assert_equals(rect.y, 200);
+ assert_equals(rect.width, 300);
+ assert_equals(rect.height, 400);
+
+ rect.y = null;
+ assert_equals(rect.y, 0);
+ }, `${document.title}, assignment, numeric values`);
+
+ test(t => {
+ const rect = svgElement.createSVGRect();
+ assert_throws_js(TypeError, () => { rect.x = rect; });
+ assert_throws_js(TypeError, () => { rect.y = 'aString'; });
+ assert_throws_js(TypeError, () => { rect.width = svgElement; });
+ assert_throws_js(TypeError, () => { rect.height = NaN; });
+ }, `${document.title}, assignment, invalid values`);
+</script>