blob: 16003c304812ffca0b7650005bd251b10961b4a0 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Compound 2D Transforms</title>
<style type="text/css" media="screen">
.container {
height: 100px;
width: 200px;
margin: 30px;
outline: 1px solid black;
}
.box {
height: 100%;
width: 100%;
background-color: green;
-webkit-transform: rotate(90deg);
}
#results {
margin-top: 100px;
}
</style>
<script src="resources/transform-test-utils.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var gTests = [
// zero functions
{ 'transform' : 'none', 'result' : 'none' },
{ 'transform' : '', 'result' : 'matrix(5.96046e-08, 1, -1, 5.96046e-08, 0, 0)' }, // revert back to box
// one function - see non-compound test for tougher examples
{ 'transform' : 'translate(50px, 20px)', 'result' : 'matrix(1, 0, 0, 1, 50, 20)' },
{ 'transform' : 'rotate(12deg)', 'result' : 'matrix(0.978148, 0.207912, -0.207912, 0.978148, 0, 0)' },
{ 'transform' : 'scale(1.7)', 'result' : 'matrix(1.7, 0, 0, 1.7, 0, 0)' },
{ 'transform' : 'skew(12deg)', 'result' : 'matrix(1, 0, 0.212557, 1, 0, 0)' },
{ 'transform' : 'matrix(0.978148, 0.207912, -0.207912, 0.978148, 50, 20)', 'result' : 'matrix(0.978148, 0.207912, -0.207912, 0.978148, 50, 20)' },
// two functions
{ 'transform' : 'translate(50px, 20px) rotate(12deg)', 'result' : 'matrix(0.978148, 0.207912, -0.207912, 0.978148, 50, 20)' },
{ 'transform' : 'rotate(12deg) translate(50px, 20px)', 'result' : 'matrix(0.978148, 0.207912, -0.207912, 0.978148, 44.7491, 29.9585)' },
// three functions
{ 'transform' : 'rotate(12deg) translate(50px, 20px) scale(1.4)', 'result' : 'matrix(1.36941, 0.291076, -0.291076, 1.36941, 44.7491, 29.9585)' },
{ 'transform' : 'scale(1.4) rotate(12deg) translate(50px, 20px) ', 'result' : 'matrix(1.36941, 0.291076, -0.291076, 1.36941, 62.6488, 41.942)' },
{ 'transform' : 'scale(1.4) translate(50px, 20px) rotate(12deg)', 'result' : 'matrix(1.36941, 0.291076, -0.291076, 1.36941, 70, 28)' },
{ 'transform' : 'translate(50px, 20px) rotate(12deg) translateY(50px) scale(1.4)', 'result' : 'matrix(1.36941, 0.291076, -0.291076, 1.36941, 39.6044, 68.9074)' },
// lots of functions
{ 'transform' : 'rotate(12deg) translate(50px, 20px) scale(1.4) translate(-80px, 40px) skew(34deg) translate(10px, 10px) scale(0.7) skewY(-25deg) rotate(21deg) translateX(50px) scale(1.4, 1.8)',
'result' : 'matrix(1.20517, 0.148207, 0.258987, 2.04004, -13.3847, 85.31)' },
// invalid compound functions
{ 'transform' : ',rotate(12deg) translate(50px, 20px)', 'result' : 'none' }, // has comma
{ 'transform' : 'rotate(12deg), translate(50px, 20px)', 'result' : 'none' }, // has comma
{ 'transform' : 'rotate(12deg) + translate(50px, 20px)', 'result' : 'none' }, // has plus
{ 'transform' : 'rotate(12deg) translate(50, 20)', 'result' : 'none' }, // missing units
{ 'transform' : '(rotate(12deg) translate(50px, 20px))', 'result' : 'none' }, // bad syntax
{ 'transform' : 'rotate(12deg) translate(50px, 20px) eggs(10)', 'result' : 'none' }, // invalid function
{ 'transform' : 'rotate(12deg) matrix(0.978148, 0.207912, -0.207912, 0.978148, 50, 20, 666)', 'result' : 'none' }, // too many arguments
];
function runTests()
{
testTransforms();
if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
</head>
<body onload="runTests()">
<div class="container">
<div id="test-box" class="box"></div>
</div>
<div id="results">
</div>
</body>
</html>