-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync 'SVGNumber.idl' with WebIDL Specification
https://bugs.webkit.org/show_bug.cgi?id=267186 Reviewed by Tim Nguyen. This patch is to align WebKit with Web-Specification [1]: [1] https://svgwg.org/svg2-draft/types.html#InterfaceSVGNumber It removes 'unrestricted' from `value`. Additionally, the test is synced from below Blink upstream (main), which uses 'testharness'. * Source/WebCore/svg/SVGNumber.idl: * LayoutTests/svg/dom/SVGNumber.html: Updated from Blink / Chromium source * LayoutTests/svg/dom/SVGNumber-expected.txt: Rebaselined Canonical link: https://commits.webkit.org/272741@main
- Loading branch information
1 parent
7b2588d
commit 25c142f
Showing
3 changed files
with
41 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,3 @@ | ||
This test checks the SVGNumber API | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
|
||
Check initial number value | ||
PASS num.value is 0 | ||
|
||
Check assigning number | ||
PASS num.value = 100 is 100 | ||
PASS num.value = -100 is -100 | ||
PASS num.value = 12345678 is 12345678 | ||
PASS num.value = -num.value is -12345678 | ||
|
||
Check that numbers are static, caching value in a local variable and modifying it, should have no effect | ||
PASS numRef is 1000 | ||
PASS num.value is -12345678 | ||
|
||
Check assigning invalid number, number should be 0 afterwards | ||
PASS num.value = num is num | ||
PASS num.value = 'aString' is 'aString' | ||
PASS num.value = svgElement is svgElement | ||
PASS num.value is NaN | ||
PASS num.value = null is null | ||
|
||
Check that the number is now null | ||
PASS num.value is 0 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
PASS SVGNumber interface | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,44 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<!DOCTYPE html> | ||
<title>SVGNumber interface</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script> | ||
description("This test checks the SVGNumber API"); | ||
test(function() { | ||
// This test checks the SVGNumber API. | ||
|
||
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
var num = svgElement.createSVGNumber(); | ||
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
var num = svgElement.createSVGNumber(); | ||
|
||
debug(""); | ||
debug("Check initial number value"); | ||
shouldBe("num.value", "0"); | ||
// Check initial number value. | ||
assert_equals(num.value, 0); | ||
|
||
debug(""); | ||
debug("Check assigning number"); | ||
shouldBe("num.value = 100", "100"); | ||
shouldBe("num.value = -100", "-100"); | ||
shouldBe("num.value = 12345678", "12345678"); | ||
shouldBe("num.value = -num.value", "-12345678"); | ||
// Check assigning number. | ||
num.value = 100; | ||
assert_equals(num.value, 100); | ||
num.value = -100; | ||
assert_equals(num.value, -100); | ||
num.value = 12345678; | ||
assert_equals(num.value, 12345678); | ||
num.value = -num.value; | ||
assert_equals(num.value, -12345678); | ||
|
||
debug(""); | ||
debug("Check that numbers are static, caching value in a local variable and modifying it, should have no effect"); | ||
var numRef = num.value; | ||
numRef = 1000; | ||
shouldBe("numRef", "1000"); | ||
shouldBe("num.value", "-12345678"); | ||
// Check that numbers are static, caching value in a local variable and modifying it, should have no effect. | ||
var numRef = num.value; | ||
numRef = 1000; | ||
assert_equals(numRef, 1000); | ||
assert_equals(num.value, -12345678); | ||
|
||
debug(""); | ||
debug("Check assigning invalid number, number should be 0 afterwards"); | ||
shouldBe("num.value = num", "num"); | ||
shouldBe("num.value = 'aString'", "'aString'"); | ||
shouldBe("num.value = svgElement", "svgElement"); | ||
shouldBe("num.value", "NaN"); | ||
shouldBeNull("num.value = null"); | ||
|
||
debug(""); | ||
debug("Check that the number is now null"); | ||
shouldBe("num.value", "0"); | ||
|
||
successfullyParsed = true; | ||
// Check assigning invalid number, number should be 0 afterwards. | ||
num.value = 0; | ||
assert_equals(num.value, 0); | ||
assert_throws_js(TypeError, function() { num.value = num; }); | ||
assert_throws_js(TypeError, function() { num.value = 'aString'; }); | ||
assert_throws_js(TypeError, function() { num.value = svgElement; }); | ||
assert_throws_js(TypeError, function() { num.value = NaN; }); | ||
assert_throws_js(TypeError, function() { num.value = Infinity; }); | ||
assert_equals(num.value, 0); | ||
num.value = null; | ||
// Check that the number is now null. | ||
assert_equals(num.value, 0); | ||
}); | ||
</script> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters