<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Scalable Search Box</title>
<script>
<![CDATA[
var testMatrix;
var expectedMatrix = {
a: 1,
b: 0,
c: 0,
d: 1,
e: 350,
f: 55.5
};
function runTest () {
if (window.testRunner)
testRunner.dumpAsText();
var rect = document.getElementById('rect');
try {
testMatrix = rect.getScreenCTM();
}
// end script here
catch (error) {
log('.getScreenCTM() seems to be unimplemented');
return;
}
// check equality of matrices
if (areMatricesEqual(testMatrix, expectedMatrix)) {
log('PASSED');
}
// explain error
else {
log('Expected matrix ' + printMatrix(expectedMatrix));
log('Got matrix ' + printMatrix(testMatrix));
}
}
function areMatricesEqual (m1, m2) {
return (
m1.a == m2.a &&
m1.b == m2.b &&
m1.c == m2.c &&
m1.d == m2.d &&
m1.e == m2.e &&
m1.f == m2.f
);
}
function printMatrix (m) {
return '[' + [m.a, m.b, m.c, m.d, m.e, m.f].join(', ') + ']';
}
function log(msg) {
var output = document.getElementById('console')
var text = document.createTextNode(msg);
var br = document.createElementNS('http://www.w3.org/1999/xhtml', 'br');
output.appendChild(text);
output.appendChild(br);
}
]]>
</script>
</head>
<body onload="runTest()">
<div style="height: 200px;">
<table width="100%" height="100%" padding="100" style="text-align:center">
<tr><td>
<svg id="svgRoot" xmlns="http://www.w3.org/2000/svg" width="100" height="100">
<rect id="rect" width="100%" height="100%" />
</svg>
</td></tr>
</table>
</div>
<div id="console" style="position: absolute; left: 30px; top: 330px; color: red" />
This tests the behaviour of <code>SVGLocatable::getScreenCTM()</code> in mixed content <br />
</body>
</html>