Commit f92c40b2 authored by haozhe's avatar haozhe Committed by Commit Bot

Port line-height-interpolation.html to wpt

Chrome pass and firefox failed 4 tests
Bug report filed: https://bugzilla.mozilla.org/show_bug.cgi?id=1593813

Bug: 900581
Change-Id: I52f133b6662fda4a5342a630307cc761a922c898
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1887231Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Hao Sheng <haozhes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716159}
parent 9aff2ab3
......@@ -22,118 +22,7 @@
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'line-height',
from: neutralKeyframe,
to: '20px',
}, [
{at: -1, is: '0px'},
{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: 'line-height',
from: 'initial',
to: '20px',
});
assertInterpolation({
property: 'line-height',
from: 'inherit',
to: '20px',
}, [
{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'},
]);
assertInterpolation({
property: 'line-height',
from: 'unset',
to: '20px',
}, [
{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'},
]);
assertInterpolation({
property: 'line-height',
from: '4',
to: '14',
}, [
{at: -1, is: '0'},
{at: -0.3, is: '1'},
{at: 0, is: '4'},
{at: 0.3, is: '7'},
{at: 0.6, is: '10'},
{at: 1, is: '14'},
{at: 1.5, is: '19'},
]);
assertInterpolation({
property: 'line-height',
from: '4px',
to: '14px',
}, [
{at: -1, is: '0px'},
{at: -0.3, is: '1px'},
{at: 0, is: '4px'},
{at: 0.3, is: '7px'},
{at: 0.6, is: '10px'},
{at: 1, is: '14px'},
{at: 1.5, is: '19px'},
]);
assertInterpolation({
property: 'line-height',
from: 'normal',
to: 'normal',
}, [
{at: -0.3, is: 'normal'},
{at: 0, is: 'normal'},
{at: 0.3, is: 'normal'},
{at: 0.6, is: 'normal'},
{at: 1, is: 'normal'},
{at: 1.5, is: 'normal'},
]);
assertNoInterpolation({
property: 'line-height',
from: '4',
to: '14px',
});
assertNoInterpolation({
property: 'line-height',
from: '14px',
to: 'normal',
});
assertNoInterpolation({
property: 'line-height',
from: 'normal',
to: '4',
});
assertNoInterpolation({
property: 'line-height',
from: '4',
to: 'normal',
});
assertNoInterpolation({
property: 'line-height',
from: 'normal',
to: '14px',
});
assertNoInterpolation({
property: 'line-height',
from: '14px',
to: '4',
});
// content_shell --run-web-tests uses a viewport of 800x600.
assertInterpolation({
property: 'line-height',
from: '4vw',
......@@ -147,7 +36,6 @@ assertInterpolation({
{at: 1, is: '14vw'},
{at: 1.5, is: '19vw'},
]);
// content_shell --run-web-tests uses a viewport of 800x600.
assertInterpolation({
property: 'line-height',
from: '50vmin',
......@@ -184,34 +72,6 @@ assertInterpolation({
{at: 1, is: '150px'},
{at: 1.5, is: '0px'}, // line-height must not be less than 0.
]);
assertNoInterpolation({
property: 'line-height',
from: '4',
to: '14q',
});
assertInterpolation({
property: 'line-height',
from: '4q',
to: '14q',
}, [
{at: -1, is: '0q'},
{at: -0.3, is: '1q'},
{at: 0, is: '4q'},
{at: 0.3, is: '7q'},
{at: 0.6, is: '10q'},
{at: 1, is: '14q'},
{at: 1.5, is: '19q'},
]);
assertNoInterpolation({
property: 'line-height',
from: '14q',
to: 'normal',
});
</script>
</body>
<!DOCTYPE html>
<meta charset="UTF-8">
<title>line-height interpolation</title>
<link rel="help" href="https://www.w3.org/TR/CSS2/visudet.html#propdef-line-height">
<meta name="assert" content="line-height supports animation by computation">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
line-height: 30px;
}
.target {
display: inline-block;
font: 20px sans-serif;
line-height: 10px;
}
.expected {
color: green;
margin-right: 30px;
}
</style>
<body>
<template id="target-template">
<p>
v<br />v
</p>
</template>
</body>
<script>
test_interpolation({
property: 'line-height',
from: neutralKeyframe,
to: '20px',
}, [
{at: -1, expect: '0px'},
{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: 'line-height',
from: 'initial',
to: '20px',
});
test_interpolation({
property: 'line-height',
from: 'inherit',
to: '20px',
}, [
{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_interpolation({
property: 'line-height',
from: 'unset',
to: '20px',
}, [
{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_interpolation({
property: 'line-height',
from: '4',
to: '14',
}, [
{at: -1, expect: '0'},
{at: -0.3, expect: '1'},
{at: 0, expect: '4'},
{at: 0.3, expect: '7'},
{at: 0.6, expect: '10'},
{at: 1, expect: '14'},
{at: 1.5, expect: '19'},
]);
test_interpolation({
property: 'line-height',
from: '4px',
to: '14px',
}, [
{at: -1, expect: '0px'},
{at: -0.3, expect: '1px'},
{at: 0, expect: '4px'},
{at: 0.3, expect: '7px'},
{at: 0.6, expect: '10px'},
{at: 1, expect: '14px'},
{at: 1.5, expect: '19px'},
]);
test_interpolation({
property: 'line-height',
from: 'normal',
to: 'normal',
}, [
{at: -0.3, expect: 'normal'},
{at: 0, expect: 'normal'},
{at: 0.3, expect: 'normal'},
{at: 0.6, expect: 'normal'},
{at: 1, expect: 'normal'},
{at: 1.5, expect: 'normal'},
]);
test_no_interpolation({
property: 'line-height',
from: '4',
to: '14px',
});
test_no_interpolation({
property: 'line-height',
from: '14px',
to: 'normal',
});
test_no_interpolation({
property: 'line-height',
from: 'normal',
to: '4',
});
test_no_interpolation({
property: 'line-height',
from: '4',
to: 'normal',
});
test_no_interpolation({
property: 'line-height',
from: 'normal',
to: '14px',
});
test_no_interpolation({
property: 'line-height',
from: '14px',
to: '4',
});
test_no_interpolation({
property: 'line-height',
from: '4',
to: '14q',
});
test_interpolation({
property: 'line-height',
from: '4q',
to: '14q',
}, [
{at: -1, expect: '0q'},
{at: -0.3, expect: '1q'},
{at: 0, expect: '4q'},
{at: 0.3, expect: '7q'},
{at: 0.6, expect: '10q'},
{at: 1, expect: '14q'},
{at: 1.5, expect: '19q'},
]);
test_no_interpolation({
property: 'line-height',
from: '14q',
to: 'normal',
});
</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