tests for bug 521335
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 20 Oct 2009 09:55:37 -0700
changeset 34035 5a68b843f4d99b34bcaa9cd199732c7b78f7cb93
parent 34034 6108fdf296de6cd5b9d695e7a6f01117a6c2a6ab
child 34036 ba9c06d83b3ecc509ad94e0ddbdcca5ca5fea7f1
push id9833
push userdholbert@mozilla.com
push dateTue, 20 Oct 2009 17:19:42 +0000
treeherdermozilla-central@5a68b843f4d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs521335
milestone1.9.3a1pre
tests for bug 521335
content/smil/test/db_smilCSSFromBy.js
content/smil/test/db_smilCSSFromTo.js
content/smil/test/db_smilCSSPaced.js
content/smil/test/smilTestUtils.js
--- a/content/smil/test/db_smilCSSFromBy.js
+++ b/content/smil/test/db_smilCSSFromBy.js
@@ -58,24 +58,39 @@ var _fromByTestLists =
   opacity: [
     new AnimTestcaseFromBy("1", "-1", { midComp: "0.5", toComp: "0"}),
     new AnimTestcaseFromBy("0.4", "-0.6", { midComp: "0.1", toComp: "0"}),
     new AnimTestcaseFromBy("0.8", "-1.4", { midComp: "0.1", toComp: "0"},
                            "opacities with abs val >1 get clamped too early"),
     new AnimTestcaseFromBy("1.2", "-0.6", { midComp: "0.9", toComp: "0.6"},
                            "opacities with abs val >1 get clamped too early"),
   ],
+  paint: [
+    // The "none" keyword & URI values aren't addiditve, so the animations in
+    // these testcases are expected to have no effect.
+    // XXXdholbert Of course, we don't support animation between URI values yet
+    // (bug 520487), so the testcases that use URIs currently have no effect
+    // for that reason, too.
+    new AnimTestcaseFromBy("none", "none",  { noEffect: 1 }),
+    new AnimTestcaseFromBy("url(#gradA)", "url(#gradB)", { noEffect: 1 }),
+    new AnimTestcaseFromBy("url(#gradA)", "url(#gradB) red", { noEffect: 1 }),
+    new AnimTestcaseFromBy("url(#gradA)", "none", { noEffect: 1 }),
+    new AnimTestcaseFromBy("red", "url(#gradA)", { noEffect: 1 }),
+  ]
 };
 
 // List of attribute/testcase-list bundles to be tested
 var gFromByBundles =
 [
-  new TestcaseBundle(gPropList.fill,           _fromByTestLists.color),
+  new TestcaseBundle(gPropList.fill, [].concat(_fromByTestLists.color,
+                                               _fromByTestLists.paint)),
   new TestcaseBundle(gPropList.font_size,      _fromByTestLists.lengthPx),
   new TestcaseBundle(gPropList.font_size_adjust, [
+    // These testcases implicitly have no effect, because font-size-adjust is
+    // non-additive (and is declared as such in db_smilCSSPropertyList.js)
     new AnimTestcaseFromBy("0.5", "0.1"),
     new AnimTestcaseFromBy("none", "0.1"),
     new AnimTestcaseFromBy("0.1", "none")
   ]),
   new TestcaseBundle(gPropList.lighting_color, _fromByTestLists.color),
   new TestcaseBundle(gPropList.opacity,        _fromByTestLists.opacity),
   new TestcaseBundle(gPropList.stroke_miterlimit, [
     new AnimTestcaseFromBy("1", "1", { midComp: "1.5", toComp: "2" }),
--- a/content/smil/test/db_smilCSSFromTo.js
+++ b/content/smil/test/db_smilCSSFromTo.js
@@ -72,16 +72,17 @@ var _fromToTestLists = {
                             midComp: "rgb(100, 100, 100)" }),
   ],
   colorFromInheritWhite: [
   new AnimTestcaseFromTo("inherit", "rgb(205, 205, 205)",
                          { fromComp: "rgb(255, 255, 255)",
                            midComp: "rgb(230, 230, 230)" }),
   ],
   paintServer: [
+    new AnimTestcaseFromTo("none", "none"),
     new AnimTestcaseFromTo("none", "blue", { toComp : "rgb(0, 0, 255)" }),
     new AnimTestcaseFromTo("rgb(50, 50, 50)", "none"),
     new AnimTestcaseFromTo("url(#gradA)", "url(#gradB) currentColor",
                            { fromComp: "url(\"" + document.URL +
                                        "#gradA\") rgb(0, 0, 0)",
                              toComp: "url(\"" + document.URL +
                                      "#gradB\") rgb(50, 50, 50)" },
                            "need support for URI-based paints"),
--- a/content/smil/test/db_smilCSSPaced.js
+++ b/content/smil/test/db_smilCSSPaced.js
@@ -193,16 +193,32 @@ var gPacedBundles =
                           { comp0:   "0px",
                             comp1_6: "1px",
                             comp1_3: "2px",
                             comp2_3: "4px",
                             comp1:   "6px"
                           }),
     ])
   ),
