| OLD | NEW |
| 1 /* This is the helper function to run animation tests: | 1 /* This is the helper function to run animation tests: |
| 2 | 2 |
| 3 Test page requirements: | 3 Test page requirements: |
| 4 - The body must contain an empty div with id "result" | 4 - The body must contain an empty div with id "result" |
| 5 - Call this function directly from the <script> inside the test page | 5 - Call this function directly from the <script> inside the test page |
| 6 | 6 |
| 7 Function parameters: | 7 Function parameters: |
| 8 expected [required]: an array of arrays defining a set of CSS properties tha
t must have given values at specific times (see below) | 8 expected [required]: an array of arrays defining a set of CSS properties tha
t must have given values at specific times (see below) |
| 9 callbacks [optional]: a function to be executed immediately after animation
starts; | 9 callbacks [optional]: a function to be executed immediately after animation
starts; |
| 10 or, an object in the form {time: function} containing
functions to be | 10 or, an object in the form {time: function} containing
functions to be |
| 11 called at the specified times (in seconds) during anim
ation. | 11 called at the specified times (in seconds) during anim
ation. |
| 12 trigger [optional]: a function to trigger transitions at the start of the te
st | 12 trigger [optional]: a function to trigger transitions at the start of the te
st |
| 13 | 13 |
| 14 Each sub-array must contain these items in this order: | 14 Each sub-array must contain these items in this order: |
| 15 - the time in seconds at which to snapshot the CSS property | 15 - the time in seconds at which to snapshot the CSS property |
| 16 - the id of the element on which to get the CSS property value [1] | 16 - the id of the element on which to get the CSS property value [1] |
| 17 - the name of the CSS property to get [2] | 17 - the name of the CSS property to get [2] |
| 18 - the expected value for the CSS property | 18 - the expected value for the CSS property |
| 19 - the tolerance to use when comparing the effective CSS property value with
its expected value | 19 - the tolerance to use when comparing the effective CSS property value with
its expected value |
| 20 | 20 |
| 21 [1] If a single string is passed, it is the id of the element to test. If an
array with 2 elements is passed they | 21 [1] If a single string is passed, it is the id of the element to test. If an
array with 2 elements is passed they |
| 22 are the ids of 2 elements, whose values are compared for equality. In this c
ase the expected value is ignored | 22 are the ids of 2 elements, whose values are compared for equality. In this c
ase the expected value is ignored |
| 23 but the tolerance is used in the comparison. If the second element is prefix
ed with "static:", no animation on that | 23 but the tolerance is used in the comparison. |
| 24 element is required, allowing comparison with an unanimated "expected value"
element. | |
| 25 | 24 |
| 26 If a string with a '.' is passed, this is an element in an iframe. The strin
g before the dot is the iframe id | 25 If a string with a '.' is passed, this is an element in an iframe. The strin
g before the dot is the iframe id |
| 27 and the string after the dot is the element name in that iframe. | 26 and the string after the dot is the element name in that iframe. |
| 28 | 27 |
| 29 [2] If the CSS property name is "webkitTransform", expected value must be an
array of 1 or more numbers corresponding to the matrix elements, | 28 [2] If the CSS property name is "webkitTransform", expected value must be an
array of 1 or more numbers corresponding to the matrix elements, |
| 30 or a string which will be compared directly (useful if the expected value is
"none") | 29 or a string which will be compared directly (useful if the expected value is
"none") |
| 31 If the CSS property name is "webkitTransform.N", expected value must be a nu
mber corresponding to the Nth element of the matrix | 30 If the CSS property name is "webkitTransform.N", expected value must be a nu
mber corresponding to the Nth element of the matrix |
| 32 | 31 |
| 33 */ | 32 */ |
| 34 | 33 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 { | 144 { |
| 146 log('Checking expectation: ' + JSON.stringify(expected[index])); | 145 log('Checking expectation: ' + JSON.stringify(expected[index])); |
| 147 var time = expected[index][0]; | 146 var time = expected[index][0]; |
| 148 var elementId = expected[index][1]; | 147 var elementId = expected[index][1]; |
| 149 var property = expected[index][2]; | 148 var property = expected[index][2]; |
| 150 var expectedValue = expected[index][3]; | 149 var expectedValue = expected[index][3]; |
| 151 var tolerance = expected[index][4]; | 150 var tolerance = expected[index][4]; |
| 152 | 151 |
| 153 // Check for a pair of element Ids | 152 // Check for a pair of element Ids |
| 154 var compareElements = false; | 153 var compareElements = false; |
| 155 var element2Static = false; | |
| 156 var elementId2; | 154 var elementId2; |
| 157 if (typeof elementId != "string") { | 155 if (typeof elementId != "string") { |
| 158 if (elementId.length != 2) | 156 if (elementId.length != 2) |
| 159 return; | 157 return; |
| 160 | 158 |
| 161 elementId2 = elementId[1]; | 159 elementId2 = elementId[1]; |
| 162 elementId = elementId[0]; | 160 elementId = elementId[0]; |
| 163 | 161 |
| 164 if (elementId2.indexOf("static:") == 0) { | |
| 165 elementId2 = elementId2.replace("static:", ""); | |
| 166 element2Static = true; | |
| 167 } | |
| 168 | |
| 169 compareElements = true; | 162 compareElements = true; |
| 170 } | 163 } |
| 171 | 164 |
| 172 // Check for a dot separated string | 165 // Check for a dot separated string |
| 173 var iframeId; | 166 var iframeId; |
| 174 if (!compareElements) { | 167 if (!compareElements) { |
| 175 var array = elementId.split('.'); | 168 var array = elementId.split('.'); |
| 176 if (array.length == 2) { | 169 if (array.length == 2) { |
| 177 iframeId = array[0]; | 170 iframeId = array[0]; |
| 178 elementId = array[1]; | 171 elementId = array[1]; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 620 |
| 628 [1] If the CSS property name is "-webkit-transform", expected value must be
an array of 1 or more numbers corresponding to the matrix elements, | 621 [1] If the CSS property name is "-webkit-transform", expected value must be
an array of 1 or more numbers corresponding to the matrix elements, |
| 629 or a string which will be compared directly (useful if the expected value is
"none") | 622 or a string which will be compared directly (useful if the expected value is
"none") |
| 630 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix | 623 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix |
| 631 | 624 |
| 632 */ | 625 */ |
| 633 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau
seAnimationAPI) { | 626 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau
seAnimationAPI) { |
| 634 isTransitionsTest = true; | 627 isTransitionsTest = true; |
| 635 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP
ixelTest); | 628 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP
ixelTest); |
| 636 } | 629 } |
| OLD | NEW |