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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGMaskElement.html

Issue 2447633002: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html> 2 <title>Use of SVGAnimatedEnumeration within SVGMaskElement</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head> 5 <script>
6 <body> 6 test(function() {
7 <p id="description"></p> 7 // This test checks the use of SVGAnimatedEnumeration within SVGMaskElement.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGAnimatedEnumeration-SVGPatternElement.js"></script> 9 var maskElement = document.createElementNS("http://www.w3.org/2000/svg", "mask ");
Srirama 2016/10/27 11:12:17 It is referring SVGPatterElement here instead of S
fs 2016/10/27 13:07:07 Probably a copy'n'paste related mistake in the ini
10 </body> 10 maskElement.setAttribute("maskUnits", "userSpaceOnUse");
11 </html> 11 maskElement.setAttribute("maskContentUnits", "userSpaceOnUse");
12
13 // maskUnits
14 // Check initial 'maskUnits' value.
15 assert_true(maskElement.maskUnits instanceof SVGAnimatedEnumeration);
16 assert_equals(typeof(maskElement.maskUnits.baseVal), "number");
17 assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSP ACEONUSE);
18
19 // Switch to 'objectBoundingBox'.
20 maskElement.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
21 assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECT BOUNDINGBOX);
22 assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox");
23
24 // Try setting invalid values.
25 assert_throws(new TypeError(), function() { maskElement.maskUnits.baseVal = 3; });
26 assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECT BOUNDINGBOX);
27 assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox");
28
29 assert_throws(new TypeError(), function() { maskElement.maskUnits.baseVal = -1 ; });
30 assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECT BOUNDINGBOX);
31 assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox");
32
33 assert_throws(new TypeError(), function() { maskElement.maskUnits.baseVal = 0; });
34 assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECT BOUNDINGBOX);
35 assert_equals(maskElement.getAttribute('maskUnits'), "objectBoundingBox");
36
37 // Switch to 'userSpaceOnUse'.
38 maskElement.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE;
39 assert_equals(maskElement.maskUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSP ACEONUSE);
40 assert_equals(maskElement.getAttribute('maskUnits'), "userSpaceOnUse");
41
42 // maskContentUnits
43 // Check initial 'maskContentUnits' value.
44 assert_true(maskElement.maskContentUnits instanceof SVGAnimatedEnumeration);
45 assert_equals(typeof(maskElement.maskContentUnits.baseVal), "number");
46 assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE _USERSPACEONUSE);
47
48 // Switch to 'objectBoundingBox'.
49 maskElement.maskContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDI NGBOX;
50 assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE _OBJECTBOUNDINGBOX);
51 assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox ");
52
53 // Try setting invalid values.
54 assert_throws(new TypeError(), function() { maskElement.maskContentUnits.baseV al = 3; });
55 assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE _OBJECTBOUNDINGBOX);
56 assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox ");
57
58 assert_throws(new TypeError(), function() { maskElement.maskContentUnits.baseV al = -1; });
59 assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE _OBJECTBOUNDINGBOX);
60 assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox ");
61
62 assert_throws(new TypeError(), function() { maskElement.maskContentUnits.baseV al = 0; });
63 assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE _OBJECTBOUNDINGBOX);
64 assert_equals(maskElement.getAttribute('maskContentUnits'), "objectBoundingBox ");
65
66 // Switch to 'userSpaceOnUse'.
67 maskElement.maskContentUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONU SE;
68 assert_equals(maskElement.maskContentUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE _USERSPACEONUSE);
69 assert_equals(maskElement.getAttribute('maskContentUnits'), "userSpaceOnUse");
70 });
71 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698