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

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

Issue 2389803004: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments 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-SVGFECompositeElement.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFECompositeElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFECompositeElement.html
index a24512cdf19123cf47a8d5e0645d00799265e67f..723269c5cc838a2a515cf1e2fa2e064140bb11e4 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFECompositeElement.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFECompositeElement.html
@@ -1,11 +1,65 @@
-<!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-SVGFECompositeElement.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>Use of SVGAnimatedEnumeration within SVGFECompositeElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the use of SVGAnimatedEnumeration within SVGFECompositeElement.
+
+ var feCompositeElement = document.createElementNS("http://www.w3.org/2000/svg", "feComposite");
+ feCompositeElement.setAttribute("operator", "over");
+
+ // Check initial 'operator' value.
+ assert_true(feCompositeElement.operator instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(feCompositeElement.operator.baseVal), "number");
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OVER);
+
+ // Switch to 'in'.
+ feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_IN;
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_IN);
+ assert_equals(feCompositeElement.getAttribute('operator'), "in");
+
+ // Switch to 'out'.
+ feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OUT;
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OUT);
+ assert_equals(feCompositeElement.getAttribute('operator'), "out");
+
+ // Switch to 'atop'.
+ feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ATOP;
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ATOP);
+ assert_equals(feCompositeElement.getAttribute('operator'), "atop");
+
+ // Switch to 'xor'
+ feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_XOR;
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_XOR);
+ assert_equals(feCompositeElement.getAttribute('operator'), "xor");
+
+ // Switch to 'arithmetic'.
+ feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC;
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
+ assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { feCompositeElement.operator.baseVal = 7; });
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
+ assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic");
+
+ assert_throws(new TypeError(), function() { feCompositeElement.operator.baseVal = -1; });
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
+ assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic");
+
+ assert_throws(new TypeError(), function() { feCompositeElement.operator.baseVal = 0; });
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_ARITHMETIC);
+ assert_equals(feCompositeElement.getAttribute('operator'), "arithmetic");
+
+ // Switch to 'over'.
+ feCompositeElement.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OVER;
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OVER);
+ assert_equals(feCompositeElement.getAttribute('operator'), "over");
+
+ // Switch to 'lighter'.
+ assert_equals(SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_LIGHTER, undefined);
+ feCompositeElement.setAttribute("operator", "lighter");
+ assert_equals(feCompositeElement.operator.baseVal, SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_UNKNOWN);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698