Skip to content

Commit

Permalink
Bug 1209405 - Part 1: Modify tests so as not use display:none. r=birtles
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: A38q97ejYSC
  • Loading branch information
dadaa committed May 23, 2016
1 parent d2ee585 commit 04e9d8a
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 73 deletions.
31 changes: 4 additions & 27 deletions dom/smil/test/smilTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,6 @@ var SMILUtil =
}
return computedStyle;
},

// This method hides (i.e. sets "display: none" on) all of the given node's
// descendents. It also hides the node itself, if requested.
hideSubtree : function(node, hideNodeItself, useXMLAttribute)
{
// Hide node, if requested
if (hideNodeItself) {
if (useXMLAttribute) {
if (node.setAttribute) {
node.setAttribute("display", "none");
}
} else if (node.style) {
node.style.display = "none";
}
}

// Hide node's descendents
var child = node.firstChild;
while (child) {
SMILUtil.hideSubtree(child, true, useXMLAttribute);
child = child.nextSibling;
}
},

getMotionFakeAttributeName : function() {
return "_motion";
Expand Down Expand Up @@ -348,7 +325,7 @@ AnimTestcase.prototype =
_animElementTagName : "animate", // Can be overridden for e.g. animateColor
computedValMap : null,
skipReason : null,

// Methods
/**
* runTest: Runs this AnimTestcase
Expand Down Expand Up @@ -416,7 +393,7 @@ AnimTestcase.prototype =
if (this.computedValMap.noEffect) {
return this.buildSeekListStatic(aAnimAttr, aBaseVal, aTimeData,
"testcase specified to have no effect");
}
}
return this.buildSeekListAnimated(aAnimAttr, aBaseVal,
aTimeData, aIsFreeze)
},
Expand Down Expand Up @@ -654,7 +631,7 @@ AnimTestcasePaced.prototype =
{
// Member variables
valuesString : null,

// Methods
setupAnimationElement : function(aAnimAttr, aTimeData, aIsFreeze)
{
Expand Down Expand Up @@ -768,7 +745,7 @@ AnimMotionTestcase.prototype =
{
// Member variables
_animElementTagName : "animateMotion",

// Implementations of inherited methods that we need to override:
// --------------------------------------------------------------
setupAnimationElement : function(aAnimAttr, aTimeData, aIsFreeze)
Expand Down
4 changes: 0 additions & 4 deletions dom/smil/test/test_smilCSSFromBy.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ function main()

testBundleList(gFromByBundles, new SMILTimingData(1.0, 1.0));

// Set "display:none" on everything and run the tests again
SMILUtil.hideSubtree(SMILUtil.getSVGRoot(), false, false);
testBundleList(gFromByBundles, new SMILTimingData(1.0, 1.0));

SimpleTest.finish();
}

Expand Down
4 changes: 0 additions & 4 deletions dom/smil/test/test_smilCSSFromTo.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ function main()
// Run the actual tests
testBundleList(gFromToBundles, new SMILTimingData(1.0, 1.0));

// Set "display:none" on everything and run the tests again
SMILUtil.hideSubtree(SMILUtil.getSVGRoot(), false, false);
testBundleList(gFromToBundles, new SMILTimingData(1.0, 1.0));

SimpleTest.finish();
}

Expand Down
3 changes: 0 additions & 3 deletions dom/smil/test/test_smilCSSPaced.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ function main()
ok(svg.animationsPaused(), "should be paused by <svg> load handler");
is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");

testBundleList(gPacedBundles, new SMILTimingData(1.0, 6.0));
// Set "display:none" on everything and run the tests again
SMILUtil.hideSubtree(SMILUtil.getSVGRoot(), false, false);
testBundleList(gPacedBundles, new SMILTimingData(1.0, 6.0));

SimpleTest.finish();
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilConditionalProcessing.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<circle r="50" fill="blue" id="circle">
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilFillMode.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
Expand Down
4 changes: 2 additions & 2 deletions dom/smil/test/test_smilKeySplines.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
Expand Down Expand Up @@ -75,7 +75,7 @@ function checkSampleRough(time, expectedValue, precision) {
}
svg.setCurrentTime(time);
var diff = Math.abs(expectedValue - circle.cx.animVal.value);
ok(diff <= precision,
ok(diff <= precision,
"Unexpected sample value got " + circle.cx.animVal.value
+ ", expected " + expectedValue + " [error is " + diff
+ ", tolerance is " + precision + "]");
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilKeyTimes.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
href="https://bugzilla.mozilla.org/show_bug.cgi?id=557885">Mozilla Bug
557885</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
</svg>
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilKeyTimesPacedMode.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=555026">Mozilla Bug 555026</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<circle r="10" id="circle"/>
Expand Down
4 changes: 0 additions & 4 deletions dom/smil/test/test_smilMappedAttrFromBy.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ function main()
var testBundles = convertCSSBundlesToMappedAttr(gFromByBundles);
testBundleList(testBundles, new SMILTimingData(1.0, 1.0));

// Set "display:none" on everything and run the tests again
SMILUtil.hideSubtree(SMILUtil.getSVGRoot(), false, true);
testBundleList(testBundles, new SMILTimingData(1.0, 1.0));

SimpleTest.finish();
}

Expand Down
4 changes: 0 additions & 4 deletions dom/smil/test/test_smilMappedAttrFromTo.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ function main()
// Run the actual tests
testBundleList(testBundles, new SMILTimingData(1.0, 1.0));

// Set "display:none" on everything and run the tests again
SMILUtil.hideSubtree(SMILUtil.getSVGRoot(), false, true);
testBundleList(testBundles, new SMILTimingData(1.0, 1.0));

SimpleTest.finish();
}

Expand Down
4 changes: 0 additions & 4 deletions dom/smil/test/test_smilMappedAttrPaced.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ function main()
var testBundles = convertCSSBundlesToMappedAttr(gPacedBundles);
testBundleList(testBundles, new SMILTimingData(1.0, 6.0));

// Set "display:none" on everything and run the tests again
SMILUtil.hideSubtree(SMILUtil.getSVGRoot(), false, true);
testBundleList(testBundles, new SMILTimingData(1.0, 6.0));

SimpleTest.finish();
}

Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilMinTiming.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=948245">Mozilla Bug 948245</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" onload="this.pauseAnimations()">
<rect fill="red" id="rect" x="0">
<animate attributeName="x" to="100" id="animation" dur="100s" min="200s"/>
Expand Down
8 changes: 4 additions & 4 deletions dom/smil/test/test_smilSync.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px">
<circle cx="20" cy="20" r="15" fill="blue">
<animate attributeName="cx" attributeType="XML" from="20" to="100"
Expand Down Expand Up @@ -173,7 +173,7 @@ function testSetCurrentTime(anim) {
is(anim.getStartTime(), 100);

// Then we restart giving us:
//
//
// beginElement begin="100s"
// v v
// Doc time: 0---\/\/\/-------99----------100-------
Expand All @@ -189,7 +189,7 @@ function testSetCurrentTime(anim) {
is(anim.getStartTime(), svg.getCurrentTime());

// Then we skip to half-way, i.e.
//
//
// currentTime
// v
// begin="100s"
Expand Down Expand Up @@ -222,7 +222,7 @@ function testSetCurrentTime(anim) {
//
// If, however, setCurrentTime failed to flush restarts out starting point
// we do come to update the timegraph would be:
//
//
// beginElementAt
// v
// begin="100s"
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilTextZoom.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg xmlns="http://www.w3.org/2000/svg" width="300px" height="200px"
onload="this.pauseAnimations()">
<text y="100px" x="0px" style="font-size: 5px">
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilTiming.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilTimingZeroIntervals.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/test/test_smilValues.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
href="https://bugzilla.mozilla.org/show_bug.cgi?id=557885">Mozilla Bug
474742</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px">
<circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
</svg>
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/test/test_SVGTransformListAddition.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=602759
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=602759">
Mozilla Bug 602759</a>
<p id="display"></p>
<div id="content" style="display:none;">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100"
onload="this.pauseAnimations();">
<g id="g"/>
Expand Down
6 changes: 3 additions & 3 deletions dom/svg/test/test_SVGxxxList.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=515116
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=515116">Mozilla Bug 515116</a>
<p id="display"></p>
<div id="content" style="display:none;">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100" height="100"
onload="this.pauseAnimations();">
<desc>
Expand Down Expand Up @@ -98,7 +98,7 @@ function keys(obj) {
var rval = [];
for (var prop in obj) {
rval.push(prop);
}
}
return rval;
};

Expand Down Expand Up @@ -268,7 +268,7 @@ var tests = [

// Compare the properties, skipping the constant properties inherited
// from 'SVGPathSeg', and skipping the pathSegTypeAsLetter field since we
// already checked that above.
// already checked that above.
for (var prop in itemA) {
if (!SVGPathSeg.hasOwnProperty(prop) &&
prop != 'pathSegTypeAsLetter') {
Expand Down
8 changes: 4 additions & 4 deletions dom/svg/test/test_animLengthUnits.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=507067
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=507067">Mozilla Bug 507067</a>
<p id="display"></p>
<div id="content" style="display: none">
<div id="content">
<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
onload="this.pauseAnimations()">
<g font-size="10px">
Expand Down Expand Up @@ -40,7 +40,7 @@ SimpleTest.waitForExplicitFinish();
// WebKit -- July 09 trunk build
// Batik -- 1.7
// Firefox -- July 09 trunk build
//
//

function main() {
ok(svg.animationsPaused(), "should be paused by <svg> load handler");
Expand Down Expand Up @@ -85,7 +85,7 @@ function checkAfterChangeFontSize() {
// (2) Check that changing the font-size of the parent element is reflected in
// the anim val
is(circle.cx.baseVal.value, -100,
"(2) Unexpected value for baseVal after changing font-size during " +
"(2) Unexpected value for baseVal after changing font-size during " +
"animation");
is(circle.cx.animVal.value, 25,
"(2) Unexpected value for animVal after changing font-size during " +
Expand All @@ -103,7 +103,7 @@ function checkWhilstFrozen() {
// (3) Check that changing the font-size of the parent element is reflected in
// the anim val
is(circle.cx.baseVal.value, -100,
"(3) Unexpected value for baseVal after changing font-size whilst " +
"(3) Unexpected value for baseVal after changing font-size whilst " +
"frozen");
is(circle.cx.animVal.value, 70,
"(3) Unexpected value for animVal after changing font-size whilst " +
Expand Down

0 comments on commit 04e9d8a

Please sign in to comment.