Bug 936100 part 3: Remove pref-setting mochitest wrappers for flexbox-specific mochitests, and transfer their boilerplate into the actual test files (currently named "file_"). r=mats

This commit is contained in:
Daniel Holbert 2013-11-09 07:53:03 -08:00
parent df79f50109
commit 8f98448214
15 changed files with 73 additions and 377 deletions

View File

@ -94,20 +94,13 @@ MOCHITEST_FILES = test_acid3_test46.html \
test_descriptor_syntax_errors.html \
test_dont_use_document_colors.html \
file_flexbox_align_self_auto.html \
test_flexbox_align_self_auto.html \
file_flexbox_child_display_values.xhtml \
test_flexbox_child_display_values.html \
file_flexbox_flex_grow_and_shrink.html \
test_flexbox_flex_grow_and_shrink.html \
file_flexbox_flex_shorthand.html \
test_flexbox_flex_shorthand.html \
file_flexbox_layout.html \
test_flexbox_layout.html \
flexbox_layout_testcases.js \
file_flexbox_order.html \
test_flexbox_order.html \
file_flexbox_order_table.html \
test_flexbox_order_table.html \
test_font_face_parser.html \
test_font_family_parsing.html \
test_font_feature_values_parsing.html \

View File

@ -1,6 +1,16 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696253
-->
<head>
<meta charset="utf-8">
<title>Test behavior of 'align-self:auto' (Bug 696253)</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696253">Mozilla Bug 696253</a>
<div id="display">
<div id="myDiv"></div>
</div>
@ -41,10 +51,6 @@
* This mochitest tests that situation and a few other similar tricky situations.
*/
// Use "is()" and "ok()" from parent document.
var is = parent.is;
var ok = parent.ok;
/*
* Utility function for getting computed style of "align-self":
*/
@ -162,9 +168,6 @@ function testNodeThatHasGrandparent(elem) {
* Main test function
*/
function main() {
ok(SpecialPowers.getBoolPref("layout.css.flexbox.enabled"),
"expecting to be run with flexbox support enabled");
// Test the root node
// ==================
// (It's special because it has no parent style context.)
@ -201,8 +204,6 @@ function main() {
testGeneralNode(displayNode);
testNodeThatHasParent(displayNode);
testNodeThatHasGrandparent(displayNode);
parent.finish();
}
main();

View File

@ -1,6 +1,16 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=783415
-->
<head>
<meta charset="utf-8"/>
<title>Test "display" values of content in a flex container (Bug 783415)</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783415">Mozilla Bug 783415</a>
<div id="display">
<div id="wrapper"></div>
</div>
<pre id="test">
@ -18,10 +28,6 @@
* specified display-value.)
*/
// Use "is()" and "ok()" from parent document.
let is = parent.is;
let ok = parent.ok;
/*
* Utility function for getting computed style of "display".
*
@ -120,9 +126,6 @@ function testDisplayValue(aSpecifiedDisplay,
* Main test function
*/
function main() {
ok(SpecialPowers.getBoolPref("layout.css.flexbox.enabled"),
"expecting to be run with flexbox support enabled");
testDisplayValue("none");
testDisplayValue("block");
testDisplayValue("flex");
@ -176,8 +179,6 @@ function main() {
function(aSpecifiedDisplay) {
testDisplayValue(aSpecifiedDisplay, aSpecifiedDisplay, "block");
});
parent.finish();
}
main();

View File

@ -1,7 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696253
-->
<head>
<meta charset="utf-8">
<title>Test for flex-grow and flex-shrink animation (Bug 696253)</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="animation_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style type="text/css">
/* Set flex-grow and flex-shrink to nonzero values,
@ -49,6 +56,7 @@
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696253">Mozilla Bug 696253</a>
<div id="display">
<div id="myDiv"></div>
</div>
@ -62,13 +70,6 @@ function advance_clock(milliseconds) {
SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(milliseconds);
}
// Use "is()" and "ok()" from parent document.
var is = parent.is;
var ok = parent.ok;
ok(SpecialPowers.getBoolPref("layout.css.flexbox.enabled"),
"expecting to be run with flexbox support enabled");
var display = document.getElementById("display");
var div = null;
var cs = null;
@ -176,8 +177,6 @@ done_div();
SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
parent.finish();
</script>
</pre>
</body>

View File

@ -1,10 +1,20 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696253
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 696253</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="property_database.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div id="content">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696253">Mozilla Bug 696253</a>
<div id="display">
<div id="content">
</div>
</div>
<pre id="test">
<script type="application/javascript;version=1.7">
@ -13,10 +23,6 @@
/** Test for Bug 696253 **/
/* (Testing the 'flex' CSS shorthand property) */
// Use "is()" and "ok()" from parent document.
var is = parent.is;
var ok = parent.ok;
const gFlexPropName = "flex";
const gFlexPropInfo = gCSSProperties[gFlexPropName];
@ -255,11 +261,7 @@ function runFlexShorthandTest(aFlexShorthandTestcase)
}
function main() {
ok(SpecialPowers.getBoolPref("layout.css.flexbox.enabled"),
"expecting to be run with flexbox support enabled");
gFlexShorthandTestcases.forEach(runFlexShorthandTest);
parent.finish();
}
main();

