| 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 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 pass = isCloseEnough(parseFloat(m[parseInt(property.substring(18))])
, expectedValue, tolerance); | 310 pass = isCloseEnough(parseFloat(m[parseInt(property.substring(18))])
, expectedValue, tolerance); |
| 311 } else { | 311 } else { |
| 312 var m = computedValue.split("("); | 312 var m = computedValue.split("("); |
| 313 var m = m[1].split(","); | 313 var m = m[1].split(","); |
| 314 for (i = 0; i < expectedValue.length; ++i) { | 314 for (i = 0; i < expectedValue.length; ++i) { |
| 315 pass = isCloseEnough(parseFloat(m[i]), expectedValue[i], toleran
ce); | 315 pass = isCloseEnough(parseFloat(m[i]), expectedValue[i], toleran
ce); |
| 316 if (!pass) | 316 if (!pass) |
| 317 break; | 317 break; |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 } else if (property == "fill" || property == "stroke") { | 320 } else if (property == "fill" || property == "stroke" || property == "stop-c
olor" || property == "flood-color" || property == "lighting-color") { |
| 321 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).getPropertyCSSValue(property).rgbColor; | |
| 322 if (compareRGB([computedValue.red.cssText, computedValue.green.cssText,
computedValue.blue.cssText], expectedValue, tolerance)) | |
| 323 pass = true; | |
| 324 else { | |
| 325 // We failed. Make sure computed value is something we can read in t
he error message | |
| 326 computedValue = window.getComputedStyle(document.getElementById(elem
entId)).getPropertyCSSValue(property).cssText; | |
| 327 } | |
| 328 } else if (property == "stop-color" || property == "flood-color" || property
== "lighting-color") { | |
| 329 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).getPropertyCSSValue(property); | 321 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).getPropertyCSSValue(property); |
| 330 // The computedValue cssText is rgb(num, num, num) | 322 // The computedValue cssText is rgb(num, num, num) |
| 331 var components = computedValue.cssText.split("(")[1].split(")")[0].split
(","); | 323 var components = computedValue.cssText.split("(")[1].split(")")[0].split
(","); |
| 332 if (compareRGB(components, expectedValue, tolerance)) | 324 if (compareRGB(components, expectedValue, tolerance)) |
| 333 pass = true; | 325 pass = true; |
| 334 else { | 326 else { |
| 335 // We failed. Make sure computed value is something we can read in t
he error message | 327 // We failed. Make sure computed value is something we can read in t
he error message |
| 336 computedValue = computedValue.cssText; | 328 computedValue = computedValue.cssText; |
| 337 } | 329 } |
| 338 } else if (property == "lineHeight") { | 330 } else if (property == "lineHeight") { |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 | 694 |
| 703 [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, | 695 [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, |
| 704 or a string which will be compared directly (useful if the expected value is
"none") | 696 or a string which will be compared directly (useful if the expected value is
"none") |
| 705 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix | 697 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix |
| 706 | 698 |
| 707 */ | 699 */ |
| 708 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau
seAnimationAPI) { | 700 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau
seAnimationAPI) { |
| 709 isTransitionsTest = true; | 701 isTransitionsTest = true; |
| 710 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP
ixelTest); | 702 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP
ixelTest); |
| 711 } | 703 } |
| OLD | NEW |