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 } | |
383 } else { | 370 } else { |
384 var computedStyle = window.getComputedStyle(document.getElementById(elem
entId)).getPropertyCSSValue(property); | 371 var computedStyle = window.getComputedStyle(document.getElementById(elem
entId)).getPropertyCSSValue(property); |
385 if (computedStyle.cssValueType == CSSValue.CSS_VALUE_LIST) { | 372 if (computedStyle.cssValueType == CSSValue.CSS_VALUE_LIST) { |
386 var values = []; | 373 var values = []; |
387 for (var i = 0; i < computedStyle.length; ++i) { | 374 for (var i = 0; i < computedStyle.length; ++i) { |
388 switch (computedStyle[i].cssValueType) { | 375 switch (computedStyle[i].cssValueType) { |
389 case CSSValue.CSS_PRIMITIVE_VALUE: | 376 case CSSValue.CSS_PRIMITIVE_VALUE: |
390 values.push(computedStyle[i].getFloatValue(CSSPrimitiveValue
.CSS_NUMBER)); | 377 values.push(computedStyle[i].getFloatValue(CSSPrimitiveValue
.CSS_NUMBER)); |
391 break; | 378 break; |
392 case CSSValue.CSS_CUSTOM: | 379 case CSSValue.CSS_CUSTOM: |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 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, |
703 or a string which will be compared directly (useful if the expected value is
"none") | 690 or a string which will be compared directly (useful if the expected value is
"none") |
704 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix | 691 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix |
705 | 692 |
706 */ | 693 */ |
707 function runTransitionTest(expected, trigger, callbacks, doPixelTest) { | 694 function runTransitionTest(expected, trigger, callbacks, doPixelTest) { |
708 expected = expected.map(function(expectation) { expectation.unshift(null); r
eturn expectation; }); | 695 expected = expected.map(function(expectation) { expectation.unshift(null); r
eturn expectation; }); |
709 isTransitionsTest = true; | 696 isTransitionsTest = true; |
710 runAnimationTest(expected, callbacks, trigger, false, doPixelTest); | 697 runAnimationTest(expected, callbacks, trigger, false, doPixelTest); |
711 } | 698 } |
OLD | NEW |