imported patch bug435293-csstransform-tests

This commit is contained in:
Clint Talbert 2009-01-16 12:52:24 -06:00
Родитель 0221450ec2
Коммит 3d3cb0e36b
24 изменённых файлов: 661 добавлений и 0 удалений

Просмотреть файл

@ -65,6 +65,9 @@ _TEST_FILES = \
test_bug450930.xhtml \
test_bug458898.html \
test_bug465448.xul \
test_bug435293-scale.html \
test_bug435293-skew.html \
test_bug435293-interaction.html \
$(NULL)
# test_bug396024.html is currently disabled because it interacts badly with
# the "You can't print-preview while the page is loading" dialog.

Просмотреть файл

@ -0,0 +1,49 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=435293
-->
<head>
<title>Test for Bug 435293</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style>
#test1 {
background: green;
height: 100px;
width: 100px;
-moz-transform: skew(30deg, 60deg) scale(2, 5) rotate(45deg) translate(2%, 50px);
-moz-transform-origin: 100% 50%;
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=435293">Mozilla Bug 435293</a>
<div id="content">
<div id="test1" onclick="testFinish();">
test
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
runtests();
function runtests() {
function doClick() {
sendMouseEvent({type: 'click'}, 'test1');
}
setTimeout(doClick, 300);
}
function testFinish(){
ok(1, "We can still interact with the item after it is transformed");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,104 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=435293
-->
<head>
<title>Test for Bug 435293</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style>
.test {
background: green;
height: 100px;
width: 100px;
}
#test1 {
-moz-transform: scalex(0.5);
}
#test2 {
-moz-transform: scaley(0.5);
}
#test3 {
-moz-transform: scale(0.5, 0.5);
}
#test4 {
-moz-transform: scale(0.5, 0.5, 0.5);
}
#test5 {
-moz-transform: scale(80%, none);
}
#test6 {
-moz-transform: scale(640000, 0.0000000000000000001);
}
#test7 {
-moz-transform: scale(2em, 4px);
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=435293">Mozilla Bug 435293</a>
<p id="display"></p>
<div id="content">
<div id="test1" class="test">
test
</div>
<p id="test2" class="test">
test
</p>
<div id="test3" class="test">
test
</div>
<div id="test4" class="test">
test
</div>
<div id="test5" class="test">
test
</div>
<div id="test6" class="test">
test
</div>
<div id="test7" class="test">
test
</div>
</div>
<pre id="test">
<script type="application/javascript">
runtests();
function runtests() {
var style = window.getComputedStyle(document.getElementById("test1"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(0.5, 0, 0, 1, 0px, 0px)",
"Scalex proper matrix is applied");
style = window.getComputedStyle(document.getElementById("test2"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 0, 0, 0.5, 0px, 0px)",
"Scaley proper matrix is applied");
style = window.getComputedStyle(document.getElementById("test3"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(0.5, 0, 0, 0.5, 0px, 0px)",
"Scale proper matrix is applied");
style = window.getComputedStyle(document.getElementById("test4"), "");
is(style.getPropertyValue("-moz-transform"), "none",
"Three dimensional scale should be ignored");
style = window.getComputedStyle(document.getElementById("test5"), "");
is(style.getPropertyValue("-moz-transform"), "none",
"Percent values in scale should be ignored");
style = window.getComputedStyle(document.getElementById("test6"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(640000, 0, 0, 1e-19, 0px, 0px)",
"Ensure wacky values are accepted");
style = window.getComputedStyle(document.getElementById("test7"), "");
is(style.getPropertyValue("-moz-transform"), "none",
"No unit values allowed in scale");
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,160 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=435293
-->
<head>
<title>Test for Bug 435293</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style>
.test {
background: green;
height: 100px;
width: 100px;
}
#test1 {
-moz-transform: skewx(30deg);
}
#test2 {
-moz-transform: skewy(60deg);
}
#test3 {
-moz-transform: skew(45deg, 45deg);
}
/* We will set test 4 and 5 from JS in order to use exact values.
For clarity, their style is as follows:
#test4 {
-moz-transform: skew(2(PI)rad, 45deg);
}
#test5 {
-moz-transform: skew(PI/4rad, 150grad);
}*/
#test6 {
-moz-transform: skew(80%, 78px);
}
#test7 {
-moz-transform: skew(2em, 40ex);
}
#test8 {
-moz-transform: skew(-45deg, -465deg);
}
#test9 {
-moz-transform: skew(30deg, 30deg, 30deg);
}
#test10 {
display:none;
-moz-transform: skew(50grad, 89.99999999999999deg);
}
/* For test 11, we style it in JS to obtain exact values. For clarity, the
rule that will be created is below.
#test11 {
-moz-transform: skew(300grad, (PI/2)rad);
}*/
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=435293">Mozilla Bug 435293</a>
<p id="display"></p>
<div id="content">
<div id="test1" class="test">
test
</div>
<p id="test2" class="test">
test
</p>
<div id="test3" class="test">
test
</div>
<div id="test4" class="test">
test
</div>
<div id="test5" class="test">
test
</div>
<div id="test6" class="test">
test
</div>
<div id="test7" class="test">
test
</div>
<div id="test8" class="test">
test
</div>
<div id="test9" class="test">
test
</div>
<div id="test10" class="test">
test
</div>
<div id="test11" class="test">
test
</div>
</div>
<pre id="test">
<script type="application/javascript">
runtests();
function runtests() {
// Set the style rules for test 4, 5, and 11 using Math.pi instead of
// approximations
var e = document.getElementById("test4");
e.setAttribute("style", "-moz-transform: skew(" + Math.PI * 2 + "rad, 45deg);");
e = document.getElementById("test5");
e.setAttribute("style", "-moz-transform: skew(" + Math.PI/4 + "rad, 150grad);");
e = document.getElementById("test11");
e.setAttribute("style", "-moz-transform: skew(300grad, " + Math.PI/2 + "rad");
var style = window.getComputedStyle(document.getElementById("test1"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 0, 0.57735, 1, 0px, 0px)",
"Test1: Skewx proper matrix is applied");
style = window.getComputedStyle(document.getElementById("test2"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 1.73205, 0, 1, 0px, 0px)",
"Test2: Skewy proper matrix is applied");
style = window.getComputedStyle(document.getElementById("test3"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 1, 1, 1, 0px, 0px)",
"Test3: Skew proper matrix is applied");
style = window.getComputedStyle(document.getElementById("test4"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 1, 0, 1, 0px, 0px)",
"Test4: Skew mixing deg and rad");
style = window.getComputedStyle(document.getElementById("test5"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, -1, 1, 1, 0px, 0px)",
"Test5: Skew mixing rad and grad");
style = window.getComputedStyle(document.getElementById("test6"), "");
is(style.getPropertyValue("-moz-transform"), "none",
"Test6: Skew with invalid units");
style = window.getComputedStyle(document.getElementById("test7"), "");
is(style.getPropertyValue("-moz-transform"), "none",
"Test7: Skew with more invalid units");
style = window.getComputedStyle(document.getElementById("test8"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 3.73206, -1, 1, 0px, 0px)",
"Test8: Skew with negative degrees");
style = window.getComputedStyle(document.getElementById("test9"), "");
is(style.getPropertyValue("-moz-transform"), "none",
"Test9: Skew in 3d should be ignored");
style = window.getComputedStyle(document.getElementById("test10"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, -10000, 1, 1, 0px, 0px)",
"Test10: Skew with nearly infinite numbers");
style = window.getComputedStyle(document.getElementById("test11"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, -10000, 10000, 1, 0px, 0px)",
"Test11: Skew with more infinite numbers");
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,21 @@
<html>
<head>
<style>
#div1 {
background: green;
height: 100px;
width: 100px;
}
span {
background: yellow;
}
</style>
</head>
<body>
<div id="div1">
<span style="position: relative; top: 150px; left: 20px">span 1</span>
</div>
<span>span 2</span>
</body>
</html>

