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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGPoint.html

Issue 2741153003: Convert LayoutTests/svg/dom/*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html> 2 <title>SVGPoint interface</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 SVGPoint API.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGPoint.js"></script> 9 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg") ;
10 </body> 10 var point = svgElement.createSVGPoint();
11 </html> 11
12 // Check initial point values.
13 assert_equals(point.x, 0);
14 assert_equals(point.y, 0);
15
16 // Check assigning points.
17 point.x = 100;
18 assert_equals(point.x, 100);
19 point.y = 200;
20 assert_equals(point.y, 200);
21
22 // Check assigning invalid points.
23 point.x = point;
24 assert_equals(point.x, NaN);
25 point.y = null;
26 assert_equals(point.y, 0);
27
28 // Reset to -50, 100
29 point.x = -50;
30 point.y = 100;
31
32 // Check 'matrixTransform' method - multiply with -1,0,0,2,10,10 matrix, shoul d flip x coordinate, multiply y by two and translate each coordinate by 10.
33 var ctm = svgElement.createSVGMatrix();
34 ctm.a = -1;
35 ctm.d = 2;
36 ctm.e = 10;
37 ctm.f = 10;
38 newPoint = point.matrixTransform(ctm);
39 assert_true(newPoint instanceof SVGPoint);
40 assert_equals(newPoint.x, 60);
41 assert_equals(newPoint.y, 210);
42
43 // Check invalid arguments for 'matrixTransform'.
44 assert_throws(new TypeError(), function() { point.matrixTransform(); });
45 assert_throws(new TypeError(), function() { point.matrixTransform(-1); });
46 assert_throws(new TypeError(), function() { point.matrixTransform(5); });
47 assert_throws(new TypeError(), function() { point.matrixTransform('aString'); });
48 assert_throws(new TypeError(), function() { point.matrixTransform(point); });
49 assert_throws(new TypeError(), function() { point.matrixTransform(svgElement); });
50 });
51 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698