Bug 997725 - Simplify SMIL tests. r=dholbert
authorRobert Longson <longsonr@gmail.com>
Fri, 18 Apr 2014 11:46:27 +0100
changeset 198794 93d3946fd9e0f292ee90a55964d0b11e56e8992d
parent 198793 13cad5da4f9a8ff534ae5c3db62245466aaf8153
child 198795 45ba19361b97d3154fa8dc26b707f48fab65fa99
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs997725
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 997725 - Simplify SMIL tests. r=dholbert
dom/smil/test/smilTestUtils.js
dom/smil/test/test_smilAnimateMotion.xhtml
dom/smil/test/test_smilAnimateMotionInvalidValues.xhtml
dom/smil/test/test_smilAnimateMotionOverrideRules.xhtml
dom/smil/test/test_smilCSSFontStretchRelative.xhtml
dom/smil/test/test_smilCSSFromBy.xhtml
dom/smil/test/test_smilCSSFromTo.xhtml
dom/smil/test/test_smilCSSInherit.xhtml
dom/smil/test/test_smilCSSInvalidValues.xhtml
dom/smil/test/test_smilCSSPaced.xhtml
dom/smil/test/test_smilDynamicDelayedBeginElement.xhtml
dom/smil/test/test_smilMappedAttrFromBy.xhtml
dom/smil/test/test_smilMappedAttrFromTo.xhtml
dom/smil/test/test_smilMappedAttrPaced.xhtml
dom/smil/test/test_smilTextZoom.xhtml
--- a/dom/smil/test/smilTestUtils.js
+++ b/dom/smil/test/smilTestUtils.js
@@ -14,32 +14,16 @@ const MPATH_TARGET_ID = "smilTestUtilsTe
 function extend(child, supertype)
 {
    child.prototype.__proto__ = supertype.prototype;
 }
 
 // General Utility Methods
 var SMILUtil =
 {
-  // Returns true if SMIL is enabled, false otherwise
-  // XXXdholbert There should be a "nicer" way to do this - right now this will
-  // trigger a 'NotYetImplemented' assertion on STDOUT, if SMIL is disabled.
-  isSMILEnabled : function()
-  {
-    var svg = SMILUtil.getSVGRoot();
-    try {
-      SMILUtil.getSVGRoot().animationsPaused();
-    } catch(e) {
-      // Exception --> SMIL disabled
-      return false;
-    }
-    // No exceptions --> SMIL enabled
-    return true;
-  },
-
   // Returns the first matched <svg> node in the document
   getSVGRoot : function()
   {
     return SMILUtil.getFirstElemWithTag("svg");
   },
 
   // Returns the first element in the document with the matching tag
   getFirstElemWithTag : function(aTargetTag)
--- a/dom/smil/test/test_smilAnimateMotion.xhtml
+++ b/dom/smil/test/test_smilAnimateMotion.xhtml
@@ -27,22 +27,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   var timingData = new SMILTimingData(1.0, 6.0);
   testBundleList(gMotionBundles, timingData);
 
--- a/dom/smil/test/test_smilAnimateMotionInvalidValues.xhtml
+++ b/dom/smil/test/test_smilAnimateMotionInvalidValues.xhtml
@@ -41,17 +41,17 @@ function createAnim()
   return gRect.appendChild(anim);
 }
 
 function removeElem(aElem)
 {
   aElem.parentNode.removeChild(aElem);
 }
 