Просмотреть файл

@ -0,0 +1,23 @@
<html>
<head>
<style>
#div1 {
background: green;
height: 100px;
width: 100px;
}
span {
background: yellow;
}
#div1 span {-moz-transform: translate(20px, 150px);
-moz-transform-origin: 0% 0%;
}
</style>
</head>
<body>
<div id="div1">
<span>span 1</span>
</div>
<span>span 2</span>
</body>
</html>

Просмотреть файл

@ -0,0 +1,15 @@
<html>
<head>
<style>
iframe {
overflow: hidden;
height: 200px;
width: 300px;
}
</style>
</head>
<body>
<iframe src="about:blank">
</iframe>
</body>
</html>

Просмотреть файл

@ -0,0 +1,15 @@
<html>
<head>
<style>
iframe {
overflow: hidden;
height: 200px;
width: 300px;
}
</style>
</head>
<body>
<iframe src="iframe-transform.html">
</iframe>
</body>
</html>

Просмотреть файл

@ -0,0 +1,16 @@
<html>
<head>
<style>
div {
height: 200px;
width: 200px;
background: green;
-moz-transform: translate(500px, 500px);
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,15 @@
<html>
<head>
<style>
div {
background: green;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,20 @@
<html>
<head>
<!-- We do not support the 3d matrix yet, so this should do nothing -->
<style>
div {
background: green;
width: 100px;
height: 100px;
-moz-transform: matrix3d(1, 0, 100, 1, 10,
1, 100, 1, 1, 10,
1, 100, 2, 3, 12,
12, 100, 3, 4, 5);
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -87,4 +87,18 @@ random == rotate-1e.html rotate-1-ref.html
== matrix-5a.html matrix-5-ref.html
== matrix-6a.html matrix-6-ref.html
== matrix-7a.html matrix-7-ref.html
# ensure matrix 3d does not break us - should do nothing
== matrix3d-1.html matrix3d-1-ref.html
# Test that complex transform can be reversed
== stresstest-1.html stresstest-1-ref.html
# Test scale transforms
== scalex-1.html scalex-1-ref.html
== scaley-1.html scaley-1-ref.html
== scale-1a.html scale-1-ref.html
== scale-1b.html scale-1-ref.html
== scale-percent-1.html scale-percent-1-ref.html
# Some simple checks that it obeys selector operations
== descendant-1.html descendant-1-ref.html
== propagate-inherit-boolean.html propagate-inherit-boolean-ref.html
# Ensure you can't move outside an iframe
== iframe-1.html iframe-1-ref.html

Просмотреть файл

@ -0,0 +1,16 @@
<html>
<head>
<style>
body { margin: 0px; }
#test {
background: green;
width: 50px;
height: 50px;
margin: 25px;
}
</style>
<body>
<div id="test">
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<html>
<head>
<style>
body { margin: 0px; }
#test {
background: green;
width: 100px;
height: 100px;
-moz-transform: scale(0.5, 0.5);
}
</style>
</head>
<body>
<div id="test">
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<html>
<head>
<style>
body { margin: 0px; }
#test {
background: green;
width: 100px;
height: 100px;
-moz-transform: scale(0.5);
}
</style>
</head>
<body>
<div id="test">
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,16 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
background: green;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,18 @@
<html>
<head>
<!-- Percent values are not allowed for scale, so this shouldn't do anything -->
<style>
body { margin: 0px; }
div {
background: green;
width: 100px;
height: 100px;
-moz-transform: scale(50%, 50%);
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
background: green;
width: 50px;
height: 100px;
margin-left: 25px;
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
background: green;
width: 100px;
height: 100px;
-moz-transform: scalex(0.5);
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
background: green;
width: 100px;
height: 50px;
margin-top: 25px;
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,17 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
background: green;
width: 100px;
height: 100px;
-moz-transform: scaley(0.5);
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,20 @@
<html>
<head>
<style>
div {
background: green;
width: 100px;
height: 100px;
}
span {
background: yellow;
width: 50px;
}
</style>
</head>
<body>
<div>
<span></span>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,7 @@
<html>
<body>
<iframe src="square.html" style="height: 200px; width: 300px" id="test">
test
</iframe>
</body>
</html>

Просмотреть файл

@ -0,0 +1,27 @@
<html class="reftest-wait">
<head>
<script type="application/javascript">
function runtest() {
var iframe = document.getElementById("test");
var style = iframe.getAttribute("style");
// We depend on the transform being the last rule so clip the ending ';'
style = style.substring(0, style.length-1);
// Here, we add transform functions to explicitly undo the effects of
// each already-applied transform. This should leave us with an
// effectively-untransformed iframe.
style = style + " scale(0.5, 0.25) translatex(-50px) rotate(-45deg) translate(-50px, -50px) skewx(135deg);"
iframe.setAttribute("style", style);
document.documentElement.className = "";
}
</script>
</head>
<body>
<iframe
src="square.html"
style="height: 200px; width: 300px; -moz-transform: skewx(45deg) translate(50px, 50px) rotate(45deg) translatex(50px) scale(2.0, 4.0);"
id="test"
onload="runtest();">
</iframe>
</body>
</html>