Bug 474016 r=dholbert, adding logging to css transform test to see why it fails

This commit is contained in:
Clint Talbert 2009-02-26 16:09:12 -08:00
Родитель bf11a5e21b
Коммит 475b19b7e9
2 изменённых файлов: 43 добавлений и 10 удалений

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

@ -67,15 +67,14 @@ _TEST_FILES = \
test_bug465448.xul \
test_bug469170.html \
test_bug471126.html \
test_bug435293-scale.html \
test_bug435293-interaction.html \
test_bug435293-skew.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.
# (See bug 407080)
# test_bug435293-scale.html, test_bug435293-skew.html,
# and test_bug435293-interaction.html are currently disabled due to an
# excessive number of leaks that they expose see bug 474016 for details.
# Tests for bugs 441782 and 467672 don't pass reliably on Windows, because of bug 469208
ifeq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
_TEST_FILES += \

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

@ -110,13 +110,32 @@ function runtests() {
e = document.getElementById("test11");
e.setAttribute("style", "-moz-transform: skew(300grad, " + Math.PI/2 + "rad");
// For test 1 we need to handle the contingency that different systems may
// round differently. We will parse out the values and compare them
// individually. The matrix should be: matrix(1, 0, 0.57735, 1, 0px, 0px)
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");
var tformStyle = style.getPropertyValue("-moz-transform");
var tformValues = tformStyle.substring(tformStyle.indexOf('(') + 1,
tformStyle.indexOf(')')).split(',');
is((+tformValues[0]), 1, "Test1: skewx: param 0 is 1");
is((+tformValues[1]), 0, "Test1: skewx: param 1 is 0");
ok(verifyRounded(tformValues[2], 0.57735), "Test1: skewx: Rounded param 2 is in bounds should be 0.57735, really is: " + tformValues[2]);
is((+tformValues[3]), 1, "Test1: skewx: param 3 is 1");
is(tformValues[4].trim(), "0px", "Test1: skewx: param 4 is 0px");
is(tformValues[5].trim(), "0px", "Test1: skewx: param 5 is 0px");
// Again, handle rounding for test 2, proper matrix should be:
// matrix(1, 1.73205, 0, 1, 0px, 0px)
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");
tformStyle = style.getPropertyValue("-moz-transform");
tformValues = tformStyle.substring(tformStyle.indexOf('(') + 1,
tformStyle.indexOf(')')).split(',');
is((+tformValues[0]), 1, "Test2: skewy: param 0 is 1");
ok(verifyRounded(tformValues[1], 1.73205), "Test2: skewy: Rounded param 1 is in bounds should be 1.73205 really is: " + tformValues[1]);
is((+tformValues[2]), 0, "Test2: skewy: param 2 is 0");
is((+tformValues[3]), 1, "Test2: skewy: param 3 is 1");
is(tformValues[4].trim(), "0px", "Test2: skewy: param 4 is 0px");
is(tformValues[5].trim(), "0px", "Test2: skewy: param 5 is 0px");
style = window.getComputedStyle(document.getElementById("test3"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 1, 1, 1, 0px, 0px)",
@ -138,9 +157,18 @@ function runtests() {
is(style.getPropertyValue("-moz-transform"), "none",
"Test7: Skew with more invalid units");
// Test 8: skew with negative degrees, here again we must handle rounding.
// The matrix should be: matrix(1, 3.73206, -1, 1, 0px, 0px)
style = window.getComputedStyle(document.getElementById("test8"), "");
is(style.getPropertyValue("-moz-transform"), "matrix(1, 3.73206, -1, 1, 0px, 0px)",
"Test8: Skew with negative degrees");
tformStyle = style.getPropertyValue("-moz-transform");
tformValues = tformStyle.substring(tformStyle.indexOf('(') + 1,
tformStyle.indexOf(')')).split(',');
is(tformValues[0], 1, "Test8: Test skew with negative degrees-param 0 is 1");
ok(verifyRounded(tformValues[1], 3.73206), "Test8: Rounded param 2 is in bounds should be 3.73206 really is: " + tformValues[1]);
is((+tformValues[2]), -1, "Test8: param 2 is -1");
is((+tformValues[3]), 1, "Test8: param 3 is 1");
is(tformValues[4].trim(), "0px", "Test8: param 4 is 0px");
is(tformValues[5].trim(), "0px", "Test8: param 5 is 0px");
style = window.getComputedStyle(document.getElementById("test9"), "");
is(style.getPropertyValue("-moz-transform"), "none",
@ -154,6 +182,12 @@ function runtests() {
is(style.getPropertyValue("-moz-transform"), "matrix(1, -10000, 10000, 1, 0px, 0px)",
"Test11: Skew with more infinite numbers");
}
// Verifies that aVal is +/- 0.00001 of aTrueVal
// Returns true if so, false if not
function verifyRounded(aVal, aTrueVal) {
return (Math.abs(aVal - aTrueVal) <= 0.00001);
}
</script>
</pre>
</body>