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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 var expectedArray = expectedValue.split(" "); | 282 var expectedArray = expectedValue.split(" "); |
283 if (actualArray.length != expectedArray.length) { | 283 if (actualArray.length != expectedArray.length) { |
284 pass = false; | 284 pass = false; |
285 } else { | 285 } else { |
286 for (i = 0; i < expectedArray.length; ++i) { | 286 for (i = 0; i < expectedArray.length; ++i) { |
287 pass = isCloseEnough(parseFloat(actualArray[i]), parseFloat(expe
ctedArray[i]), tolerance); | 287 pass = isCloseEnough(parseFloat(actualArray[i]), parseFloat(expe
ctedArray[i]), tolerance); |
288 if (!pass) | 288 if (!pass) |
289 break; | 289 break; |
290 } | 290 } |
291 } | 291 } |
292 } else if (property === "shape-inside" || property === "shape-outside") { | 292 } else if (property === "shape-outside") { |
293 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).getPropertyValue(property); | 293 computedValue = window.getComputedStyle(document.getElementById(elementI
d)).getPropertyValue(property); |
294 var actualShape = parseBasicShape(computedValue); | 294 var actualShape = parseBasicShape(computedValue); |
295 var expectedShape = parseBasicShape(expectedValue); | 295 var expectedShape = parseBasicShape(expectedValue); |
296 pass = basicShapeParametersMatch(actualShape, expectedShape, tolerance); | 296 pass = basicShapeParametersMatch(actualShape, expectedShape, tolerance); |
297 } else { | 297 } else { |
298 var computedStyle = window.getComputedStyle(document.getElementById(elem
entId)).getPropertyCSSValue(property); | 298 var computedStyle = window.getComputedStyle(document.getElementById(elem
entId)).getPropertyCSSValue(property); |
299 if (computedStyle.cssValueType == CSSValue.CSS_VALUE_LIST) { | 299 if (computedStyle.cssValueType == CSSValue.CSS_VALUE_LIST) { |
300 var values = []; | 300 var values = []; |
301 for (var i = 0; i < computedStyle.length; ++i) { | 301 for (var i = 0; i < computedStyle.length; ++i) { |
302 switch (computedStyle[i].cssValueType) { | 302 switch (computedStyle[i].cssValueType) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 if (property == "lineHeight") | 384 if (property == "lineHeight") |
385 computedValue = parseInt(window.getComputedStyle(element).lineHeight); | 385 computedValue = parseInt(window.getComputedStyle(element).lineHeight); |
386 else if (property == "backgroundImage" | 386 else if (property == "backgroundImage" |
387 || property == "borderImageSource" | 387 || property == "borderImageSource" |
388 || property == "listStyleImage" | 388 || property == "listStyleImage" |
389 || property == "webkitMaskImage" | 389 || property == "webkitMaskImage" |
390 || property == "webkitMaskBoxImage" | 390 || property == "webkitMaskBoxImage" |
391 || property == "webkitFilter" | 391 || property == "webkitFilter" |
392 || property == "webkitClipPath" | 392 || property == "webkitClipPath" |
393 || property == "shapeInside" | |
394 || !property.indexOf("webkitTransform")) { | 393 || !property.indexOf("webkitTransform")) { |
395 computedValue = window.getComputedStyle(element)[property.split(".")[0]]
; | 394 computedValue = window.getComputedStyle(element)[property.split(".")[0]]
; |
396 } else { | 395 } else { |
397 var computedStyle = window.getComputedStyle(element).getPropertyCSSValue
(property); | 396 var computedStyle = window.getComputedStyle(element).getPropertyCSSValue
(property); |
398 try { | 397 try { |
399 computedValue = computedStyle.getFloatValue(CSSPrimitiveValue.CSS_NU
MBER); | 398 computedValue = computedStyle.getFloatValue(CSSPrimitiveValue.CSS_NU
MBER); |
400 } catch (e) { | 399 } catch (e) { |
401 computedValue = computedStyle.cssText; | 400 computedValue = computedStyle.cssText; |
402 } | 401 } |
403 } | 402 } |
(...skipping 16 matching lines...) Expand all Loading... |
420 for (i = 0; i < expectedValue.length; ++i) { | 419 for (i = 0; i < expectedValue.length; ++i) { |
421 result = isCloseEnough(parseFloat(m[i]), expectedValue[i], toler
ance); | 420 result = isCloseEnough(parseFloat(m[i]), expectedValue[i], toler
ance); |
422 if (!result) | 421 if (!result) |
423 break; | 422 break; |
424 } | 423 } |
425 } | 424 } |
426 } else if (property == "webkitFilter") { | 425 } else if (property == "webkitFilter") { |
427 var filterParameters = getFilterParameters(computedValue); | 426 var filterParameters = getFilterParameters(computedValue); |
428 var filter2Parameters = getFilterParameters(expectedValue); | 427 var filter2Parameters = getFilterParameters(expectedValue); |
429 result = filterParametersMatch(filterParameters, filter2Parameters, tole
rance); | 428 result = filterParametersMatch(filterParameters, filter2Parameters, tole
rance); |
430 } else if (property == "webkitClipPath" || property == "shapeInside") { | 429 } else if (property == "webkitClipPath") { |
431 var clipPathParameters = parseBasicShape(computedValue); | 430 var clipPathParameters = parseBasicShape(computedValue); |
432 var clipPathParameters2 = parseBasicShape(expectedValue); | 431 var clipPathParameters2 = parseBasicShape(expectedValue); |
433 if (!clipPathParameters || !clipPathParameters2) | 432 if (!clipPathParameters || !clipPathParameters2) |
434 result = false; | 433 result = false; |
435 result = basicShapeParametersMatch(clipPathParameters, clipPathParameter
s2, tolerance); | 434 result = basicShapeParametersMatch(clipPathParameters, clipPathParameter
s2, tolerance); |
436 } else if (property == "backgroundImage" | 435 } else if (property == "backgroundImage" |
437 || property == "borderImageSource" | 436 || property == "borderImageSource" |
438 || property == "listStyleImage" | 437 || property == "listStyleImage" |
439 || property == "webkitMaskImage" | 438 || property == "webkitMaskImage" |
440 || property == "webkitMaskBoxImage") { | 439 || property == "webkitMaskBoxImage") { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 627 |
629 [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, | 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, |
630 or a string which will be compared directly (useful if the expected value is
"none") | 629 or a string which will be compared directly (useful if the expected value is
"none") |
631 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix | 630 If the CSS property name is "-webkit-transform.N", expected value must be a
number corresponding to the Nth element of the matrix |
632 | 631 |
633 */ | 632 */ |
634 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau
seAnimationAPI) { | 633 function runTransitionTest(expected, trigger, callbacks, doPixelTest, disablePau
seAnimationAPI) { |
635 isTransitionsTest = true; | 634 isTransitionsTest = true; |
636 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP
ixelTest); | 635 runAnimationTest(expected, callbacks, trigger, disablePauseAnimationAPI, doP
ixelTest); |
637 } | 636 } |
OLD | NEW |