Commit 3edc8002 authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Port flex-*-interpolation.html tests to WPT

Bug: 900581
Change-Id: I9cd2582aea4792c6bc0fa68f9bbf20f17a74a90c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768551Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690332}
parent 555e52aa
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
flex-shrink: 3;
}
.target {
flex-shrink: 1.5;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'flex-shrink',
from: neutralKeyframe,
to: '2',
}, [
{at: -0.3, is: '1.35'},
{at: 0, is: '1.5'},
{at: 0.3, is: '1.65'},
{at: 0.6, is: '1.8'},
{at: 1, is: '2'},
{at: 1.5, is: '2.25'},
]);
assertInterpolation({
property: 'flex-shrink',
from: 'initial',
to: '2',
}, [
{at: -0.3, is: '0.7'},
{at: 0, is: '1'},
{at: 0.3, is: '1.3'},
{at: 0.6, is: '1.6'},
{at: 1, is: '2'},
{at: 1.5, is: '2.5'},
]);
assertInterpolation({
property: 'flex-shrink',
from: 'inherit',
to: '2',
}, [
{at: -0.3, is: '3.3'},
{at: 0, is: '3'},
{at: 0.3, is: '2.7'},
{at: 0.6, is: '2.4'},
{at: 1, is: '2'},
{at: 1.5, is: '1.5'},
]);
assertInterpolation({
property: 'flex-shrink',
from: 'unset',
to: '2',
}, [
{at: -0.3, is: '0.7'},
{at: 0, is: '1'},
{at: 0.3, is: '1.3'},
{at: 0.6, is: '1.6'},
{at: 1, is: '2'},
{at: 1.5, is: '2.5'},
]);
assertInterpolation({
property: 'flex-shrink',
from: '1',
to: '2',
}, [
{at: -5, is: '0'},
{at: -0.3, is: '0.7'},
{at: 0, is: '1'},
{at: 0.3, is: '1.3'},
{at: 0.6, is: '1.6'},
{at: 1, is: '2'},
{at: 1.5, is: '2.5'},
]);
assertInterpolation({
property: 'flex-shrink',
from: '0',
to: '1',
}, [
{at: -5, is: '0'},
{at: -0.3, is: '0'},
{at: 0, is: '0'},
{at: 0.3, is: '0.3'},
{at: 0.6, is: '0.6'},
{at: 1, is: '1'},
{at: 1.5, is: '1.5'},
]);
</script>
</body>
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>flex-basis interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#flex-basis-property">
<meta name="assert" content="flex-basis supports animation by computed value type">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style> <style>
.parent { .parent {
flex-basis: 3%; flex-basis: 3%;
...@@ -8,71 +16,72 @@ ...@@ -8,71 +16,72 @@
flex-basis: 1%; flex-basis: 1%;
} }
</style> </style>
<body>
<script src="resources/interpolation-test.js"></script> <body></body>
<script> <script>
assertInterpolation({ test_interpolation({
property: 'flex-basis', property: 'flex-basis',
from: neutralKeyframe, from: neutralKeyframe,
to: '2%', to: '2%',
}, [ }, [
{at: -0.3, is: '0.7%'}, {at: -0.3, expect: '0.7%'},
{at: 0, is: '1%'}, {at: 0, expect: '1%'},
{at: 0.3, is: '1.3%'}, {at: 0.3, expect: '1.3%'},
{at: 0.6, is: '1.6%'}, {at: 0.6, expect: '1.6%'},
{at: 1, is: '2%'}, {at: 1, expect: '2%'},
{at: 1.5, is: '2.5%'}, {at: 1.5, expect: '2.5%'},
]); ]);
assertNoInterpolation({ test_no_interpolation({
property: 'flex-basis', property: 'flex-basis',
from: 'initial', from: 'initial',
to: '2%', to: '2%',
}); });
assertInterpolation({ test_interpolation({
property: 'flex-basis', property: 'flex-basis',
from: 'inherit', from: 'inherit',
to: '2%', to: '2%',
}, [ }, [
{at: -0.3, is: '3.3%'}, {at: -0.3, expect: '3.3%'},
{at: 0, is: '3%'}, {at: 0, expect: '3%'},
{at: 0.3, is: '2.7%'}, {at: 0.3, expect: '2.7%'},
{at: 0.6, is: '2.4%'}, {at: 0.6, expect: '2.4%'},
{at: 1, is: '2%'}, {at: 1, expect: '2%'},
{at: 1.5, is: '1.5%'}, {at: 1.5, expect: '1.5%'},
]); ]);
assertNoInterpolation({ test_no_interpolation({
property: 'flex-basis', property: 'flex-basis',
from: 'unset', from: 'unset',
to: '2%', to: '2%',
}); });
assertInterpolation({ test_interpolation({
property: 'flex-basis', property: 'flex-basis',
from: '0px', from: '0px',
to: '100px' to: '100px'
}, [ }, [
{at: -0.3, is: '0px'}, {at: -0.3, expect: '0px'},
{at: 0, is: '0px'}, {at: 0, expect: '0px'},
{at: 0.4, is: '40px'}, {at: 0.4, expect: '40px'},
{at: 0.6, is: '60px'}, {at: 0.6, expect: '60px'},
{at: 1, is: '100px'}, {at: 1, expect: '100px'},
{at: 1.5, is: '150px'} {at: 1.5, expect: '150px'}
]); ]);
assertInterpolation({ test_interpolation({
property: 'flex-basis', property: 'flex-basis',
from: '0%', from: '0%',
to: '100%' to: '100%'
}, [ }, [
{at: -0.3, is: '0%'}, {at: -0.3, expect: '0%'},
{at: 0, is: '0%'}, {at: 0, expect: '0%'},
{at: 0.4, is: '40%'}, {at: 0.4, expect: '40%'},
{at: 0.6, is: '60%'}, {at: 0.6, expect: '60%'},
{at: 1, is: '100%'}, {at: 1, expect: '100%'},
{at: 1.5, is: '150%'} {at: 1.5, expect: '150%'}
]); ]);
</script> </script>
</body>
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>flex-grow interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#flex-grow-property">
<meta name="assert" content="flex-grow supports animation by computed value type">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style> <style>
.parent { .parent {
display: flex; display: flex;
...@@ -18,6 +26,7 @@ ...@@ -18,6 +26,7 @@
background: green; background: green;
} }
</style> </style>
<body> <body>
<template id="target-template"> <template id="target-template">
<div class="parent"> <div class="parent">
...@@ -25,86 +34,86 @@ ...@@ -25,86 +34,86 @@
<div class="filler"></div> <div class="filler"></div>
</div> </div>
</template> </template>
<script src="resources/interpolation-test.js"></script> </body>
<script> <script>
assertInterpolation({ test_interpolation({
property: 'flex-grow', property: 'flex-grow',
from: neutralKeyframe, from: neutralKeyframe,
to: '2', to: '2',
}, [ }, [
{at: -0.3, is: '0.7'}, {at: -0.3, expect: '0.7'},
{at: 0, is: '1'}, {at: 0, expect: '1'},
{at: 0.3, is: '1.3'}, {at: 0.3, expect: '1.3'},
{at: 0.6, is: '1.6'}, {at: 0.6, expect: '1.6'},
{at: 1, is: '2'}, {at: 1, expect: '2'},
{at: 1.5, is: '2.5'}, {at: 1.5, expect: '2.5'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'flex-grow', property: 'flex-grow',
from: 'initial', from: 'initial',
to: '2', to: '2',
}, [ }, [
{at: -0.3, is: '0'}, {at: -0.3, expect: '0'},
{at: 0, is: '0'}, {at: 0, expect: '0'},
{at: 0.3, is: '0.6'}, {at: 0.3, expect: '0.6'},
{at: 0.6, is: '1.2'}, {at: 0.6, expect: '1.2'},
{at: 1, is: '2'}, {at: 1, expect: '2'},
{at: 1.5, is: '3'}, {at: 1.5, expect: '3'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'flex-grow', property: 'flex-grow',
from: 'inherit', from: 'inherit',
to: '2', to: '2',
}, [ }, [
{at: -0.3, is: '3.3'}, {at: -0.3, expect: '3.3'},
{at: 0, is: '3'}, {at: 0, expect: '3'},
{at: 0.3, is: '2.7'}, {at: 0.3, expect: '2.7'},
{at: 0.6, is: '2.4'}, {at: 0.6, expect: '2.4'},
{at: 1, is: '2'}, {at: 1, expect: '2'},
{at: 1.5, is: '1.5'}, {at: 1.5, expect: '1.5'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'flex-grow', property: 'flex-grow',
from: 'unset', from: 'unset',
to: '2', to: '2',
}, [ }, [
{at: -0.3, is: '0'}, {at: -0.3, expect: '0'},
{at: 0, is: '0'}, {at: 0, expect: '0'},
{at: 0.3, is: '0.6'}, {at: 0.3, expect: '0.6'},
{at: 0.6, is: '1.2'}, {at: 0.6, expect: '1.2'},
{at: 1, is: '2'}, {at: 1, expect: '2'},
{at: 1.5, is: '3'}, {at: 1.5, expect: '3'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'flex-grow', property: 'flex-grow',
from: '1', from: '1',
to: '2', to: '2',
}, [ }, [
{at: -5, is: '0'}, {at: -5, expect: '0'},
{at: -0.3, is: '0.7'}, {at: -0.3, expect: '0.7'},
{at: 0, is: '1'}, {at: 0, expect: '1'},
{at: 0.3, is: '1.3'}, {at: 0.3, expect: '1.3'},
{at: 0.6, is: '1.6'}, {at: 0.6, expect: '1.6'},
{at: 1, is: '2'}, {at: 1, expect: '2'},
{at: 1.5, is: '2.5'}, {at: 1.5, expect: '2.5'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'flex-grow', property: 'flex-grow',
from: '0', from: '0',
to: '1', to: '1',
}, [ }, [
{at: -5, is: '0'}, {at: -5, expect: '0'},
{at: -0.3, is: '0'}, {at: -0.3, expect: '0'},
{at: 0, is: '0'}, {at: 0, expect: '0'},
{at: 0.3, is: '0.3'}, {at: 0.3, expect: '0.3'},
{at: 0.6, is: '0.6'}, {at: 0.6, expect: '0.6'},
{at: 1, is: '1'}, {at: 1, expect: '1'},
{at: 1.5, is: '1.5'}, {at: 1.5, expect: '1.5'},
]); ]);
</script> </script>
</body>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>flex-shrink interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#flex-shrink-property">
<meta name="assert" content="flex-shrink supports animation as a number">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
flex-shrink: 3;
}
.target {
flex-shrink: 1.5;
}
</style>
<body></body>
<script>
test_interpolation({
property: 'flex-shrink',
from: neutralKeyframe,
to: '2',
}, [
{at: -0.3, expect: '1.35'},
{at: 0, expect: '1.5'},
{at: 0.3, expect: '1.65'},
{at: 0.6, expect: '1.8'},
{at: 1, expect: '2'},
{at: 1.5, expect: '2.25'},
]);
test_interpolation({
property: 'flex-shrink',
from: 'initial',
to: '2',
}, [
{at: -0.3, expect: '0.7'},
{at: 0, expect: '1'},
{at: 0.3, expect: '1.3'},
{at: 0.6, expect: '1.6'},
{at: 1, expect: '2'},
{at: 1.5, expect: '2.5'},
]);
test_interpolation({
property: 'flex-shrink',
from: 'inherit',
to: '2',
}, [
{at: -0.3, expect: '3.3'},
{at: 0, expect: '3'},
{at: 0.3, expect: '2.7'},
{at: 0.6, expect: '2.4'},
{at: 1, expect: '2'},
{at: 1.5, expect: '1.5'},
]);
test_interpolation({
property: 'flex-shrink',
from: 'unset',
to: '2',
}, [
{at: -0.3, expect: '0.7'},
{at: 0, expect: '1'},
{at: 0.3, expect: '1.3'},
{at: 0.6, expect: '1.6'},
{at: 1, expect: '2'},
{at: 1.5, expect: '2.5'},
]);
test_interpolation({
property: 'flex-shrink',
from: '1',
to: '2',
}, [
{at: -5, expect: '0'},
{at: -0.3, expect: '0.7'},
{at: 0, expect: '1'},
{at: 0.3, expect: '1.3'},
{at: 0.6, expect: '1.6'},
{at: 1, expect: '2'},
{at: 1.5, expect: '2.5'},
]);
test_interpolation({
property: 'flex-shrink',
from: '0',
to: '1',
}, [
{at: -5, expect: '0'},
{at: -0.3, expect: '0'},
{at: 0, expect: '0'},
{at: 0.3, expect: '0.3'},
{at: 0.6, expect: '0.6'},
{at: 1, expect: '1'},
{at: 1.5, expect: '1.5'},
]);
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment