OSDN Git Service

Add the Spec for a splene mode
authordhrname <dhrname@users.sourceforge.jp>
Wed, 1 Apr 2015 13:36:22 +0000 (22:36 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 1 Apr 2015 13:36:22 +0000 (22:36 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 5d04e91..5b9d204 100644 (file)
@@ -586,9 +586,14 @@ base("$from").of( {
        this.keyTime = this.to.distance(this.to.from) / this.norm;\r
        return f;\r
      } else if (this.mode === "spline") {\r
+       var tk = this.keySplines;\r
+       for (var i=0;i<4;++i) {\r
+         if (isNaN(tk[i])) {\r
+           throw new Error("A keySplines attribute error");\r
+         }\r
+       }\r
        this.to.call();\r
-       var tk = this.keySplines,\r
-           x2 = tk[0],\r
+       var x2 = tk[0],\r
            y2 = tk[1],\r
            x3 = tk[2],\r
            y3 = tk[3],\r
index 13ffcce..3a61dd1 100644 (file)
@@ -3267,13 +3267,13 @@ describe("SMIL Animation Spec", function() {
         calc.keySplines = k;\r
         calc.to.degit = 10;\r
         var b = bezier(0,0, k[0],k[1], k[2],k[3], 1,1),\r
-            epsiron = 1e-6; //誤差\r
+            epsilon = 1e-6; //誤差\r
         expect(calc.call()(0)).toBe(b(0).y.toFixed(10));\r
         calc.to.from = from;\r
         expect(calc.call()(1)).toBe(b(1).y.toFixed(10));\r
         calc.to.from = from;\r
         b = b(Math.random());\r
-        expect(Math.abs(calc.call()(b.x) - b.y.toFixed(10))).toBeLessThan(epsiron);\r
+        expect(Math.abs(calc.call()(b.x) - b.y.toFixed(10))).toBeLessThan(epsilon);\r
       };\r
       for (var i=0;i<10000;++i) {\r
         var rand = [Math.random(), Math.random(), Math.random(), Math.random()].sort(function(a,b){return a-b;});\r
@@ -3283,6 +3283,13 @@ describe("SMIL Animation Spec", function() {
     } );\r
     /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
     it("should be this for the value (the invalid partion on a spline mode )", function() {\r
+      calc.mode = "spline";\r
+      calc.keySplines = [0, NaN, 1, 1];\r
+      calc.to.degit = 1;\r
+      calc.to.from = from;\r
+      expect( function() {\r
+        calc.up().call();\r
+      } ).toThrow();\r
     } );\r
   } );\r
 } );\r