Commit 04740cc9 authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Port outline-*-interpolation.html to WPT

Bug: 900581
Change-Id: I40b7d6f983d37726b843e82ad5ba794cec9c1214
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768666Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690330}
parent 02e3684b
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
outline-color: yellow;
}
.target {
width: 50px;
height: 50px;
background-color: black;
display: inline-block;
outline: 12px solid white;
margin: 12px 12px;
outline-color: blue;
}
.expected {
background-color: lime;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'outline-color',
from: neutralKeyframe,
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 255)'},
{at: 0, is: 'rgb(0, 0, 255)'},
{at: 0.3, is: 'rgb(0, 38, 179)'},
{at: 0.6, is: 'rgb(0, 77, 102)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'outline-color',
from: 'initial',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 0)'},
{at: 0, is: 'rgb(0, 0, 0)'},
{at: 0.3, is: 'rgb(0, 38, 0)'},
{at: 0.6, is: 'rgb(0, 77, 0)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'outline-color',
from: 'inherit',
to: 'green',
}, [
{at: -0.3, is: 'rgb(255, 255, 0)'},
{at: 0, is: 'rgb(255, 255, 0)'},
{at: 0.3, is: 'rgb(179, 217, 0)'},
{at: 0.6, is: 'rgb(102, 179, 0)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 65, 0)'},
]);
assertInterpolation({
property: 'outline-color',
from: 'unset',
to: 'green',
}, [
{at: -0.3, is: 'rgb(0, 0, 0)'},
{at: 0, is: 'rgb(0, 0, 0)'},
{at: 0.3, is: 'rgb(0, 38, 0)'},
{at: 0.6, is: 'rgb(0, 77, 0)'},
{at: 1, is: 'rgb(0, 128, 0)'},
{at: 1.5, is: 'rgb(0, 192, 0)'},
]);
assertInterpolation({
property: 'outline-color',
from: 'white',
to: 'orange'
}, [
{at: -0.3, is: 'white'},
{at: 0, is: 'white'},
{at: 0.3, is: 'rgb(255, 228, 179)'},
{at: 0.6, is: 'rgb(255, 201, 102)'},
{at: 1, is: 'orange'},
{at: 1.5, is: 'rgb(255, 120, 0)'},
]);
</script>
</body>
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
outline: solid transparent;
outline-width: 30px;
}
.target {
width: 50px;
height: 50px;
background-color: black;
display: inline-block;
margin: 18px;
outline: solid orange;
outline-width: 10px;
opacity: 0.5;
}
.expected {
background-color: green;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'outline-width',
from: neutralKeyframe,
to: '20px',
}, [
{at: -0.3, is: '7px'},
{at: 0, is: '10px'},
{at: 0.3, is: '13px'},
{at: 0.6, is: '16px'},
{at: 1, is: '20px'},
{at: 1.5, is: '25px'},
]);
assertInterpolation({
property: 'outline-width',
from: 'initial',
to: '20px',
}, [
{at: -0.3, is: '0px'},
{at: 0, is: '3px'},
{at: 0.3, is: '8px'},
{at: 0.6, is: '13px'},
{at: 1, is: '20px'},
{at: 1.5, is: '28px'},
]);
assertInterpolation({
property: 'outline-width',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, is: '33px'},
{at: 0, is: '30px'},
{at: 0.3, is: '27px'},
{at: 0.6, is: '24px'},
{at: 1, is: '20px'},
{at: 1.5, is: '15px'},
]);
assertInterpolation({
property: 'outline-width',
from: 'unset',
to: '20px',
}, [
{at: -0.3, is: '0px'},
{at: 0, is: '3px'},
{at: 0.3, is: '8px'},
{at: 0.6, is: '13px'},
{at: 1, is: '20px'},
{at: 1.5, is: '28px'},
]);
assertInterpolation({
property: 'outline-width',
from: '0px',
to: '10px',
}, [
{at: -0.3, is: '0px'}, // CSS outline-width can't be negative.
{at: 0, is: '0px'},
{at: 0.3, is: '3px'},
{at: 0.6, is: '6px'},
{at: 1, is: '10px'},
{at: 1.5, is: '15px'}
]);
assertInterpolation({
property: 'outline-width',
from: 'thick',
to: '15px',
}, [
{at: -2, is: '0px'}, // CSS outline-width can't be negative.
{at: -0.3, is: '2px'},
{at: 0, is: '5px'},
{at: 0.3, is: '8px'},
{at: 0.6, is: '11px'},
{at: 1, is: '15px'},
{at: 1.5, is: '20px'}
]);
</script>
</body>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>outline-color interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#outline-color">
<meta name="assert" content="outline-color supports animation by computed value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
outline-color: yellow;
}
.target {
width: 50px;
height: 50px;
background-color: black;
display: inline-block;
outline: 12px solid white;
margin: 12px 12px;
outline-color: blue;
}
.expected {
background-color: lime;
}
</style>
<body></body>
<script>
test_interpolation({
property: 'outline-color',
from: neutralKeyframe,
to: 'green',
}, [
{at: -0.3, expect: 'rgb(0, 0, 255)'},
{at: 0, expect: 'rgb(0, 0, 255)'},
{at: 0.3, expect: 'rgb(0, 38, 179)'},
{at: 0.6, expect: 'rgb(0, 77, 102)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 192, 0)'},
]);
test_interpolation({
property: 'outline-color',
from: 'initial',
to: 'green',
}, [
{at: -0.3, expect: 'rgb(0, 0, 0)'},
{at: 0, expect: 'rgb(0, 0, 0)'},
{at: 0.3, expect: 'rgb(0, 38, 0)'},
{at: 0.6, expect: 'rgb(0, 77, 0)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 192, 0)'},
]);
test_interpolation({
property: 'outline-color',
from: 'inherit',
to: 'green',
}, [
{at: -0.3, expect: 'rgb(255, 255, 0)'},
{at: 0, expect: 'rgb(255, 255, 0)'},
{at: 0.3, expect: 'rgb(179, 217, 0)'},
{at: 0.6, expect: 'rgb(102, 179, 0)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 65, 0)'},
]);
test_interpolation({
property: 'outline-color',
from: 'unset',
to: 'green',
}, [
{at: -0.3, expect: 'rgb(0, 0, 0)'},
{at: 0, expect: 'rgb(0, 0, 0)'},
{at: 0.3, expect: 'rgb(0, 38, 0)'},
{at: 0.6, expect: 'rgb(0, 77, 0)'},
{at: 1, expect: 'rgb(0, 128, 0)'},
{at: 1.5, expect: 'rgb(0, 192, 0)'},
]);
test_interpolation({
property: 'outline-color',
from: 'white',
to: 'orange'
}, [
{at: -0.3, expect: 'white'},
{at: 0, expect: 'white'},
{at: 0.3, expect: 'rgb(255, 228, 179)'},
{at: 0.6, expect: 'rgb(255, 201, 102)'},
{at: 1, expect: 'orange'},
{at: 1.5, expect: 'rgb(255, 120, 0)'},
]);
</script>
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>outline-offset interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#outline-offset">
<meta name="assert" content="outline-offset supports animation by computed value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style> <style>
.parent { .parent {
outline: solid 0px; outline: solid 0px;
...@@ -19,72 +27,72 @@ ...@@ -19,72 +27,72 @@
margin-right: 18px; margin-right: 18px;
} }
</style> </style>
<body>
<script src="resources/interpolation-test.js"></script> <body></body>
<script> <script>
assertInterpolation({ test_interpolation({
property: 'outline-offset', property: 'outline-offset',
from: neutralKeyframe, from: neutralKeyframe,
to: '20px', to: '20px',
}, [ }, [
{at: -0.3, is: '7px'}, {at: -0.3, expect: '7px'},
{at: 0, is: '10px'}, {at: 0, expect: '10px'},
{at: 0.3, is: '13px'}, {at: 0.3, expect: '13px'},
{at: 0.6, is: '16px'}, {at: 0.6, expect: '16px'},
{at: 1, is: '20px'}, {at: 1, expect: '20px'},
{at: 1.5, is: '25px'}, {at: 1.5, expect: '25px'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'outline-offset', property: 'outline-offset',
from: 'initial', from: 'initial',
to: '20px', to: '20px',
}, [ }, [
{at: -0.3, is: '-6px'}, {at: -0.3, expect: '-6px'},
{at: 0, is: '0px'}, {at: 0, expect: '0px'},
{at: 0.3, is: '6px'}, {at: 0.3, expect: '6px'},
{at: 0.6, is: '12px'}, {at: 0.6, expect: '12px'},
{at: 1, is: '20px'}, {at: 1, expect: '20px'},
{at: 1.5, is: '30px'}, {at: 1.5, expect: '30px'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'outline-offset', property: 'outline-offset',
from: 'inherit', from: 'inherit',
to: '20px', to: '20px',
}, [ }, [
{at: -0.3, is: '33px'}, {at: -0.3, expect: '33px'},
{at: 0, is: '30px'}, {at: 0, expect: '30px'},
{at: 0.3, is: '27px'}, {at: 0.3, expect: '27px'},
{at: 0.6, is: '24px'}, {at: 0.6, expect: '24px'},
{at: 1, is: '20px'}, {at: 1, expect: '20px'},
{at: 1.5, is: '15px'}, {at: 1.5, expect: '15px'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'outline-offset', property: 'outline-offset',
from: 'unset', from: 'unset',
to: '20px', to: '20px',
}, [ }, [
{at: -0.3, is: '-6px'}, {at: -0.3, expect: '-6px'},
{at: 0, is: '0px'}, {at: 0, expect: '0px'},
{at: 0.3, is: '6px'}, {at: 0.3, expect: '6px'},
{at: 0.6, is: '12px'}, {at: 0.6, expect: '12px'},
{at: 1, is: '20px'}, {at: 1, expect: '20px'},
{at: 1.5, is: '30px'}, {at: 1.5, expect: '30px'},
]); ]);
assertInterpolation({ test_interpolation({
property: 'outline-offset', property: 'outline-offset',
from: '-5px', from: '-5px',
to: '5px', to: '5px',
}, [ }, [
{at: -0.3, is: '-8px'}, {at: -0.3, expect: '-8px'},
{at: 0, is: '-5px'}, {at: 0, expect: '-5px'},
{at: 0.3, is: '-2px'}, {at: 0.3, expect: '-2px'},
{at: 0.6, is: '1px'}, {at: 0.6, expect: '1px'},
{at: 1, is: '5px'}, {at: 1, expect: '5px'},
{at: 1.5, is: '10px'}, {at: 1.5, expect: '10px'},
]); ]);
</script> </script>
</body>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>outline-width interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#outline-width">
<meta name="assert" content="outline-width supports animation by computed value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
outline: solid transparent;
outline-width: 30px;
}
.target {
width: 50px;
height: 50px;
background-color: black;
display: inline-block;
margin: 18px;
outline: solid orange;
outline-width: 10px;
opacity: 0.5;
}
.expected {
background-color: green;
}
</style>
<body></body>
<script>
// NOTE: The below tests make assumptions about the values of medium (for unset
// and initial) and thick, namely that:
// * medium=3px
// * thick=3px
//
// A better version of these tests would dynamically generate the expected values
// by querying the computed style from the UA.
test_interpolation({
property: 'outline-width',
from: neutralKeyframe,
to: '20px',
}, [
{at: -0.3, expect: '7px'},
{at: 0, expect: '10px'},
{at: 0.3, expect: '13px'},
{at: 0.6, expect: '16px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '25px'},
]);
test_interpolation({
property: 'outline-width',
from: 'initial',
to: '20px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '3px'},
{at: 0.3, expect: '8px'},
{at: 0.6, expect: '13px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '28px'},
]);
test_interpolation({
property: 'outline-width',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, expect: '33px'},
{at: 0, expect: '30px'},
{at: 0.3, expect: '27px'},
{at: 0.6, expect: '24px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '15px'},
]);
test_interpolation({
property: 'outline-width',
from: 'unset',
to: '20px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '3px'},
{at: 0.3, expect: '8px'},
{at: 0.6, expect: '13px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '28px'},
]);
test_interpolation({
property: 'outline-width',
from: '0px',
to: '10px',
}, [
{at: -0.3, expect: '0px'}, // CSS outline-width can't be negative.
{at: 0, expect: '0px'},
{at: 0.3, expect: '3px'},
{at: 0.6, expect: '6px'},
{at: 1, expect: '10px'},
{at: 1.5, expect: '15px'}
]);
test_interpolation({
property: 'outline-width',
from: 'thick',
to: '15px',
}, [
{at: -2, expect: '0px'}, // CSS outline-width can't be negative.
{at: -0.3, expect: '2px'},
{at: 0, expect: '5px'},
{at: 0.3, expect: '8px'},
{at: 0.6, expect: '11px'},
{at: 1, expect: '15px'},
{at: 1.5, expect: '20px'}
]);
</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