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

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement.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-SVGFEColorMatrixElement.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement.html
index 2c69c6b702d936e89f0131a0b1055ba1fc97148f..ae64730c21a5f6e9ed37d9f82cc6c8b89602d0ea 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEColorMatrixElement.html
@@ -1,11 +1,50 @@
-<!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-SVGFEColorMatrixElement.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>Use of SVGAnimatedEnumeration within SVGFEColorMatrixElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the use of SVGAnimatedEnumeration within SVGFEColorMatrixElement.
+
+ var feColorMatrixElement = document.createElementNS("http://www.w3.org/2000/svg", "feColorMatrix");
+ feColorMatrixElement.setAttribute("type", "matrix");
+
+ // Check initial 'type' value.
+ assert_true(feColorMatrixElement.type instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(feColorMatrixElement.type.baseVal), "number");
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_MATRIX);
+
+ // Switch to 'saturate'.
+ feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_SATURATE;
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_SATURATE);
+ assert_equals(feColorMatrixElement.getAttribute('type'), "saturate");
+
+ // Switch to 'hueRotate'.
+ feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_HUEROTATE;
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_HUEROTATE);
+ assert_equals(feColorMatrixElement.getAttribute('type'), "hueRotate");
+
+ // Switch to 'luminanceToAlpha'.
+ feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA;
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
+ assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { feColorMatrixElement.type.baseVal = 5; });
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
+ assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha");
+
+ assert_throws(new TypeError(), function() { feColorMatrixElement.type.baseVal = -1; });
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
+ assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha");
+
+ assert_throws(new TypeError(), function() { feColorMatrixElement.type.baseVal = 0; });
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA);
+ assert_equals(feColorMatrixElement.getAttribute('type'), "luminanceToAlpha");
+
+ // Switch to 'matrix'.
+ feColorMatrixElement.type.baseVal = SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_MATRIX;
+ assert_equals(feColorMatrixElement.type.baseVal, SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_MATRIX);
+ assert_equals(feColorMatrixElement.getAttribute('type'), "matrix");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698