Commit de2b1c4a authored by jparent@chromium.org's avatar jparent@chromium.org
Browse files

Make change-values-during-transition less flaky. Transition is 1 sec duration,

translating 100px, starting at 0, so it should be at 50px at 500ms, not 600ms.
                
Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=31997

* transitions/change-values-during-transition.html:
isEqual: Remove unnecessary code - tolerance always passed in and always default value.
getXPosition: Extract into a function, since it is duplicated twice.
check2: Still run second check if the first fails, just give more debugging output.
start: Remove final setTimeout - nothing changes between the end of check2 and here,
    so this is just making the test take 100ms longer.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 47dd0f0a
2009-11-30 Julie Parent <jparent@chromium.org>
Reviewed by Darin Adler.
Make change-values-during-transition less flaky. Transition is 1 sec duration,
translating 100px, starting at 0, so it should be at 50px at 500ms, not 600ms.
https://bugs.webkit.org/show_bug.cgi?id=31997
* transitions/change-values-during-transition.html:
isEqual: Remove unnecessary code - tolerance always passed in and always default value.
getXPosition: Extract into a function, since it is duplicated twice.
check2: Still run second check if the first fails, just give more debugging output.
start: Remove final setTimeout - nothing changes between the end of check2 and here,
so this is just making the test take 100ms longer.
2009-12-02 Brian Weinstein <bweinstein@apple.com> 2009-12-02 Brian Weinstein <bweinstein@apple.com>
   
Rubber-stamped by Adam Roben. Rubber-stamped by Adam Roben.
...@@ -21,15 +21,13 @@ ...@@ -21,15 +21,13 @@
layoutTestController.waitUntilDone(); layoutTestController.waitUntilDone();
} }
result = "PASS"; var result = "PASS";
const defaultTolerance = 10; const defaultTolerance = 10;
function isEqual(actual, desired, tolerance) function isCloseEnough(actual, desired)
{ {
if (tolerance == undefined || tolerance == 0)
tolerance = defaultTolerance;
var diff = Math.abs(actual - desired); var diff = Math.abs(actual - desired);
return diff < tolerance; return diff < defaultTolerance;
} }
function changeValues() function changeValues()
...@@ -38,25 +36,30 @@ ...@@ -38,25 +36,30 @@
box.style.webkitTransitionDuration = "0.1s"; box.style.webkitTransitionDuration = "0.1s";
} }
function check1() function getXPosition()
{ {
var t = window.getComputedStyle(document.getElementById('box')).webkitTransform; var t = window.getComputedStyle(document.getElementById('box')).webkitTransform;
var t = t.split("("); t = t.split("(");
var t = t[1].split(","); t = t[1].split(",");
if (!isEqual(t[4], 50, defaultTolerance)) return t[4];
result = "FAIL(was:"+t[4]+", s/b:50)"; }
function check1()
{
var xPos = getXPosition();
if (!isCloseEnough(xPos, 50))
result = "FAIL(was:"+xPos+", s/b:50)";
} }
function check2() function check2()
{ {
if (result != "PASS") var xPos = getXPosition();
return; if (!isCloseEnough(xPos, 0))
result += "FAIL(was:"+xPos+", s/b:0)";
var t = window.getComputedStyle(document.getElementById('box')).webkitTransform; document.getElementById('result').innerText = result;
var t = t.split("("); if (window.layoutTestController)
var t = t[1].split(","); layoutTestController.notifyDone();
if (!isEqual(t[4], 0, defaultTolerance))
result = "FAIL(was:"+t[4]+", s/b:0)";
} }
function goBack() function goBack()
...@@ -69,15 +72,9 @@ ...@@ -69,15 +72,9 @@
{ {
var box = document.getElementById('box'); var box = document.getElementById('box');
setTimeout("changeValues()", 100); setTimeout("changeValues()", 100);
setTimeout("check1()", 600); setTimeout("check1()", 500);
setTimeout("check2()", 1300); setTimeout("check2()", 1300);
box.style.webkitTransform = 'translateX(100px)'; box.style.webkitTransform = 'translateX(100px)';
window.setTimeout(function() {
document.getElementById('result').innerHTML = result;
if (window.layoutTestController)
layoutTestController.notifyDone();
}, 1400);
} }
window.addEventListener('load', start, false); window.addEventListener('load', start, false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment