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

Unified Diff: LayoutTests/svg/dom/script-tests/SVGLength.js

Issue 930053002: Apply TypeChecking=Unrestricted to SVG{Number,Length,Transform,Angle} (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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: LayoutTests/svg/dom/script-tests/SVGLength.js
diff --git a/LayoutTests/svg/dom/script-tests/SVGLength.js b/LayoutTests/svg/dom/script-tests/SVGLength.js
index 4eab45408acd69e570ed37f47d08636ed20e68ca..f979668593460938a9e204ed3ef0d50ef8f25adb 100644
--- a/LayoutTests/svg/dom/script-tests/SVGLength.js
+++ b/LayoutTests/svg/dom/script-tests/SVGLength.js
@@ -38,14 +38,17 @@ shouldThrow("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_UNKNOWN, 4)"
shouldThrow("length.newValueSpecifiedUnits(-1, 4)");
shouldThrow("length.newValueSpecifiedUnits(11, 4)");
// ECMA-262, 9.3, "ToNumber"
-shouldBeUndefined("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 'aString')");
-shouldBe("length.value", "NaN");
shouldBeUndefined("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0)");
-shouldBeUndefined("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, length)");
-shouldBe("length.value", "NaN");
-shouldBeUndefined("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0)");
-shouldBeUndefined("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, svgElement)");
-shouldBe("length.value", "NaN");
+shouldThrow("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 'aString')");
+shouldBe("length.value", "0");
+shouldThrow("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, length)");
+shouldBe("length.value", "0");
+shouldThrow("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, svgElement)");
+shouldBe("length.value", "0");
+shouldThrow("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, NaN)");
+shouldBe("length.value", "0");
+shouldThrow("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, Infinity)");
+shouldBe("length.value", "0");
shouldThrow("length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX)");
// Reset to original value above.
length.valueAsString = "2px";
@@ -80,4 +83,20 @@ shouldBe("length.value", "2");
shouldBe("length.valueInSpecifiedUnits", "2");
shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX");
+debug("");
+debug("Check setting invalid 'value' arguments");
+shouldThrow("length.value = NaN");
+shouldThrow("length.value = Infinity");
+shouldBe("length.value", "2");
+shouldBe("length.valueInSpecifiedUnits", "2");
+shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX");
+
+debug("");
+debug("Check setting invalid 'valueInSpecifiedUnits' arguments");
+shouldThrow("length.valueInSpecifiedUnits = NaN");
+shouldThrow("length.valueInSpecifiedUnits = Infinity");
+shouldBe("length.value", "2");
+shouldBe("length.valueInSpecifiedUnits", "2");
+shouldBe("length.unitType", "SVGLength.SVG_LENGTHTYPE_PX");
+
successfullyParsed = true;
« no previous file with comments | « LayoutTests/svg/dom/script-tests/SVGAnimatedNumber.js ('k') | LayoutTests/svg/dom/script-tests/SVGNumber.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698