OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>SVGAnimatedInteger interface - utilizing the targetX property of SVGFECon
volveMatrix</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 SVGAnimatedInteger API - utilizing the targetX propert
y of SVGFEConvolveMatrix. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedInteger.js"></script> | 9 var feConvolveMatrix = document.createElementNS("http://www.w3.org/2000/svg",
"feConvolveMatrix"); |
10 </body> | 10 |
11 </html> | 11 // Check initial targetX value. |
| 12 assert_true(feConvolveMatrix.targetX instanceof SVGAnimatedInteger); |
| 13 assert_equals(typeof(feConvolveMatrix.targetX.baseVal), "number"); |
| 14 assert_equals(feConvolveMatrix.targetX.baseVal, 0); |
| 15 |
| 16 // Check that integers are static, caching value in a local variable and modif
ying it, should have no effect. |
| 17 var numRef = feConvolveMatrix.targetX.baseVal; |
| 18 numRef = 100; |
| 19 assert_equals(numRef, 100); |
| 20 assert_equals(feConvolveMatrix.targetX.baseVal, 0); |
| 21 |
| 22 // Check assigning various valid and invalid values. |
| 23 feConvolveMatrix.targetX.baseVal = -1; |
| 24 assert_equals(feConvolveMatrix.targetX.baseVal, -1); // Negative values are al
lowed from SVG DOM, but should lead to an error when rendering (disable the filt
er) |
| 25 feConvolveMatrix.targetX.baseVal = 300; |
| 26 assert_equals(feConvolveMatrix.targetX.baseVal, 300); |
| 27 // ECMA-262, 9.5, "ToInt32" |
| 28 feConvolveMatrix.targetX.baseVal = 'aString'; |
| 29 assert_equals(feConvolveMatrix.targetX.baseVal, 0); |
| 30 feConvolveMatrix.targetX.baseVal = feConvolveMatrix; |
| 31 assert_equals(feConvolveMatrix.targetX.baseVal, 0); |
| 32 feConvolveMatrix.targetX.baseVal = 300; |
| 33 assert_equals(feConvolveMatrix.targetX.baseVal, 300); |
| 34 }); |
| 35 </script> |
OLD | NEW |