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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 property += "-source"; | 360 property += "-source"; |
361 | 361 |
362 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).getPropertyCSSValue(property).cssText; | 362 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).getPropertyCSSValue(property).cssText; |
363 computedCrossFade = parseCrossFade(computedValue); | 363 computedCrossFade = parseCrossFade(computedValue); |
364 | 364 |
365 if (!computedCrossFade) { | 365 if (!computedCrossFade) { |
366 pass = false; | 366 pass = false; |
367 } else { | 367 } else { |
368 pass = isCloseEnough(computedCrossFade.percent, expectedValue, toler
ance); | 368 pass = isCloseEnough(computedCrossFade.percent, expectedValue, toler
ance); |
369 } | 369 } |
| 370 } else if (property == "object-position") { |
| 371 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).objectPosition; |
| 372 var actualArray = computedValue.split(" "); |
| 373 var expectedArray = expectedValue.split(" "); |
| 374 if (actualArray.length != expectedArray.length) { |
| 375 pass = false; |
| 376 } else { |
| 377 for (i = 0; i < expectedArray.length; ++i) { |
| 378 pass = isCloseEnough(parseFloat(actualArray[i]), parseFloat(expe
ctedArray[i]), tolerance); |
| 379 if (!pass) |
| 380 break; |
| 381 } |
| 382 } |
370 } else { | 383 } else { |
371 var computedStyle = window.getComputedStyle(document.getElementById(elem
entId)).getPropertyCSSValue(property); | 384 var computedStyle = window.getComputedStyle(document.getElementById(elem
entId)).getPropertyCSSValue(property); |
372 if (computedStyle.cssValueType == CSSValue.CSS_VALUE_LIST) { | 385 if (computedStyle.cssValueType == CSSValue.CSS_VALUE_LIST) { |
373 var values = []; | 386 var values = []; |
374 for (var i = 0; i < computedStyle.length; ++i) { | 387 for (var i = 0; i < computedStyle.length; ++i) { |
375 switch (computedStyle[i].cssValueType) { | 388 switch (computedStyle[i].cssValueType) { |
376 case CSSValue.CSS_PRIMITIVE_VALUE: | 389 case CSSValue.CSS_PRIMITIVE_VALUE: |
377 values.push(computedStyle[i].getFloatValue(CSSPrimitiveValue
.CSS_NUMBER)); | 390 values.push(computedStyle[i].getFloatValue(CSSPrimitiveValue
.CSS_NUMBER)); |
378 break; | 391 break; |
379 case CSSValue.CSS_CUSTOM: | 392 case CSSValue.CSS_CUSTOM: |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 [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, | 702 [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, |
690 or a string which will be compared directly (useful if the expected value is
"none") | 703 or a string which will be compared directly (useful if the expected value is
"none") |
691 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix | 704 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix |
692 | 705 |
693 */ | 706 */ |
694 function runTransitionTest(expected, trigger, callbacks, doPixelTest) { | 707 function runTransitionTest(expected, trigger, callbacks, doPixelTest) { |
695 expected = expected.map(function(expectation) { expectation.unshift(null); r
eturn expectation; }); | 708 expected = expected.map(function(expectation) { expectation.unshift(null); r
eturn expectation; }); |
696 isTransitionsTest = true; | 709 isTransitionsTest = true; |
697 runAnimationTest(expected, callbacks, trigger, false, doPixelTest); | 710 runAnimationTest(expected, callbacks, trigger, false, doPixelTest); |
698 } | 711 } |
OLD | NEW |