View File

@ -1,11 +1,21 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666041
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 666041</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="flexbox_layout_testcases.js"></script>
<script type="text/javascript" src="property_database.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div id="content">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666041">Mozilla Bug 666041</a>
<div id="display">
<div id="content">
</div>
</div>
<pre id="test">
<script type="application/javascript;version=1.7">
@ -22,10 +32,6 @@
* See flexbox_layout_testcases.js for the actual testcases & testcase format.
*/
// Use "is()" and "ok()" from parent document.
var is = parent.is;
var ok = parent.ok;
function getComputedStyleWrapper(elem, prop)
{
return window.getComputedStyle(elem, null).getPropertyValue(prop);
@ -128,9 +134,6 @@ function testFlexboxTestcase(aFlexboxTestcase, aFlexDirection, aPropertyMapping)
function main()
{
ok(SpecialPowers.getBoolPref("layout.css.flexbox.enabled"),
"expecting to be run with flexbox support enabled");
gFlexboxTestcases.forEach(
function(aTestcase) {
testFlexboxTestcase(aTestcase, "",
@ -145,11 +148,10 @@ function main()
gColumnReversePropertyMapping);
}
);
parent.finish();
}
window.addEventListener("load", main, false);
main();
</script>
</pre>
</body>

View File

@ -1,7 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666041
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 666041</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style type="text/css">
div.ref {
@ -40,6 +47,7 @@
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666041">Mozilla Bug 666041</a>
<div id="display">
<!-- Reference cases (display:none; only shown during initRefSnapshots) -->
@ -67,6 +75,8 @@
<script type="application/javascript;version=1.7">
"use strict";
/** Test for Bug 666041 **/
/* This testcase ensures that we honor the "order" property when ordering
* flex items within a flex container.
*
@ -74,11 +84,6 @@
* test paint ordering. It only tests horizontal ordering in a flex container.
*/
// Use "is()", "ok()", and "todo()" from parent document.
var is = parent.is;
var ok = parent.ok;
var todo = parent.todo;
// DATA
// ----
@ -177,8 +182,6 @@ function main() {
// Re-hide the flex container at the end
flexContainerParent.style.display = "";
parent.finish();
}
main();

View File

@ -1,7 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=799775
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 799775</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style type="text/css">
div.ref {
@ -44,6 +51,7 @@
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=799775">Mozilla Bug 799775</a>
<div id="display">
<!-- Reference cases (display:none; only shown during initRefSnapshots) -->
@ -71,6 +79,8 @@
<script type="application/javascript;version=1.7">
"use strict";
/** Test for Bug 799775 **/
/* This testcase ensures that we honor the "order" property when ordering
* tables as flex items within a flex container.
*
@ -78,11 +88,6 @@
* test paint ordering. It only tests horizontal ordering in a flex container.
*/
// Use "is()", "ok()", and "todo()" from parent document.
var is = parent.is;
var ok = parent.ok;
var todo = parent.todo;
// DATA
// ----
@ -181,8 +186,6 @@ function main() {
// Re-hide the flex container at the end
flexContainerParent.style.display = "";
parent.finish();
}
main();

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696253
-->
<head>
<meta charset="utf-8">
<title>Test behavior of 'align-self:auto' (Bug 696253)</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696253">Mozilla Bug 696253</a>
<div id="display">
<iframe id="iframe"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
/** Test behavior of 'align-self:auto' (Bug 696253) **/
/*
* This mochitest runs in an iframe so that we can selectively turn on the
* flexbox about:config pref before its document is instantiated.
*
* See the iframe's source ("file_flexbox_align_self_auto.html") for the actual
* test code and for more documentation.
*/
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("layout.css.flexbox.enabled", true);
document.getElementById("iframe").src = "file_flexbox_align_self_auto.html";
function finish() {
SpecialPowers.clearUserPref("layout.css.flexbox.enabled");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1,44 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=783415
-->
<head>
<meta charset="utf-8">
<title>Test "display" values of content in a flex container (Bug 783415)</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783415">Mozilla Bug 783415</a>
<div id="display">
<iframe id="iframe"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
/** Test "display" values of content in a flex container (Bug 783415) **/
/*
* This mochitest runs in an iframe so that we can selectively turn on the
* flexbox about:config pref before its document is instantiated.
*
* See the iframe's source ("file_flexbox_child_display_values.xhtml") for the
* actual test code and for more documentation.
*/
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("layout.css.flexbox.enabled", true);
document.getElementById("iframe").src =
"file_flexbox_child_display_values.xhtml";
function finish() {
SpecialPowers.clearUserPref("layout.css.flexbox.enabled");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1,44 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696253
-->
<head>
<meta charset="utf-8">
<title>Test for flex-grow and flex-shrink animation (Bug 696253)</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696253">Mozilla Bug 696253</a>
<div id="display">
<iframe id="iframe"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
/** Test for flex-grow and flex-shrink animation (Bug 696253) **/
/*
* This mochitest runs in an iframe so that we can selectively turn on the
* flexbox about:config pref before its document is instantiated.
*
* See the iframe's source ("file_flexbox_flex_grow_and_shrink.html") for
* the actual test code and for more documentation.
*/
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("layout.css.flexbox.enabled", true);
document.getElementById("iframe").src =
"file_flexbox_flex_grow_and_shrink.html";
function finish() {
SpecialPowers.clearUserPref("layout.css.flexbox.enabled");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696253
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 696253</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696253">Mozilla Bug 696253</a>
<div id="display">
<iframe id="iframe"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
/** Test for Bug 696253, for the 'flex' CSS shorthand property) **/
/*
* This mochitest runs in an iframe so that we can selectively turn on the
* flexbox about:config pref before its document is instantiated.
*
* See the iframe's source ("file_flexbox_flex_shorthand.html") for the actual
* test code and for more documentation.
*/
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("layout.css.flexbox.enabled", true);
document.getElementById("iframe").src = "file_flexbox_flex_shorthand.html";
function finish() {
SpecialPowers.clearUserPref("layout.css.flexbox.enabled");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666041
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 666041</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666041">Mozilla Bug 666041</a>
<div id="display">
<iframe id="iframe"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
"use strict";
/** Test for Bug 666041 **/
/*
* This mochitest runs in an iframe so that we can selectively turn on the
* flexbox about:config pref before its document is instantiated.
*
* See the iframe's source ("file_flexbox_layout.html") for the actual
* test code and for more documentation.
*/
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("layout.css.flexbox.enabled", true);
document.getElementById("iframe").src = "file_flexbox_layout.html";
function finish() {
SpecialPowers.clearUserPref("layout.css.flexbox.enabled");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666041
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 666041</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=666041">Mozilla Bug 666041</a>
<div id="display">
<iframe id="iframe" style="height: 100px; width: 200px"></iframe>
</div>
<pre id="test">
<script type="application/javascript;version=1.7">
"use strict";
/** Test for Bug 666041 **/
/*
* This mochitest runs in an iframe so that we can selectively turn on the
* flexbox about:config pref before its document is instantiated.
*
* See the iframe's source ("file_flexbox_order.html") for the actual
* test code and for more documentation.
*/
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("layout.css.flexbox.enabled", true);
document.getElementById("iframe").src = "file_flexbox_order.html";
function finish() {
SpecialPowers.clearUserPref("layout.css.flexbox.enabled");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>

View File

@ -1,48 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=799775
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 799775</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=799775">Mozilla Bug 799775</a>
<div id="display">
<iframe id="iframe" style="height: 100px; width: 200px"></iframe>
</div>
<pre id="test">
<script type="application/javascript;version=1.7">
"use strict";
/** Test for Bug 799775 **/
/*
* This mochitest runs in an iframe so that we can selectively turn on the
* flexbox about:config pref before its document is instantiated.
*
* See the iframe's source ("file_flexbox_order_table.html") for the actual
* test code and for more documentation.
*/
SimpleTest.waitForExplicitFinish();
if(SpecialPowers.getBoolPref("layout.css.flexbox.enabled")) {
document.getElementById("iframe").src = "file_flexbox_order_table.html";
} else {
todo(false,
"Finishing early -- flexbox pref is disabled, and this test only " +
"works if the pref is enabled at startup-time, when ua.css is parsed");
finish();
}
function finish() {
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>