-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1568555 [wpt PR 18046] - MathML: Add tests for padding / margin /…
… border-width, a=testonly Automatic update from web-platform-tests MathML: Add tests for padding / margin / border-width (#18046) These are very basic tests to check support for w3c/mathml#14 Put in a dedicated folder since it's likely that we need a more lot tests. -- wpt-commits: b9480320a5775a8cbb28725246070273c20cdf83 wpt-pr: 18046
- Loading branch information
1 parent
f0045da
commit 14375ba
Showing
4 changed files
with
324 additions
and
0 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
...ing/web-platform/tests/mathml/relations/css-styling/padding-border-margin/border-001.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>border</title> | ||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-algorithms"> | ||
<meta name="assert" content="Verify that border is taken into account."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="helper.js"></script> | ||
<script> | ||
var epsilon = 1; | ||
|
||
setup({ explicit_done: true }); | ||
window.addEventListener("load", runTests); | ||
|
||
function runTests() { | ||
test(function() { | ||
var s = measureSpaceAround("mrow-border") | ||
assert_approx_equals(s.left, 20, epsilon, "left border"); | ||
assert_approx_equals(s.right, 30, epsilon, "right border"); | ||
assert_approx_equals(s.top, 40, epsilon, "top border"); | ||
assert_approx_equals(s.bottom, 50, epsilon, "bottom border"); | ||
}, "Border properties on mrow"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-border-shorthand") | ||
assert_approx_equals(s.left, 20, epsilon, "left border"); | ||
assert_approx_equals(s.right, 20, epsilon, "right border"); | ||
assert_approx_equals(s.top, 20, epsilon, "top border"); | ||
assert_approx_equals(s.bottom, 20, epsilon, "bottom border"); | ||
}, "Border properties on mrow (shorthand)"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-border-logical") | ||
assert_approx_equals(s.left, 20, epsilon, "left border"); | ||
assert_approx_equals(s.right, 30, epsilon, "right border"); | ||
assert_approx_equals(s.top, 40, epsilon, "top border"); | ||
assert_approx_equals(s.bottom, 50, epsilon, "bottom border"); | ||
}, "Border properties on mrow (logical)"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-border-logical-shorthand") | ||
assert_approx_equals(s.left, 20, epsilon, "left border"); | ||
assert_approx_equals(s.right, 20, epsilon, "right border"); | ||
assert_approx_equals(s.top, 30, epsilon, "top border"); | ||
assert_approx_equals(s.bottom, 30, epsilon, "bottom border"); | ||
}, "Border properties on mrow (logical, shorthand)"); | ||
|
||
done(); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-border" | ||
style="border-left: 20px; | ||
border-right: 30px; | ||
border-top: 40px; | ||
border-bottom: 50px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-border-shorthand" | ||
style="border: 20px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-border-logical" | ||
style="border-inline-start: 20px; | ||
border-inline-end: 30px; | ||
border-block-start: 40px; | ||
border-block-end: 50px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-border-logical-shorthand" | ||
style="border-inline: 20px; | ||
border-block: 30px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
testing/web-platform/tests/mathml/relations/css-styling/padding-border-margin/helper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function measureSpaceAround(id) { | ||
var mrow = document.getElementById(id); | ||
var mrowBox = mrow.getBoundingClientRect(); | ||
var parentBox = mrow.parentNode.getBoundingClientRect(); | ||
var childBox = mrow.firstElementChild.getBoundingClientRect(); | ||
return { | ||
left: childBox.left - parentBox.left, | ||
right: parentBox.right - childBox.right, | ||
top: childBox.top - parentBox.top, | ||
bottom: parentBox.bottom - childBox.bottom | ||
}; | ||
} |
104 changes: 104 additions & 0 deletions
104
...ing/web-platform/tests/mathml/relations/css-styling/padding-border-margin/margin-001.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>margin</title> | ||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-algorithms"> | ||
<meta name="assert" content="Verify that margin is taken into account."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="helper.js"></script> | ||
<script> | ||
var epsilon = 1; | ||
|
||
setup({ explicit_done: true }); | ||
window.addEventListener("load", runTests); | ||
|
||
function runTests() { | ||
test(function() { | ||
var s = measureSpaceAround("mrow-margin") | ||
assert_approx_equals(s.left, 20, epsilon, "left margin"); | ||
assert_approx_equals(s.right, 30, epsilon, "right margin"); | ||
assert_approx_equals(s.top, 40, epsilon, "top margin"); | ||
assert_approx_equals(s.bottom, 50, epsilon, "bottom margin"); | ||
}, "Margin properties on mrow"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-margin-shorthand") | ||
assert_approx_equals(s.left, 20, epsilon, "left margin"); | ||
assert_approx_equals(s.right, 20, epsilon, "right margin"); | ||
assert_approx_equals(s.top, 20, epsilon, "top margin"); | ||
assert_approx_equals(s.bottom, 20, epsilon, "bottom margin"); | ||
}, "Margin properties on mrow (shorthand)"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-margin-logical") | ||
assert_approx_equals(s.left, 20, epsilon, "left margin"); | ||
assert_approx_equals(s.right, 30, epsilon, "right margin"); | ||
assert_approx_equals(s.top, 40, epsilon, "top margin"); | ||
assert_approx_equals(s.bottom, 50, epsilon, "bottom margin"); | ||
}, "Margin properties on mrow (logical)"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-margin-logical-shorthand") | ||
assert_approx_equals(s.left, 20, epsilon, "left margin"); | ||
assert_approx_equals(s.right, 20, epsilon, "right margin"); | ||
assert_approx_equals(s.top, 30, epsilon, "top margin"); | ||
assert_approx_equals(s.bottom, 30, epsilon, "bottom margin"); | ||
}, "Margin properties on mrow (logical, shorthand)"); | ||
|
||
done(); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-margin" | ||
style="margin-left: 20px; | ||
margin-right: 30px; | ||
margin-top: 40px; | ||
margin-bottom: 50px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-margin-shorthand" | ||
style="margin: 20px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-margin-logical" | ||
style="margin-inline-start: 20px; | ||
margin-inline-end: 30px; | ||
margin-block-start: 40px; | ||
margin-block-end: 50px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-margin-logical-shorthand" | ||
style="margin-inline: 20px; | ||
margin-block: 30px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
</body> | ||
</html> |
104 changes: 104 additions & 0 deletions
104
...ng/web-platform/tests/mathml/relations/css-styling/padding-border-margin/padding-001.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>padding</title> | ||
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#layout-algorithms"> | ||
<meta name="assert" content="Verify that padding is taken into account."> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="helper.js"></script> | ||
<script> | ||
var epsilon = 1; | ||
|
||
setup({ explicit_done: true }); | ||
window.addEventListener("load", runTests); | ||
|
||
function runTests() { | ||
test(function() { | ||
var s = measureSpaceAround("mrow-padding") | ||
assert_approx_equals(s.left, 20, epsilon, "left padding"); | ||
assert_approx_equals(s.right, 30, epsilon, "right padding"); | ||
assert_approx_equals(s.top, 40, epsilon, "top padding"); | ||
assert_approx_equals(s.bottom, 50, epsilon, "bottom padding"); | ||
}, "Padding properties on mrow"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-padding-shorthand") | ||
assert_approx_equals(s.left, 20, epsilon, "left padding"); | ||
assert_approx_equals(s.right, 20, epsilon, "right padding"); | ||
assert_approx_equals(s.top, 20, epsilon, "top padding"); | ||
assert_approx_equals(s.bottom, 20, epsilon, "bottom padding"); | ||
}, "Padding properties on mrow (shorthand)"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-padding-logical") | ||
assert_approx_equals(s.left, 20, epsilon, "left padding"); | ||
assert_approx_equals(s.right, 30, epsilon, "right padding"); | ||
assert_approx_equals(s.top, 40, epsilon, "top padding"); | ||
assert_approx_equals(s.bottom, 50, epsilon, "bottom padding"); | ||
}, "Padding properties on mrow (logical)"); | ||
|
||
test(function() { | ||
var s = measureSpaceAround("mrow-padding-logical-shorthand") | ||
assert_approx_equals(s.left, 20, epsilon, "left padding"); | ||
assert_approx_equals(s.right, 20, epsilon, "right padding"); | ||
assert_approx_equals(s.top, 30, epsilon, "top padding"); | ||
assert_approx_equals(s.bottom, 30, epsilon, "bottom padding"); | ||
}, "Padding properties on mrow (logical, shorthand)"); | ||
|
||
done(); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-padding" | ||
style="padding-left: 20px; | ||
padding-right: 30px; | ||
padding-top: 40px; | ||
padding-bottom: 50px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-padding-shorthand" | ||
style="padding: 20px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-padding-logical" | ||
style="padding-inline-start: 20px; | ||
padding-inline-end: 30px; | ||
padding-block-start: 40px; | ||
padding-block-end: 50px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
<p> | ||
<math> | ||
<mrow> | ||
<mrow id="mrow-padding-logical-shorthand" | ||
style="padding-inline: 20px; | ||
padding-block: 30px;"> | ||
<mspace width="50px" height="50px"></mspace> | ||
</mrow> | ||
</mrow> | ||
</math> | ||
</p> | ||
</body> | ||
</html> |