mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
0d460e3432
This is split from the previous changeset since if we include dom/ the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27457 --HG-- extra : moz-landing-system : lando
103 lines
3.5 KiB
HTML
103 lines
3.5 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>Test for Animation Behavior on CSS Properties</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="smilTestUtils.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
<svg id="svg" xmlns="http://www.w3.org/2000/svg">
|
|
</svg>
|
|
</div>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
<![CDATA[
|
|
/* This testcase verifies that animated values of "wider" and "narrower" for
|
|
"font-stretch" have the expected effect, across all possible inherited
|
|
values of the property.
|
|
XXXdholbert Currently, we don't support animating relative values of
|
|
font-stretch, so most of the tests here use todo_is() rather than is().
|
|
*/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
const gPropertyName="font-stretch";
|
|
|
|
// List of non-relative font-stretch values, from smallest to largest
|
|
const gFontStretchValues = [
|
|
["ultra-condensed", "50%"],
|
|
["extra-condensed", "62.5%"],
|
|
["condensed", "75%"],
|
|
["semi-condensed", "87.5%"],
|
|
["normal", "100%"],
|
|
["semi-expanded", "112.5%"],
|
|
["expanded", "125%"],
|
|
["extra-expanded", "150%"],
|
|
["ultra-expanded", "200%"],
|
|
];
|
|
|
|
function testFontStretchValue([baseValue, computedValue], [narrowerStep, computedNarrowerStep], [widerStep, computedWiderStep])
|
|
{
|
|
var svg = SMILUtil.getSVGRoot();
|
|
var gElem = document.createElementNS(SVG_NS, "g");
|
|
gElem.setAttribute("style", "font-stretch: " + baseValue);
|
|
svg.appendChild(gElem);
|
|
|
|
var textElem = document.createElementNS(SVG_NS, "text");
|
|
gElem.appendChild(textElem);
|
|
|
|
var animElem = document.createElementNS(SVG_NS, "set");
|
|
animElem.setAttribute("attributeName", gPropertyName);
|
|
animElem.setAttribute("attributeType", "CSS");
|
|
animElem.setAttribute("begin", "0s");
|
|
animElem.setAttribute("dur", "indefinite");
|
|
textElem.appendChild(animElem);
|
|
|
|
// CHECK EFFECT OF 'narrower'
|
|
// NOTE: Using is() instead of todo_is() for ultra-condensed, since
|
|
// 'narrower' has no effect on that value.
|
|
var myIs = (baseValue == "ultra-condensed" ? is : todo_is);
|
|
animElem.setAttribute("to", "narrower");
|
|
SMILUtil.getSVGRoot().setCurrentTime(1.0); // Force a resample
|
|
myIs(SMILUtil.getComputedStyleSimple(textElem, gPropertyName), computedNarrowerStep,
|
|
"checking effect of 'narrower' on inherited value '" + baseValue + "'");
|
|
|
|
// CHECK EFFECT OF 'wider'
|
|
// NOTE: using is() instead of todo_is() for ultra-expanded, since
|
|
// 'wider' has no effect on that value.
|
|
myIs = (baseValue == "ultra-expanded" ? is : todo_is);
|
|
animElem.setAttribute("to", "wider");
|
|
SMILUtil.getSVGRoot().setCurrentTime(1.0); // Force a resample
|
|
myIs(SMILUtil.getComputedStyleSimple(textElem, gPropertyName), computedWiderStep,
|
|
"checking effect of 'wider' on inherited value '" + baseValue + "'");
|
|
|
|
// Removing animation should clear animated effects
|
|
textElem.removeChild(animElem);
|
|
svg.removeChild(gElem);
|
|
}
|
|
|
|
function main()
|
|
{
|
|
var valuesList = gFontStretchValues;
|
|
for (var baseIdx in valuesList) {
|
|
// 'narrower' and 'wider' are expected to shift us by one slot, but not
|
|
// past the ends of the list of possible values.
|
|
var narrowerIdx = Math.max(baseIdx - 1, 0);
|
|
var widerIdx = Math.min(baseIdx + 1, valuesList.length - 1);
|
|
|
|
testFontStretchValue(valuesList[baseIdx],
|
|
valuesList[narrowerIdx], valuesList[widerIdx]);
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
window.addEventListener("load", main);
|
|
]]>
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|