-function testAttr(aAttrName, aAttrValueArray, aIsValid, aIsTodo)
+function testAttr(aAttrName, aAttrValueArray, aIsValid)
 {
   var componentsToCheck;
 
   for (var i in aAttrValueArray) {
     var curVal = aAttrValueArray[i];
     var anim = createAnim();
     anim.setAttribute(aAttrName, curVal);
     if (aAttrName == "rotate") {
@@ -73,22 +73,22 @@ function testAttr(aAttrName, aAttrValueA
       }
     }
 
     var curCTM = gRect.getCTM();
     if (aIsValid) {
       var errMsg = "CTM should have changed when applying animateMotion " +
         "with '" + aAttrName + "' set to valid value '" + curVal + "'";
       CTMUtil.assertCTMNotEqual(curCTM, gUnAnimatedCTM, componentsToCheck,
-                                errMsg, aIsTodo);
+                                errMsg, false);
     } else {
       var errMsg = "CTM should not have changed when applying animateMotion " +
         "with '" + aAttrName + "' set to invalid value '" + curVal + "'";
       CTMUtil.assertCTMEqual(curCTM, gUnAnimatedCTM, componentsToCheck,
-                             errMsg, aIsTodo);
+                             errMsg, false);
     }
     removeElem(anim);
   }
 }
 
 function createPath(aPathDescription)
 {
   var path = document.createElementNS(SVGNS, "path");
@@ -99,17 +99,17 @@ function createPath(aPathDescription)
 
 function createMpath(aAnimElement)
 {
   var mpath = document.createElementNS(SVGNS, "mpath");
   mpath.setAttributeNS(XLINKNS, "href", "#thePath");
   return aAnimElement.appendChild(mpath);
 }
 
-function testMpathElem(aPathValueArray, aIsValid, aIsTodo)
+function testMpathElem(aPathValueArray, aIsValid)
 {
   for (var i in aPathValueArray) {
     var curVal = aPathValueArray[i];
     var anim = createAnim();
     var mpath = createMpath(anim);
     var path = createPath(curVal);
 
     // Apply a supplementary rotation to make sure that we don't apply it if
@@ -117,64 +117,58 @@ function testMpathElem(aPathValueArray, 
     anim.setAttribute("rotate", Math.PI/4);
     componentsToCheck = CTMUtil.CTM_COMPONENTS_ALL;
 
     if (aIsValid) {
       var errMsg = "CTM should have changed when applying animateMotion " +
         "with mpath linking to a path with valid value '" + curVal + "'";
 
       CTMUtil.assertCTMNotEqual(gRect.getCTM(), gUnAnimatedCTM,
-                                componentsToCheck, errMsg, aIsTodo);
+                                componentsToCheck, errMsg, false);
     } else {
       var errMsg = "CTM should not have changed when applying animateMotion " +
         "with mpath linking to a path with invalid value '" + curVal + "'";
       CTMUtil.assertCTMEqual(gRect.getCTM(), gUnAnimatedCTM,
-                             componentsToCheck, errMsg, aIsTodo);
+                             componentsToCheck, errMsg, false);
     }
     removeElem(anim);
     removeElem(path);
     removeElem(mpath);
  } 
 }
 
 // Main Function
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
-  testAttr("values", gValidValues, true, false);
-  testAttr("values", gInvalidValues, false, false);
+  testAttr("values", gValidValues, true);
+  testAttr("values", gInvalidValues, false);
 
-  testAttr("rotate", gValidRotate, true, false);
-  testAttr("rotate", gInvalidRotate, false, false);
+  testAttr("rotate", gValidRotate, true);
+  testAttr("rotate", gInvalidRotate, false);
 
-  testAttr("to", gValidToBy, true, false);
-  testAttr("to", gInvalidToBy, false, false);
+  testAttr("to", gValidToBy, true);
+  testAttr("to", gInvalidToBy, false);
 
-  testAttr("by", gValidToBy, true, false);
-  testAttr("by", gInvalidToBy, false, false);
+  testAttr("by", gValidToBy, true);
+  testAttr("by", gInvalidToBy, false);
 
-  testAttr("path", gValidPath, true, false);
-  testAttr("path", gInvalidPath, false, false);
-  testAttr("path", gValidPathWithErrors, true, false);
+  testAttr("path", gValidPath, true);
+  testAttr("path", gInvalidPath, false);
+  testAttr("path", gValidPathWithErrors, true);
 
-  testAttr("keyPoints", gValidKeyPoints, true, false);
-  testAttr("keyPoints", gInvalidKeyPoints, false, false);
+  testAttr("keyPoints", gValidKeyPoints, true);
+  testAttr("keyPoints", gInvalidKeyPoints, false);
 
-  testMpathElem(gValidPath, true, false);
-  testMpathElem(gInvalidPath, false, false);
+  testMpathElem(gValidPath, true);
+  testMpathElem(gInvalidPath, false);
 
   SimpleTest.finish();
 }
 
 window.addEventListener("load", main, false);
 ]]>
 </script>
 </pre>
--- a/dom/smil/test/test_smilAnimateMotionOverrideRules.xhtml
+++ b/dom/smil/test/test_smilAnimateMotionOverrideRules.xhtml
@@ -193,22 +193,16 @@ function testAttrSettings(aAttrValueHash
   // CLEAN UP
   SMILUtil.getSVGRoot().setCurrentTime(0);
   removeElem(animElement);
 }
 
 // Main Function
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   runTest();
   SimpleTest.finish();
 }
