Bug 1570314 [wpt PR 18201] - Do correct comparison for rtl tests, a=testonly

Automatic update from web-platform-tests
Do correct comparison for rtl tests (#18201)

Previously the comparison was not comparing padding with no padding
specified in rtl case. Fix this by splitting out the direction part.
--

wpt-commits: 1858b9082aa757fc91d3e7030b885ac108f320cf
wpt-pr: 18201
This commit is contained in:
Rob Buis 2019-08-06 16:35:41 +00:00 committed by moz-wptsync-bot
parent 118bc16d91
commit 92072128e2
4 changed files with 8 additions and 9 deletions

View File

@ -22,7 +22,6 @@
continue; continue;
var style = "border-left: 30px solid; border-right: 40px solid; border-top: 50px solid; border-bottom: 60px solid;"; var style = "border-left: 30px solid; border-right: 40px solid; border-top: 50px solid; border-bottom: 60px solid;";
var styleRTL = `direction: rtl; ${style}`;
if (FragmentHelper.isEmpty(tag)) { if (FragmentHelper.isEmpty(tag)) {
test(function() { test(function() {
@ -44,7 +43,7 @@
}, `Border properties on ${tag}`); }, `Border properties on ${tag}`);
test(function() { test(function() {
var s = compareSpaceWithAndWithoutStyle(tag, styleRTL); var s = compareSpaceWithAndWithoutStyle(tag, style, null, "rtl");
assert_approx_equals(s.left_delta, 30, epsilon, "left border"); assert_approx_equals(s.left_delta, 30, epsilon, "left border");
assert_approx_equals(s.right_delta, 40, epsilon, "right border"); assert_approx_equals(s.right_delta, 40, epsilon, "right border");
assert_approx_equals(s.top_delta, 50, epsilon, "top border"); assert_approx_equals(s.top_delta, 50, epsilon, "top border");

View File

@ -22,7 +22,6 @@
continue; continue;
var style = "margin-left: 30px; margin-right: 40px; margin-top: 50px; margin-bottom: 60px;"; var style = "margin-left: 30px; margin-right: 40px; margin-top: 50px; margin-bottom: 60px;";
var styleRTL = `direction: rtl; ${style}`;
if (FragmentHelper.isEmpty(tag)) { if (FragmentHelper.isEmpty(tag)) {
test(function() { test(function() {
@ -46,7 +45,7 @@
}, `Margin properties on ${tag}`); }, `Margin properties on ${tag}`);
test(function() { test(function() {
var s = compareSpaceWithAndWithoutStyle(tag, styleRTL); var s = compareSpaceWithAndWithoutStyle(tag, style, null, "rtl");
assert_approx_equals(s.left_delta, 30, epsilon, "left margin"); assert_approx_equals(s.left_delta, 30, epsilon, "left margin");
assert_approx_equals(s.right_delta, 40, epsilon, "right margin"); assert_approx_equals(s.right_delta, 40, epsilon, "right margin");
assert_approx_equals(s.top_delta, 50, epsilon, "top margin"); assert_approx_equals(s.top_delta, 50, epsilon, "top margin");

View File

@ -22,7 +22,6 @@
continue; continue;
var style = "padding-left: 30px; padding-right: 40px; padding-top: 50px; padding-bottom: 60px;"; var style = "padding-left: 30px; padding-right: 40px; padding-top: 50px; padding-bottom: 60px;";
var styleRTL = `direction: rtl; ${style}`;
if (FragmentHelper.isEmpty(tag)) { if (FragmentHelper.isEmpty(tag)) {
test(function() { test(function() {
@ -44,7 +43,7 @@
}, `Padding properties on ${tag}`); }, `Padding properties on ${tag}`);
test(function() { test(function() {
var s = compareSpaceWithAndWithoutStyle(tag, styleRTL); var s = compareSpaceWithAndWithoutStyle(tag, style, "rtl");
assert_approx_equals(s.left_delta, 30, epsilon, "left padding"); assert_approx_equals(s.left_delta, 30, epsilon, "left padding");
assert_approx_equals(s.right_delta, 40, epsilon, "right padding"); assert_approx_equals(s.right_delta, 40, epsilon, "right padding");
assert_approx_equals(s.top_delta, 50, epsilon, "top padding"); assert_approx_equals(s.top_delta, 50, epsilon, "top padding");

View File

@ -15,14 +15,16 @@ function measureSpaceAround(id) {
return spaceBetween(childBox, parentBox); return spaceBetween(childBox, parentBox);
} }
function compareSpaceWithAndWithoutStyle(tag, style, parentStyle) { function compareSpaceWithAndWithoutStyle(tag, style, parentStyle, direction) {
if (!FragmentHelper.isValidChildOfMrow(tag) || if (!FragmentHelper.isValidChildOfMrow(tag) ||
FragmentHelper.isEmpty(tag)) FragmentHelper.isEmpty(tag))
throw `Invalid argument: ${tag}`; throw `Invalid argument: ${tag}`;
if (!direction)
direction = "ltr";
document.body.insertAdjacentHTML("beforeend", `<div>\ document.body.insertAdjacentHTML("beforeend", `<div>\
<math><mrow>${MathMLFragments[tag]}</mrow></math>\ <math><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math>\
<math><mrow>${MathMLFragments[tag]}</mrow></math>\ <math><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math>\
</div>`); </div>`);
var div = document.body.lastElementChild; var div = document.body.lastElementChild;