Commit b79915ca authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Port some css-multicol interpolation tests to WPT

Bug: 900581
Change-Id: Ia92d41788e13e7fb496b3e426d54622320f137cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1769306Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690821}
parent 7b95a2a5
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
column-count: 2;
column-rule-color: rgb(70, 70, 170);
}
.target {
column-count: 2;
color: rgb(70, 170, 70);
column-rule-color: rgb(170, 70, 70);
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'column-rule-color',
from: neutralKeyframe,
to: 'rgb(70, 170, 70)',
}, [
{at: -0.5, is: 'rgb(220, 20, 70)'},
{at: 0, is: 'rgb(170, 70, 70)'},
{at: 0.3, is: 'rgb(140, 100, 70)'},
{at: 0.6, is: 'rgb(110, 130, 70)'},
{at: 1, is: 'rgb(70, 170, 70)'},
{at: 1.5, is: 'rgb(20, 220, 70)'},
]);
assertInterpolation({
property: 'column-rule-color',
from: 'initial',
to: 'rgb(70, 70, 170)',
}, [
{at: -0.5, is: 'rgb(70, 220, 20)'},
{at: 0, is: 'rgb(70, 170, 70)'},
{at: 0.3, is: 'rgb(70, 140, 100)'},
{at: 0.6, is: 'rgb(70, 110, 130)'},
{at: 1, is: 'rgb(70, 70, 170)'},
{at: 1.5, is: 'rgb(70, 20, 220)'},
]);
assertInterpolation({
property: 'column-rule-color',
from: 'inherit',
to: 'rgb(70, 170, 70)',
}, [
{at: -0.5, is: 'rgb(70, 20, 220)'},
{at: 0, is: 'rgb(70, 70, 170)'},
{at: 0.3, is: 'rgb(70, 100, 140)'},
{at: 0.6, is: 'rgb(70, 130, 110)'},
{at: 1, is: 'rgb(70, 170, 70)'},
{at: 1.5, is: 'rgb(70, 220, 20)'},
]);
assertInterpolation({
property: 'column-rule-color',
from: 'currentcolor',
to: 'rgb(170, 70, 70)',
}, [
{at: -0.5, is: 'rgb(20, 220, 70)'},
{at: 0, is: 'rgb(70, 170, 70)'},
{at: 0.3, is: 'rgb(100, 140, 70)'},
{at: 0.6, is: 'rgb(130, 110, 70)'},
{at: 1, is: 'rgb(170, 70, 70)'},
{at: 1.5, is: 'rgb(220, 20, 70)'},
]);
</script>
</body>
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
column-rule-width: 30px;
}
.target {
column-rule-width: 10px;
}
</style>
<body>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'column-rule-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: 'column-rule-width',
from: 'initial',
to: '20px',
}, [
{at: -0.3, is: '0px'},
{at: 0, is: '3px'},
{at: 0.3, is: '8.1px'},
{at: 0.6, is: '13.2px'},
{at: 1, is: '20px'},
{at: 1.5, is: '28.5px'},
]);
assertInterpolation({
property: 'column-rule-width',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, is: '0px'},
{at: 0, is: '0px'},
{at: 0.3, is: '6px'},
{at: 0.6, is: '12px'},
{at: 1, is: '20px'},
{at: 1.5, is: '30px'},
]);
assertInterpolation({
property: 'column-rule-width',
from: 'unset',
to: '20px',
}, [
{at: -0.3, is: '0px'},
{at: 0, is: '3px'},
{at: 0.3, is: '8.1px'},
{at: 0.6, is: '13.2px'},
{at: 1, is: '20px'},
{at: 1.5, is: '28.5px'},
]);
assertInterpolation({
property: 'column-rule-width',
from: '0px',
to: '10px'
}, [
{at: -0.3, is: '0px'}, // CSS column-rule-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: 'column-rule-width',
from: '15px',
to: 'thick'
}, [
{at: -2, is: '35px'},
{at: -0.3, is: '18px'},
{at: 0, is: '15px'},
{at: 0.3, is: '12px'},
{at: 0.6, is: '9px'},
{at: 1, is: '5px'},
{at: 1.5, is: '0px'}
]);
</script>
</body>
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
column-width: 30px;
}
.target {
font-size: 0px; // column-width "specified values must be greater than 0", so use font-size to achieve 0px computed value.
display: inline-block;
column-width: 10px;
}
</style>
<body>
<template id="target-template">
<div><div class="transformed"></div></div>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'column-width',
from: neutralKeyframe,
to: '20px',
}, [
{at: -20, is: '1em'}, // column-width does not accept negative values
{at: -1, is: '1em'}, // column-width does not accept negative values
{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'},
]);
assertNoInterpolation({
property: 'column-width',
from: 'initial',
to: '20px',
});
assertInterpolation({
property: 'column-width',
from: 'inherit',
to: '20px',
}, [
{at: -20, is: '230px'},
{at: -1, is: '40px'},
{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'},
]);
assertNoInterpolation({
property: 'column-width',
from: 'unset',
to: '20px',
});
assertInterpolation({
property: 'column-width',
from: '50px',
to: '100px',
}, [
{at: -20, is: '1em'}, // column-width does not accept negative values
{at: -1, is: '1em'}, // column-width does not accept negative values
{at: -0.3, is: '35px'},
{at: 0, is: '50px'},
{at: 0.3, is: '65px'},
{at: 0.6, is: '80px'},
{at: 1, is: '100px'},
{at: 1.5, is: '125px'},
]);
assertNoInterpolation({
property: 'column-width',
from: '50px',
to: 'auto',
});
</script>
</body>
<!DOCTYPE html>
<body>
<meta charset="UTF-8">
<title>column-count interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#cc">
<meta name="assert" content="column-count 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 {
column-count: 30;
......@@ -8,51 +16,53 @@
column-count: 10;
}
</style>
<script src="resources/interpolation-test.js"></script>
<body></body>
<script>
assertInterpolation({
test_interpolation({
property: 'column-count',
from: neutralKeyframe,
to: '20',
}, [
{at: -0.5, is: '5'},
{at: 0, is: '10'},
{at: 0.3, is: '13'},
{at: 0.7, is: '17'},
{at: 1, is: '20'},
{at: 1.5, is: '25'},
{at: -0.5, expect: '5'},
{at: 0, expect: '10'},
{at: 0.3, expect: '13'},
{at: 0.7, expect: '17'},
{at: 1, expect: '20'},
{at: 1.5, expect: '25'},
]);
assertNoInterpolation({
test_no_interpolation({
property: 'column-count',
from: 'auto',
to: '20',
});
assertInterpolation({
test_interpolation({
property: 'column-count',
from: 'inherit',
to: '20',
}, [
{at: -0.5, is: '35'},
{at: 0, is: '30'},
{at: 0.3, is: '27'},
{at: 0.7, is: '23'},
{at: 1, is: '20'},
{at: 1.5, is: '15'},
{at: -0.5, expect: '35'},
{at: 0, expect: '30'},
{at: 0.3, expect: '27'},
{at: 0.7, expect: '23'},
{at: 1, expect: '20'},
{at: 1.5, expect: '15'},
]);
assertInterpolation({
test_interpolation({
property: 'column-count',
from: '10',
to: '1'
}, [
{at: -0.5, is: '15'},
{at: 0, is: '10'},
{at: 0.3, is: '7'},
{at: 0.7, is: '4'},
{at: -0.5, expect: '15'},
{at: 0, expect: '10'},
{at: 0.3, expect: '7'},
{at: 0.7, expect: '4'},
// Only positive integers are valid
{at: 1, is: '1'},
{at: 1.5, is: '1'}
{at: 1, expect: '1'},
{at: 1.5, expect: '1'}
]);
</script>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>column-rule-color interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#crc">
<meta name="assert" content="column-rule-color 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>
.parent {
column-count: 2;
column-rule-color: rgb(70, 70, 170);
}
.target {
column-count: 2;
color: rgb(70, 170, 70);
column-rule-color: rgb(170, 70, 70);
}
</style>
<body></body>
<script>
test_interpolation({
property: 'column-rule-color',
from: neutralKeyframe,
to: 'rgb(70, 170, 70)',
}, [
{at: -0.5, expect: 'rgb(220, 20, 70)'},
{at: 0, expect: 'rgb(170, 70, 70)'},
{at: 0.3, expect: 'rgb(140, 100, 70)'},
{at: 0.6, expect: 'rgb(110, 130, 70)'},
{at: 1, expect: 'rgb(70, 170, 70)'},
{at: 1.5, expect: 'rgb(20, 220, 70)'},
]);
test_interpolation({
property: 'column-rule-color',
from: 'initial',
to: 'rgb(70, 70, 170)',
}, [
{at: -0.5, expect: 'rgb(70, 220, 20)'},
{at: 0, expect: 'rgb(70, 170, 70)'},
{at: 0.3, expect: 'rgb(70, 140, 100)'},
{at: 0.6, expect: 'rgb(70, 110, 130)'},
{at: 1, expect: 'rgb(70, 70, 170)'},
{at: 1.5, expect: 'rgb(70, 20, 220)'},
]);
test_interpolation({
property: 'column-rule-color',
from: 'inherit',
to: 'rgb(70, 170, 70)',
}, [
{at: -0.5, expect: 'rgb(70, 20, 220)'},
{at: 0, expect: 'rgb(70, 70, 170)'},
{at: 0.3, expect: 'rgb(70, 100, 140)'},
{at: 0.6, expect: 'rgb(70, 130, 110)'},
{at: 1, expect: 'rgb(70, 170, 70)'},
{at: 1.5, expect: 'rgb(70, 220, 20)'},
]);
test_interpolation({
property: 'column-rule-color',
from: 'currentcolor',
to: 'rgb(170, 70, 70)',
}, [
{at: -0.5, expect: 'rgb(20, 220, 70)'},
{at: 0, expect: 'rgb(70, 170, 70)'},
{at: 0.3, expect: 'rgb(100, 140, 70)'},
{at: 0.6, expect: 'rgb(130, 110, 70)'},
{at: 1, expect: 'rgb(170, 70, 70)'},
{at: 1.5, expect: 'rgb(220, 20, 70)'},
]);
</script>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>column-rule-width interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#crw">
<meta name="assert" content="column-rule-width 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>
.parent {
column-rule-width: 30px;
}
.target {
column-rule-width: 10px;
}
</style>
<body></body>
<script>
test_interpolation({
property: 'column-rule-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: 'column-rule-width',
from: 'initial',
to: '20px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '3px'},
{at: 0.3, expect: '8.1px'},
{at: 0.6, expect: '13.2px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '28.5px'},
]);
test_interpolation({
property: 'column-rule-width',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '0px'},
{at: 0.3, expect: '6px'},
{at: 0.6, expect: '12px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '30px'},
]);
test_interpolation({
property: 'column-rule-width',
from: 'unset',
to: '20px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '3px'},
{at: 0.3, expect: '8.1px'},
{at: 0.6, expect: '13.2px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '28.5px'},
]);
test_interpolation({
property: 'column-rule-width',
from: '0px',
to: '10px'
}, [
{at: -0.3, expect: '0px'}, // CSS column-rule-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: 'column-rule-width',
from: '15px',
to: 'thick'
}, [
{at: -2, expect: '35px'},
{at: -0.3, expect: '18px'},
{at: 0, expect: '15px'},
{at: 0.3, expect: '12px'},
{at: 0.6, expect: '9px'},
{at: 1, expect: '5px'},
{at: 1.5, expect: '0px'}
]);
</script>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>column-width interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-multicol-1/#cw">
<meta name="assert" content="column-width 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>
.parent {
column-width: 30px;
}
.target {
font-size: 0px; /* column-width "specified values must be greater than 0", so use font-size to achieve 0px computed value. */
display: inline-block;
column-width: 10px;
}
</style>
<body>
<template id="target-template">
<div><div class="transformed"></div></div>
</template>
</body>
<script>
test_interpolation({
property: 'column-width',
from: neutralKeyframe,
to: '20px',
}, [
{at: -20, expect: '1em'}, // column-width does not accept negative values
{at: -1, expect: '1em'}, // column-width does not accept negative values
{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_no_interpolation({
property: 'column-width',
from: 'initial',
to: '20px',
});
test_interpolation({
property: 'column-width',
from: 'inherit',
to: '20px',
}, [
{at: -20, expect: '230px'},
{at: -1, expect: '40px'},
{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_no_interpolation({
property: 'column-width',
from: 'unset',
to: '20px',
});
test_interpolation({
property: 'column-width',
from: '50px',
to: '100px',
}, [
{at: -20, expect: '1em'}, // column-width does not accept negative values
{at: -1, expect: '1em'}, // column-width does not accept negative values
{at: -0.3, expect: '35px'},
{at: 0, expect: '50px'},
{at: 0.3, expect: '65px'},
{at: 0.6, expect: '80px'},
{at: 1, expect: '100px'},
{at: 1.5, expect: '125px'},
]);
test_no_interpolation({
property: 'column-width',
from: '50px',
to: 'auto',
});
</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