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

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

Issue 2416163002: 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.html
index 75a08e0c9af9d80f03ac00bebd68e01f70b37ed4..237b68cfb569abcb2f8a26ebdfe73e55e54e2c79 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement.html
@@ -1,11 +1,91 @@
-<!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-SVGFEDisplacementMapElement.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>Use of SVGAnimatedEnumeration within SVGFEDisplacementMapElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the use of SVGAnimatedEnumeration within SVGFEDisplacementMapElement.
+
+ var feDisplacementMapElement = document.createElementNS("http://www.w3.org/2000/svg", "feDisplacementMap");
+ feDisplacementMapElement.setAttribute("xChannelSelector", "R");
+ feDisplacementMapElement.setAttribute("yChannelSelector", "R");
+
+ // xChannelSelector
+ // Check initial 'xChannelSelector' value.
+ assert_true(feDisplacementMapElement.xChannelSelector instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(feDisplacementMapElement.xChannelSelector.baseVal), "number");
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_R);
+
+ // Switch to 'G'.
+ feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_G;
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_G);
+ assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "G");
+
+ // Switch to 'B'.
+ feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_B;
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_B);
+ assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "B");
+
+ // Switch to 'A'.
+ feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_A;
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { feDisplacementMapElement.xChannelSelector.baseVal = 5; });
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A");
+
+ assert_throws(new TypeError(), function() { feDisplacementMapElement.xChannelSelector.baseVal = -1; });
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A");
+
+ assert_throws(new TypeError(), function() { feDisplacementMapElement.xChannelSelector.baseVal = 0; });
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "A");
+
+ // Switch to 'R'.
+ feDisplacementMapElement.xChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_R;
+ assert_equals(feDisplacementMapElement.xChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_R);
+ assert_equals(feDisplacementMapElement.getAttribute('xChannelSelector'), "R");
+
+ // yChannelSelector
+ // Check initial 'yChannelSelector' value.
+ assert_true(feDisplacementMapElement.yChannelSelector instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(feDisplacementMapElement.yChannelSelector.baseVal), "number");
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_R);
+
+ // Switch to 'G'.
+ feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_G;
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_G);
+ assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "G");
+
+ // Switch to 'B'.
+ feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_B;
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_B);
+ assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "B");
+
+ // Switch to 'A'.
+ feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_A;
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { feDisplacementMapElement.yChannelSelector.baseVal = 5; });
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A");
+
+ assert_throws(new TypeError(), function() { feDisplacementMapElement.yChannelSelector.baseVal = -1; });
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A");
+
+ assert_throws(new TypeError(), function() { feDisplacementMapElement.yChannelSelector.baseVal = 0; });
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_A);
+ assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "A");
+
+ // Switch to 'R'.
+ feDisplacementMapElement.yChannelSelector.baseVal = SVGFEDisplacementMapElement.SVG_CHANNEL_R;
+ assert_equals(feDisplacementMapElement.yChannelSelector.baseVal, SVGFEDisplacementMapElement.SVG_CHANNEL_R);
+ assert_equals(feDisplacementMapElement.getAttribute('yChannelSelector'), "R");
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEDisplacementMapElement-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698