+  new TestcaseBundle(gPropList.font_size_adjust, [
+    new AnimTestcasePaced("0.2; 0.6; 0.8",
+                          { comp0:   "0.2",
+                            comp1_6: "0.3",
+                            comp1_3: "0.4",
+                            comp2_3: "0.6",
+                            comp1:   "0.8"
+                          }),
+    new AnimTestcasePaced("none; none; 0.5",
+                          { comp0:   "none",
+                            comp1_6: "none",
+                            comp1_3: "none",
+                            comp2_3: "0.5",
+                            comp1:   "0.5"
+                          }),
+  ]),
   new TestcaseBundle(gPropList.font_family, [
     // Sanity check: 'font-family' isn't interpolatable.  It should end up
     // ignoring the calcMode="paced" and falling into discrete-mode.
     new AnimTestcasePaced("serif; sans-serif; monospace",
                           { comp0:   "serif",
                             comp1_6: "serif",
                             comp1_3: "sans-serif",
                             comp2_3: "monospace",
--- a/content/smil/test/smilTestUtils.js
+++ b/content/smil/test/smilTestUtils.js
@@ -492,27 +492,32 @@ extend(AnimTestcaseFromTo, AnimTestcaseF
  * @param aFrom  The 'from' value
  * @param aBy    The 'by' value
  * @param aComputedValMap  A hash-map that contains some computed values that
  *                         we expect to visit, as follows:
  *    - fromComp: Computed value version of |aFrom| (if different from |aFrom|)
  *    - midComp:  Computed value that we expect to visit halfway through the
  *                animation (|aFrom| + |aBy|/2)
  *    - toComp:   Computed value of the animation endpoint (|aFrom| + |aBy|)
+ *    - noEffect: Special flag -- if set, indicates that this testcase is
+ *                expected to have no effect on the computed value. (i.e. the
+ *                attribute may be animatable and additive, but the particular
+ *                "from" & "by" values that are used don't support addition.)
  * @param aSkipReason  If this test-case is known to currently fail, this
  *                     parameter should be a string explaining why.
  *                     Otherwise, this value should be null (or omitted).
  */
 function AnimTestcaseFromBy(aFrom, aBy, aComputedValMap, aSkipReason)
 {
   this.from           = aFrom;
   this.by             = aBy;
   this.computedValMap = aComputedValMap;
   this.skipReason     = aSkipReason;
-  if (this.computedValMap && !this.computedValMap.toComp) {
+  if (this.computedValMap &&
+      !this.computedValMap.noEffect && !this.computedValMap.toComp) {
     ok(false, "AnimTestcaseFromBy needs expected computed final value");
   }
 }
 AnimTestcaseFromBy.prototype =
 {
   // Member variables
   by : null,
 
@@ -522,17 +527,17 @@ AnimTestcaseFromBy.prototype =
     // Call super, and then add my own customization
     var animElem = AnimTestcaseFrom.prototype.setupAnimationElement.apply(this,
                                             [aAnimAttr, aTimeData, aIsFreeze]);
     animElem.setAttribute("by", this.by)
     return animElem;
   },
   buildSeekList : function(aAnimAttr, aBaseVal, aTimeData, aIsFreeze)
   {
-    if (!aAnimAttr.isAdditive) {
+    if (!aAnimAttr.isAdditive || this.computedValMap.noEffect) {
       return this.buildSeekListStatic(aAnimAttr, aBaseVal, aTimeData,
                                       "defined as non-additive in SVG spec");
     }
     // Just use inherited method
     return AnimTestcaseFrom.prototype.buildSeekList.apply(this,
                                 [aAnimAttr, aBaseVal, aTimeData, aIsFreeze]);
   },
 }