mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'
This commit is contained in:
parent
35e95f55a1
commit
58e8ee674b
9438 changed files with 266112 additions and 106976 deletions
|
@ -25,6 +25,7 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/computed-testcommon.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
|
@ -34,134 +35,6 @@
|
|||
function startTesting()
|
||||
{
|
||||
|
||||
var targetElement = document.getElementById("target");
|
||||
|
||||
function compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description)
|
||||
{
|
||||
|
||||
test(function()
|
||||
{
|
||||
|
||||
targetElement.style.setProperty(property_name, "initial");
|
||||
|
||||
/*
|
||||
Since we are running many consecutive tests on the same
|
||||
element, then it is necessary to reset its property
|
||||
to an initial value before actually re-testing it.
|
||||
*/
|
||||
|
||||
targetElement.style.setProperty(property_name, calcValue);
|
||||
|
||||
var computedCalcValue = getComputedStyle(targetElement)[property_name];
|
||||
|
||||
/*
|
||||
We first strip out the word "matrix" with the
|
||||
opening parenthesis "(" and the closing
|
||||
parenthesis ")"
|
||||
*/
|
||||
|
||||
computedCalcValue = computedCalcValue.replace("matrix(", "").replace(")", "");
|
||||
|
||||
/*
|
||||
Then, we split the string at each comma ","
|
||||
and store the resulting 6 sub-strings into
|
||||
tableSplitComputedCalcValue
|
||||
*/
|
||||
|
||||
var tableSplitCalcValue = computedCalcValue.split(",");
|
||||
|
||||
/*
|
||||
We convert the 6 sub-strings into numerical floating values
|
||||
so that mathematical operations (substraction, absolute value,
|
||||
comparison) can be performed.
|
||||
*/
|
||||
|
||||
tableSplitCalcValue[0] = parseFloat(tableSplitCalcValue[0]);
|
||||
tableSplitCalcValue[1] = parseFloat(tableSplitCalcValue[1]);
|
||||
tableSplitCalcValue[2] = parseFloat(tableSplitCalcValue[2]);
|
||||
tableSplitCalcValue[3] = parseFloat(tableSplitCalcValue[3]);
|
||||
tableSplitCalcValue[4] = parseFloat(tableSplitCalcValue[4]);
|
||||
tableSplitCalcValue[5] = parseFloat(tableSplitCalcValue[5]);
|
||||
|
||||
/*
|
||||
Now, we execute the same steps with the expectedValue
|
||||
*/
|
||||
|
||||
targetElement.style.setProperty(property_name, expectedValue);
|
||||
|
||||
var computedExpectedValue = getComputedStyle(targetElement)[property_name];
|
||||
|
||||
/*
|
||||
We first strip out the word "matrix" with the
|
||||
opening parenthesis "(" and the closing
|
||||
parenthesis ")"
|
||||
*/
|
||||
|
||||
computedExpectedValue = computedExpectedValue.replace("matrix(", "").replace(")", "");
|
||||
|
||||
/*
|
||||
Then, we split the string at each comma ","
|
||||
and store the resulting 6 sub-strings into
|
||||
tableSplitComputedCalcValue
|
||||
*/
|
||||
|
||||
var tableSplitExpectedValue = computedExpectedValue.split(",");
|
||||
|
||||
/*
|
||||
We convert the 6 sub-strings into numerical floating values
|
||||
so that mathematical operations (substraction, absolute value,
|
||||
comparison) can be performed.
|
||||
*/
|
||||
|
||||
tableSplitExpectedValue[0] = parseFloat(tableSplitExpectedValue[0]);
|
||||
tableSplitExpectedValue[1] = parseFloat(tableSplitExpectedValue[1]);
|
||||
tableSplitExpectedValue[2] = parseFloat(tableSplitExpectedValue[2]);
|
||||
tableSplitExpectedValue[3] = parseFloat(tableSplitExpectedValue[3]);
|
||||
tableSplitExpectedValue[4] = parseFloat(tableSplitExpectedValue[4]);
|
||||
tableSplitExpectedValue[5] = parseFloat(tableSplitExpectedValue[5]);
|
||||
|
||||
assert_array_approx_equals(tableSplitCalcValue, tableSplitExpectedValue, epsilon);
|
||||
|
||||
/*
|
||||
In this mega-test of 27 sub-tests, we intentionally
|
||||
set the tolerance precision (epsilon) to a rather big
|
||||
value (0.0001 === 100 millionths). The reason for this
|
||||
is we want to verify if browsers and CSS-capable
|
||||
applications do the right calculations. We do not want
|
||||
to penalize browsers and CSS-capable applications that
|
||||
have modest precision (not capable of a 1 millionth
|
||||
level precision).
|
||||
*/
|
||||
|
||||
} , description);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
deg
|
||||
Degrees. There are 360 degrees in a full circle.
|
||||
|
||||
grad
|
||||
Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle.
|
||||
|
||||
rad
|
||||
Radians. There are 2π radians in a full circle.
|
||||
|
||||
1rad == 57.295779513°
|
||||
https://www.rapidtables.com/convert/number/radians-to-degrees.html
|
||||
|
||||
π == Math.PI == 3.141592653589793
|
||||
|
||||
turn
|
||||
Turns. There is 1 turn in a full circle.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* Addition of angle units */
|
||||
|
||||
|
||||
/* compareValueCloseTo(property_name, calcValue, epsilon, expectedValue, description) */
|
||||
|
||||
compareValueCloseTo("transform", "rotate(calc(45deg + 45deg))", 0.0001, "rotate(90deg)", "addition of 2 angle units: deg plus deg");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue