Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedNumber.html

Issue 2713833002: Convert LayoutTests/svg/dom/SVGAnimated*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedNumber.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedNumber.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedNumber.html
index 346ecd6248ae2f38bf526f65c969624d93874585..10330a33ed9c77580d02ac070e87b4467f78951d 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedNumber.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedNumber.html
@@ -1,11 +1,42 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script src="script-tests/SVGAnimatedNumber.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>SVGAnimatedNumber interface - utilizing the surfaceScale property of SVGFESpecularLightingElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the SVGAnimatedNumber API - utilizing the surfaceScale property of SVGFESpecularLightingElement.
+
+ var feSpecularLightingElement = document.createElementNS("http://www.w3.org/2000/svg", "feSpecularLighting");
+
+ // Check initial surfaceScale value.
+ assert_true(feSpecularLightingElement.surfaceScale instanceof SVGAnimatedNumber);
+ assert_equals(typeof(feSpecularLightingElement.surfaceScale.baseVal), "number");
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 1);
+
+ // Check that integers are static, caching value in a local variable and modifying it, should have no effect.
+ var numRef = feSpecularLightingElement.surfaceScale.baseVal;
+ numRef = 100;
+ assert_equals(numRef, 100);
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 1);
+
+ // Check assigning various valid and invalid values.
+ feSpecularLightingElement.surfaceScale.baseVal = -1; // Negative values are allowed from SVG DOM, but should lead to an error when rendering (disable the filter)
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, -1);
+ feSpecularLightingElement.surfaceScale.baseVal = 300;
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 300);
+
+ // ECMA-262, 9.3, "ToNumber"
+ assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = 'aString'; });
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 300);
+ feSpecularLightingElement.surfaceScale.baseVal = 0;
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0);
+ assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = NaN; });
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0);
+ assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = Infinity; });
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0);
+ assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement; });
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0);
+ feSpecularLightingElement.surfaceScale.baseVal = 300;
+ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 300);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698