--- a/dom/smil/test/test_smilCSSFontStretchRelative.xhtml
+++ b/dom/smil/test/test_smilCSSFontStretchRelative.xhtml
@@ -75,22 +75,16 @@ function testFontStretchValue(baseValue,
 
   // Removing animation should clear animated effects
   textElem.removeChild(animElem);
   svg.removeChild(gElem);
 }
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   var valuesList = gFontStretchValues;
   for (var baseIdx in valuesList) {
     // 'narrower' and 'wider' are expected to shift us by one slot, but not
     // past the ends of the list of possible values.
     var narrowerIdx = Math.max(baseIdx - 1, 0);
     var widerIdx =    Math.min(baseIdx + 1, valuesList.length - 1);
 
     testFontStretchValue(valuesList[baseIdx],
--- a/dom/smil/test/test_smilCSSFromBy.xhtml
+++ b/dom/smil/test/test_smilCSSFromBy.xhtml
@@ -26,22 +26,16 @@
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   testBundleList(gFromByBundles, new SMILTimingData(1.0, 1.0));
 
   // Set "display:none" on everything and run the tests again
--- a/dom/smil/test/test_smilCSSFromTo.xhtml
+++ b/dom/smil/test/test_smilCSSFromTo.xhtml
@@ -49,22 +49,16 @@ function checkForUntestedProperties(bund
   // Warn about remaining (untested) properties
   for (var untestedProp in propertySet) {
     ok(false, "No tests for property '" + untestedProp + "'");
   }
 }
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   // FIRST: Warn about any properties that are missing tests
   checkForUntestedProperties(gFromToBundles);
 
--- a/dom/smil/test/test_smilCSSInherit.xhtml
+++ b/dom/smil/test/test_smilCSSInherit.xhtml
@@ -51,22 +51,16 @@
 </svg>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 SimpleTest.waitForExplicitFinish();
 
 function main() {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Pause & seek to halfway through animation
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
   svg.setCurrentTime(0.5);
 
   var text = document.getElementsByTagName("text")[0];
   var computedVal = SMILUtil.getComputedStyleSimple(text, "font-size");
--- a/dom/smil/test/test_smilCSSInvalidValues.xhtml
+++ b/dom/smil/test/test_smilCSSInvalidValues.xhtml
@@ -35,22 +35,16 @@ var invalidTestcaseBundles = [
     new AnimTestcaseFromTo("greeeen", "red",  { noEffect: true }),
     new AnimTestcaseFromTo("rgb(red, 255, 255)", "red", { noEffect: true }),
     new AnimTestcaseFromTo("#FFFFFFF", "red", { noEffect: true }),
     new AnimTestcaseFromTo("bogus", "bogus",  { noEffect: true }),
   ]),
 ];
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   // Run the tests
   testBundleList(invalidTestcaseBundles, new SMILTimingData(1.0, 1.0));
 
--- a/dom/smil/test/test_smilCSSPaced.xhtml
+++ b/dom/smil/test/test_smilCSSPaced.xhtml
@@ -21,22 +21,16 @@
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   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);
--- a/dom/smil/test/test_smilDynamicDelayedBeginElement.xhtml
+++ b/dom/smil/test/test_smilDynamicDelayedBeginElement.xhtml
@@ -45,22 +45,16 @@ function createAnim() {
   a.setAttribute('begin', 'indefinite');
   a.setAttribute('dur', '3s');
   a.setAttribute('fill', 'freeze');
   return a;
 }
 
 // Main Functions
 function main() {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // In unpatched Firefox builds, we'll only trigger Bug 699143 if we insert
   // an animation and call beginElement() **after** the document start-time.
   // Hence, we use executeSoon here to allow some time to pass.  (And then
   // we'll use a short busy-loop, for good measure.)
   SimpleTest.executeSoon(runTest);
 }
 
 function runTest() {
--- a/dom/smil/test/test_smilMappedAttrFromBy.xhtml
+++ b/dom/smil/test/test_smilMappedAttrFromBy.xhtml
@@ -27,22 +27,16 @@
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   var testBundles = convertCSSBundlesToMappedAttr(gFromByBundles);
   testBundleList(testBundles, new SMILTimingData(1.0, 1.0));
 
--- a/dom/smil/test/test_smilMappedAttrFromTo.xhtml
+++ b/dom/smil/test/test_smilMappedAttrFromTo.xhtml
@@ -50,22 +50,16 @@ function checkForUntestedAttributes(bund
   // Warn about remaining (untested) properties
   for (var untestedProp in attributeSet) {
     ok(false, "No tests for attribute '" + untestedProp + "'");
   }
 }
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   var testBundles = convertCSSBundlesToMappedAttr(gFromToBundles);
 
   // FIRST: Warn about any attributes that are missing tests
--- a/dom/smil/test/test_smilMappedAttrPaced.xhtml
+++ b/dom/smil/test/test_smilMappedAttrPaced.xhtml
@@ -22,22 +22,16 @@
 <pre id="test">
 <script class="testbody" type="text/javascript">
 <![CDATA[
 
 SimpleTest.waitForExplicitFinish();
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out with document paused
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   var testBundles = convertCSSBundlesToMappedAttr(gPacedBundles);
   testBundleList(testBundles, new SMILTimingData(1.0, 6.0));
 
--- a/dom/smil/test/test_smilTextZoom.xhtml
+++ b/dom/smil/test/test_smilTextZoom.xhtml
@@ -30,22 +30,16 @@ SimpleTest.waitForExplicitFinish();
 function verifyStyle(aNode, aPropertyName, aExpectedVal)
 {
   var computedVal = SMILUtil.getComputedStyleSimple(aNode, aPropertyName);
   is(computedVal, aExpectedVal, "computed value of " + aPropertyName);
 }
 
 function main()
 {
-  if (!SMILUtil.isSMILEnabled()) {
-    ok(false, "SMIL dosn't seem to be enabled");
-    SimpleTest.finish();
-    return;
-  }
-
   // Start out pause
   var svg = SMILUtil.getSVGRoot();
   ok(svg.animationsPaused(), "should be paused by <svg> load handler");
   is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
 
   // Set text zoom to 2x
   var origTextZoom =  SpecialPowers.getTextZoom(window);
   SpecialPowers.setTextZoom(window, 2);