mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision 7c15d5b4e87b3a20ca2bc523b33303131510bc01
This commit is contained in:
parent
4ded3038c0
commit
e864d8823c
69 changed files with 561 additions and 403 deletions
|
@ -10,10 +10,12 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
setup({explicit_done: true});
|
||||
var shape_margin_valid_unit_tests = [];
|
||||
ParsingUtils.validUnits.forEach(function(unit) {
|
||||
test = "10"+unit;
|
||||
|
@ -25,10 +27,16 @@
|
|||
testCase["expected_computed"] = test;
|
||||
shape_margin_valid_unit_tests.push(testCase);
|
||||
});
|
||||
|
||||
generate_tests( ParsingUtils.testShapeMarginInlineStyle,
|
||||
ParsingUtils.buildTestCases(shape_margin_valid_unit_tests, "inline"), true);
|
||||
generate_tests( ParsingUtils.testShapeMarginComputedStyle,
|
||||
ParsingUtils.buildTestCases(shape_margin_valid_unit_tests, "computed"), true);
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
generate_tests( ParsingUtils.testShapeMarginComputedStyle,
|
||||
ParsingUtils.buildTestCases(shape_margin_valid_unit_tests, "computed"), true);
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,14 +13,21 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
setup({explicit_done: true});
|
||||
generate_tests( ParsingUtils.testInlineStyle,
|
||||
ParsingUtils.buildPositionTests("circle", true, 'lengthUnit + inline', ParsingUtils.validUnits) );
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildPositionTests("circle", true, 'lengthUnit + computed', ParsingUtils.validUnits) );
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildPositionTests("circle", true, 'lengthUnit + computed', ParsingUtils.validUnits) );
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,12 +12,19 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
setup({explicit_done: true});
|
||||
generate_tests(ParsingUtils.testInlineStyle, ParsingUtils.buildRadiiTests('circle', 'lengthUnit + inline', ParsingUtils.validUnits));
|
||||
generate_tests(ParsingUtils.testComputedStyle, ParsingUtils.buildRadiiTests('circle', 'lengthUnit + computed', ParsingUtils.validUnits));
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
generate_tests(ParsingUtils.testComputedStyle, ParsingUtils.buildRadiiTests('circle', 'lengthUnit + computed', ParsingUtils.validUnits));
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,14 +13,21 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
setup({explicit_done: true});
|
||||
generate_tests( ParsingUtils.testInlineStyle,
|
||||
ParsingUtils.buildPositionTests("ellipse", true, 'lengthUnit + inline', ParsingUtils.validUnits) );
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildPositionTests("ellipse", true, 'lengthUnit + computed', ParsingUtils.validUnits) );
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildPositionTests("ellipse", true, 'lengthUnit + computed', ParsingUtils.validUnits) );
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,12 +12,20 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
setup({explicit_done: true});
|
||||
generate_tests(ParsingUtils.testInlineStyle, ParsingUtils.buildRadiiTests('ellipse', 'lengthUnit + inline', ParsingUtils.validUnits));
|
||||
generate_tests(ParsingUtils.testComputedStyle, ParsingUtils.buildRadiiTests('ellipse', 'lengthUnit + computed', ParsingUtils.validUnits));
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
generate_tests(ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildRadiiTests('ellipse', 'lengthUnit + computed', ParsingUtils.validUnits));
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,15 +13,22 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
setup({explicit_done: true});
|
||||
ParsingUtils.validUnits.forEach(function(unit) {
|
||||
generate_tests(ParsingUtils.testInlineStyle, ParsingUtils.generateInsetRoundCases(unit, 'inline'));
|
||||
});
|
||||
ParsingUtils.validUnits.forEach(function(unit) {
|
||||
generate_tests(ParsingUtils.testComputedStyle, ParsingUtils.generateInsetRoundCases(unit, 'computed'));
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
ParsingUtils.validUnits.forEach(function(unit) {
|
||||
generate_tests(ParsingUtils.testComputedStyle, ParsingUtils.generateInsetRoundCases(unit, 'computed'));
|
||||
});
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -13,10 +13,12 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
setup({explicit_done: true});
|
||||
var arg_length_units_tests = [
|
||||
['%', 'px', 'px'],
|
||||
['px', '%', 'px'],
|
||||
|
@ -31,8 +33,13 @@
|
|||
];
|
||||
generate_tests( ParsingUtils.testInlineStyle,
|
||||
ParsingUtils.buildPolygonTests(arg_length_units_tests, 'inline') );
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildPolygonTests(arg_length_units_tests, 'computed') );
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildPolygonTests(arg_length_units_tests, 'computed') );
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/parsing-utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
@ -21,6 +22,7 @@
|
|||
// fixed units: cm, mm, in, px, pt, pc
|
||||
// percentage unit: %
|
||||
// zero length: 0
|
||||
setup({explicit_done: true});
|
||||
var basic_shape_args_tests = [
|
||||
{
|
||||
"name": "0-valued",
|
||||
|
@ -53,10 +55,17 @@
|
|||
"expected_computed": "polygon(1% 2%)"
|
||||
}
|
||||
];
|
||||
|
||||
generate_tests( ParsingUtils.testInlineStyle,
|
||||
ParsingUtils.buildTestCases(basic_shape_args_tests, "inline") );
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildTestCases(basic_shape_args_tests, "computed") );
|
||||
ParsingUtils.setupFonts();
|
||||
document.fonts.ready.then(()=> {
|
||||
generate_tests( ParsingUtils.testComputedStyle,
|
||||
ParsingUtils.buildTestCases(basic_shape_args_tests, "computed") );
|
||||
ParsingUtils.restoreFonts();
|
||||
done();
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -446,31 +446,32 @@ function each(object, func) {
|
|||
}
|
||||
}
|
||||
|
||||
function setupFonts(func) {
|
||||
return function () {
|
||||
var fontProperties = {
|
||||
'font-family': 'Ahem',
|
||||
'font-size': '16px',
|
||||
'line-height': '1'
|
||||
};
|
||||
var savedValues = { };
|
||||
each(fontProperties, function (key, value) {
|
||||
savedValues[key] = document.body.style.getPropertyValue(key);
|
||||
document.body.style.setProperty(key, value);
|
||||
});
|
||||
try {
|
||||
func.apply(this, arguments);
|
||||
} finally {
|
||||
each(savedValues, function (key, value) {
|
||||
if (value) {
|
||||
document.body.style.setProperty(key, value);
|
||||
}
|
||||
else {
|
||||
document.body.style.removeProperty(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
/// For saving and restoring font properties
|
||||
var savedFontValues = { };
|
||||
|
||||
function setupFonts() {
|
||||
var fontProperties = {
|
||||
'font-family': 'Ahem',
|
||||
'font-size': '16px',
|
||||
'line-height': '1'
|
||||
};
|
||||
savedFontValues = { };
|
||||
each(fontProperties, function (key, value) {
|
||||
savedFontValues[key] = document.body.style.getPropertyValue(key);
|
||||
document.body.style.setProperty(key, value);
|
||||
});
|
||||
}
|
||||
|
||||
function restoreFonts() {
|
||||
each(savedFontValues, function (key, value) {
|
||||
if (value) {
|
||||
document.body.style.setProperty(key, value);
|
||||
}
|
||||
else {
|
||||
document.body.style.removeProperty(key);
|
||||
}
|
||||
});
|
||||
savedFontValues = { };
|
||||
}
|
||||
|
||||
var validUnits = [
|
||||
|
@ -819,11 +820,11 @@ var calcTestValues = [
|
|||
|
||||
return {
|
||||
testInlineStyle: testInlineStyle,
|
||||
testComputedStyle: setupFonts(testComputedStyle),
|
||||
testComputedStyle: testComputedStyle,
|
||||
testShapeMarginInlineStyle: testShapeMarginInlineStyle,
|
||||
testShapeMarginComputedStyle: setupFonts(testShapeMarginComputedStyle),
|
||||
testShapeMarginComputedStyle: testShapeMarginComputedStyle,
|
||||
testShapeThresholdInlineStyle: testShapeThresholdInlineStyle,
|
||||
testShapeThresholdComputedStyle: setupFonts(testShapeThresholdComputedStyle),
|
||||
testShapeThresholdComputedStyle: testShapeThresholdComputedStyle,
|
||||
buildTestCases: buildTestCases,
|
||||
buildRadiiTests: buildRadiiTests,
|
||||
buildPositionTests: buildPositionTests,
|
||||
|
@ -834,6 +835,7 @@ return {
|
|||
validUnits: validUnits,
|
||||
calcTestValues: calcTestValues,
|
||||
roundResultStr: roundResultStr,
|
||||
setupFonts: setupFonts
|
||||
setupFonts: setupFonts,
|
||||
restoreFonts: restoreFonts,
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue