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

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGPatternElement.html

Issue 2447633002: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 4 years, 2 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/SVGAnimatedEnumeration-SVGPatternElement.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGPatternElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGPatternElement.html
index 9b66741d34bcbbf43528b4f2dd089b3c29537437..12b26aaad83cbf91766352293de7521d61778fd0 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGPatternElement.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGPatternElement.html
@@ -1,11 +1,71 @@
-<!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/SVGAnimatedEnumeration-SVGMaskElement.js"></script>
Srirama 2016/10/27 11:12:17 hmm, it is opposite here.
fs 2016/10/27 13:07:07 Ok, so bug not fixed then. But confusion averted!
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>Use of SVGAnimatedEnumeration within SVGPatternElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the use of SVGAnimatedEnumeration within SVGPatternElement.
+
+ var patternElement = document.createElementNS("http://www.w3.org/2000/svg", "pattern");
+ patternElement.setAttribute("patternUnits", "userSpaceOnUse");
+ patternElement.setAttribute("patternContentUnits", "userSpaceOnUse");
+
+ // patternUnits
+ // Check initial 'patternUnits' value.
+ assert_true(patternElement.patternUnits instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(patternElement.patternUnits.baseVal), "number");
+ assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // Switch to 'objectBoundingBox'.
+ patternElement.patternUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { patternElement.patternUnits.baseVal = 3; });
+ assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { patternElement.patternUnits.baseVal = -1; });
+ assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { patternElement.patternUnits.baseVal = 0; });
+ assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternUnits'), "objectBoundingBox");
+
+ // Switch to 'userSpaceOnUse'.
+ patternElement.patternUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
+ assert_equals(patternElement.patternUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+ assert_equals(patternElement.getAttribute('patternUnits'), "userSpaceOnUse");
+
+ // patternContentUnits
+ // Check initial 'patternContentUnits' value.
+ assert_true(patternElement.patternContentUnits instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(patternElement.patternContentUnits.baseVal), "number");
+ assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // Switch to 'objectBoundingBox'.
+ patternElement.patternContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBoundingBox");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { patternElement.patternContentUnits.baseVal = 3; });
+ assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { patternElement.patternContentUnits.baseVal = -1; });
+ assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBoundingBox");
+
+ assert_throws(new TypeError(), function() { patternElement.patternContentUnits.baseVal = 0; });
+ assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(patternElement.getAttribute('patternContentUnits'), "objectBoundingBox");
+
+ // Switch to 'userSpaceOnUse'.
+ patternElement.patternContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
+ assert_equals(patternElement.patternContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+ assert_equals(patternElement.getAttribute('patternContentUnits'), "userSpaceOnUse");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698