diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/css/css-transforms')
6 files changed, 5 insertions, 84 deletions
diff --git a/tests/wpt/web-platform-tests/css/css-transforms/animation/list-interpolation.html b/tests/wpt/web-platform-tests/css/css-transforms/animation/list-interpolation.html index 4755279d73c..85701e9efad 100644 --- a/tests/wpt/web-platform-tests/css/css-transforms/animation/list-interpolation.html +++ b/tests/wpt/web-platform-tests/css/css-transforms/animation/list-interpolation.html @@ -7,7 +7,7 @@ <meta name="assert" content="Interpolation of transform function lists is performed as follows"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="resources/interpolation-testcommon.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> </head> <body> <script> diff --git a/tests/wpt/web-platform-tests/css/css-transforms/animation/matrix-interpolation.html b/tests/wpt/web-platform-tests/css/css-transforms/animation/matrix-interpolation.html index 4becea079d7..a326e7c92f2 100644 --- a/tests/wpt/web-platform-tests/css/css-transforms/animation/matrix-interpolation.html +++ b/tests/wpt/web-platform-tests/css/css-transforms/animation/matrix-interpolation.html @@ -5,7 +5,7 @@ <meta name="assert" content="When interpolating between two matrices, each matrix is decomposed into the corresponding translation, rotation, scale, skew and (for a 3D matrix) perspective values"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="resources/interpolation-testcommon.js"></script> +<script src="/css/support/interpolation-testcommon.js"></script> <body> <script> // Test interpolation of quaternions when the dot product is -1. diff --git a/tests/wpt/web-platform-tests/css/css-transforms/animation/resources/interpolation-testcommon.js b/tests/wpt/web-platform-tests/css/css-transforms/animation/resources/interpolation-testcommon.js deleted file mode 100644 index 73ce9ceefb3..00000000000 --- a/tests/wpt/web-platform-tests/css/css-transforms/animation/resources/interpolation-testcommon.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict'; -function test_interpolation(settings, expectations, name) { - var message_prefix = name ? name + ': ' : ''; - // Returns a timing function that at 0.5 evaluates to progress. - function timingFunction(progress) { - if (progress === 0) - return 'steps(1, end)'; - if (progress === 1) - return 'steps(1, start)'; - var y = (8 * progress - 1) / 6; - return 'cubic-bezier(0, ' + y + ', 1, ' + y + ')'; - } - - function RoundMatrix(style) { - var matrixMatch = style.match(/^(matrix(3d)?)\(.+\)$/); - if (!!matrixMatch) { - var matrixType = matrixMatch[1]; - var matrixArgs = style.substr(matrixType.length); - var extractmatrix = function(matrixStr) { - var list = []; - var regex = /[+\-]?[0-9]+[.]?[0-9]*(e[+/-][0-9]+)?/g; - var match = undefined; - do { - match = regex.exec(matrixStr); - if (match) { - list.push(parseFloat(parseFloat(match[0]).toFixed(6))); - } - } while (match); - return list; - } - return matrixType + '(' + extractmatrix(matrixArgs).join(', ') + ')'; - } - return style; - } - - test(function(){ - assert_true(CSS.supports(settings.property, settings.from), 'Value "' + settings.from + '" is supported by ' + settings.property); - assert_true(CSS.supports(settings.property, settings.to), 'Value "' + settings.to + '" is supported by ' + settings.property); - }, message_prefix + '"' + settings.from + '" and "' + settings.to + '" are valid ' + settings.property + ' values'); - - for (var i = 0; i < expectations.length; ++i) { - var progress = expectations[i].at; - var expectation = expectations[i].expect; - var animationId = 'anim' + i; - var targetId = 'target' + i; - var referenceId = 'reference' + i; - - test(function(){ - assert_true(CSS.supports(settings.property, expectation), 'Value "' + expectation + '" is supported by ' + settings.property); - - var stylesheet = document.createElement('style'); - stylesheet.textContent = - '#' + targetId + ' {\n' + - ' animation: 2s ' + timingFunction(progress) + ' -1s paused ' + animationId + ';\n' + - '}\n' + - '@keyframes ' + animationId + ' {\n' + - ' 0% { ' + settings.property + ': ' + settings.from + '; }\n' + - ' 100% { ' + settings.property + ': ' + settings.to + '; }\n' + - '}\n' + - '#' + referenceId + ' {\n' + - ' ' + settings.property + ': ' + expectation + ';\n' + - '}\n'; - document.head.appendChild(stylesheet); - - var target = document.createElement('div'); - target.id = targetId; - document.body.appendChild(target); - - var reference = document.createElement('div'); - reference.id = referenceId; - document.body.appendChild(reference); - reference.style = ''; - - var observed = RoundMatrix(getComputedStyle(target)[settings.property]); - var expected = RoundMatrix(getComputedStyle(reference)[settings.property]); - assert_equals(observed, expected); - }, message_prefix + 'Animation between "' + settings.from + '" and "' + settings.to + '" at progress ' + progress); - } -} diff --git a/tests/wpt/web-platform-tests/css/css-transforms/animation/rotate-interpolation.html b/tests/wpt/web-platform-tests/css/css-transforms/animation/rotate-interpolation.html index ec96ba0b09b..911d8e38bd0 100644 --- a/tests/wpt/web-platform-tests/css/css-transforms/animation/rotate-interpolation.html +++ b/tests/wpt/web-platform-tests/css/css-transforms/animation/rotate-interpolation.html @@ -8,7 +8,7 @@ <meta name="assert" content="rotate supports animation."> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <script src="resources/interpolation-testcommon.js"></script> + <script src="/css/support/interpolation-testcommon.js"></script> </head> <body> <script> diff --git a/tests/wpt/web-platform-tests/css/css-transforms/animation/scale-interpolation.html b/tests/wpt/web-platform-tests/css/css-transforms/animation/scale-interpolation.html index 942b80a309d..146575c902c 100644 --- a/tests/wpt/web-platform-tests/css/css-transforms/animation/scale-interpolation.html +++ b/tests/wpt/web-platform-tests/css/css-transforms/animation/scale-interpolation.html @@ -8,7 +8,7 @@ <meta name="assert" content="scale supports animation."> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <script src="resources/interpolation-testcommon.js"></script> + <script src="/css/support/interpolation-testcommon.js"></script> </head> <body> <script> diff --git a/tests/wpt/web-platform-tests/css/css-transforms/animation/translate-interpolation.html b/tests/wpt/web-platform-tests/css/css-transforms/animation/translate-interpolation.html index d5d47f733ef..aed6c41cf64 100644 --- a/tests/wpt/web-platform-tests/css/css-transforms/animation/translate-interpolation.html +++ b/tests/wpt/web-platform-tests/css/css-transforms/animation/translate-interpolation.html @@ -8,7 +8,7 @@ <meta name="assert" content="translate supports <length> and <percentage> animation."> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <script src="resources/interpolation-testcommon.js"></script> + <script src="/css/support/interpolation-testcommon.js"></script> <style> body { width: 500px; |