Index: third_party/WebKit/LayoutTests/svg/dom/SVGPoint.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGPoint.html b/third_party/WebKit/LayoutTests/svg/dom/SVGPoint.html |
index da53ea073dd881f71f25a8c89380a98fef42417d..8cac81949b6a7ab148060023524e759f01282c00 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGPoint.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGPoint.html |
@@ -1,11 +1,51 @@ |
-<!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/SVGPoint.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<title>SVGPoint interface</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ // This test checks the SVGPoint API. |
+ |
+ var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); |
+ var point = svgElement.createSVGPoint(); |
+ |
+ // Check initial point values. |
+ assert_equals(point.x, 0); |
+ assert_equals(point.y, 0); |
+ |
+ // Check assigning points. |
+ point.x = 100; |
+ assert_equals(point.x, 100); |
+ point.y = 200; |
+ assert_equals(point.y, 200); |
+ |
+ // Check assigning invalid points. |
+ point.x = point; |
+ assert_equals(point.x, NaN); |
+ point.y = null; |
+ assert_equals(point.y, 0); |
+ |
+ // Reset to -50, 100 |
+ point.x = -50; |
+ point.y = 100; |
+ |
+ // Check 'matrixTransform' method - multiply with -1,0,0,2,10,10 matrix, should flip x coordinate, multiply y by two and translate each coordinate by 10. |
+ var ctm = svgElement.createSVGMatrix(); |
+ ctm.a = -1; |
+ ctm.d = 2; |
+ ctm.e = 10; |
+ ctm.f = 10; |
+ newPoint = point.matrixTransform(ctm); |
+ assert_true(newPoint instanceof SVGPoint); |
+ assert_equals(newPoint.x, 60); |
+ assert_equals(newPoint.y, 210); |
+ |
+ // Check invalid arguments for 'matrixTransform'. |
+ assert_throws(new TypeError(), function() { point.matrixTransform(); }); |
+ assert_throws(new TypeError(), function() { point.matrixTransform(-1); }); |
+ assert_throws(new TypeError(), function() { point.matrixTransform(5); }); |
+ assert_throws(new TypeError(), function() { point.matrixTransform('aString'); }); |
+ assert_throws(new TypeError(), function() { point.matrixTransform(point); }); |
+ assert_throws(new TypeError(), function() { point.matrixTransform(svgElement); }); |
+}); |
+</script> |