blob: 5b17d75921288e1c0a0e671d55f24fab674370af [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="resources/scripted-random.js"></script>
<script src="resources/viewspec-parser.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
// maps a viewspec attribute to its minimum argument count.
var attributes = {
viewBox: 6,
preserveAspectRatio: 1,
transform: 1,
zoomAndPan: 1,
viewTarget: 1
};
var tests = [
"svgView(viewBox(0,0,200,200)))",
"svgView(preserveAspectRatio(xMaxYMin slice))",
"svgView(preserveAspectRatio(xMaxYMin))",
"svgView(viewBox(1,2,3,4);preserveAspectRatio(xMaxYMin))",
"svgView(zoomAndPan(disable))",
"svgView(viewTarget(#myElementId))",
"svgView",
"svgView(",
"svgView()",
"svgView(" + String.fromCharCode(0),
"svgView(transform(scale(2));;)",
"svgView(transform(scale(2));x", // used to hang
"svgView(transform(scale(.5)))",
"svgView(;transform(scale(.5)))",
"svgView(;;transform(scale(.5)))",
"svgView(transform(scale(.5));transform(scale(2));transform(scale(2)))",
];
for (var attribute in attributes) {
// attribute names that are "off by one"
var extraChar = attribute.charAt(attribute.length - 1);
tests.push("svgView(" + attribute + extraChar + "(0, 0)");
tests.push("svgView(" + attribute.substring(0, attribute.length - 1) + "(0, 0)");
// Empty-ish attributes
tests.push("svgView(" + attribute);
tests.push("svgView(" + attribute + String.fromCharCode(0));
}
if (window.testRunner)
testRunner.waitUntilDone();
startViewspecTests(tests);
</script>
</html>