blob: 69ef03c43dad158226e0998f4f34379e69ff0505 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("This test checks the SVGTransformList API");
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var transform = rectElement.transform.baseVal;
debug("");
debug("Check passing invalid arguments to 'createSVGTransformFromMatrix'");
shouldThrow("transform.createSVGTransformFromMatrix('aString')");
shouldThrow("transform.createSVGTransformFromMatrix(1)");
shouldThrow("transform.createSVGTransformFromMatrix(true)");
debug("Check passing valid arguments to 'createSVGTransformFromMatrix'");
shouldNotThrow("transform.createSVGTransformFromMatrix(null)");
shouldNotThrow("transform.createSVGTransformFromMatrix(svgElement.createSVGTransform())");
shouldNotThrow("transform.createSVGTransformFromMatrix(svgElement)");
shouldNotThrow("transform.createSVGTransformFromMatrix(undefined)");
shouldNotThrow("transform.createSVGTransformFromMatrix()");
var t = transform.createSVGTransformFromMatrix({a: 2, d: 3, e: 10, f: 20});
shouldBe("t.matrix.a", "2");
shouldBe("t.matrix.b", "0");
shouldBe("t.matrix.c", "0");
shouldBe("t.matrix.d", "3");
shouldBe("t.matrix.e", "10");
shouldBe("t.matrix.f", "20");
t = transform.createSVGTransformFromMatrix(svgElement.createSVGMatrix().scaleNonUniform(3, 4));
shouldBe("t.matrix.a", "3");
shouldBe("t.matrix.b", "0");
shouldBe("t.matrix.c", "0");
shouldBe("t.matrix.d", "4");
shouldBe("t.matrix.e", "0");
shouldBe("t.matrix.f", "0");
t = transform.createSVGTransformFromMatrix();
shouldBe("t.matrix.a", "1");
shouldBe("t.matrix.b", "0");
shouldBe("t.matrix.c", "0");
shouldBe("t.matrix.d", "1");
shouldBe("t.matrix.e", "0");
shouldBe("t.matrix.f", "0");
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>