OSDN Git Service

Modify a call method of the object
authordhrname <dhrname@users.sourceforge.jp>
Sat, 7 Mar 2015 12:45:55 +0000 (21:45 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sat, 7 Mar 2015 12:45:55 +0000 (21:45 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 9326765..fa6f393 100644 (file)
@@ -415,9 +415,8 @@ base("$frame").mix ( {
         return null;\r
       }\r
       this.parse(this.string);\r
-      return this.isResolved ?\r
-               this.begin\r
-             : "indefinite";\r
+      return this.isResolved ? this.begin\r
+                             : "indefinite";\r
     }\r
   } ).mix( {\r
     /*イベントリスナー用の関数*/\r
@@ -562,12 +561,10 @@ base("$from").of( {
      this.to.call();\r
      return function(t) {\r
        /*tは進捗率*/\r
-       if (!this.keyTime) {\r
-         t = 0;\r
-       } \r
+       !this.keyTime && (t = 0);\r
        t = t / this.keyTime;\r
-       console.log(this.to.from);\r
-       return this.to.advance(t);\r
+       return isNaN(t) ? "0"\r
+                       : this.to.advance(t);\r
      }.bind(this);\r
    }\r
 } ).to = base("$from").$to;\r
index a48b149..8597779 100644 (file)
@@ -3113,10 +3113,14 @@ describe("SMIL Animation Spec", function() {
       expect(calc.call()(0)).toBe("0");\r
       expect(calc.keyTime).toBe(1);\r
       expect(calc.call()(1)).toBe("1");\r
+      \r
+      calc.keyTime = 0;\r
+      expect(calc.call()(1)).toBe("0");\r
     } );\r
     /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
     it("should be this for the value (the valid partion)", function() {\r
       calc.keyTime = 0.5;\r
+      calc.to.degit = 1;\r
       expect(calc.call()(0.2)).toBe("0.4");\r
       expect(calc.call()(0.3)).toBe("0.6");\r
       /*もう一度確かめる*/\r
@@ -3130,9 +3134,22 @@ describe("SMIL Animation Spec", function() {
       calc.to.string = "1s";\r
       calc.to.degit = 1;\r
       expect(calc.call()(0.1)).toBe("0.5s");\r
+\r
+      calc = base("$calcMode").up();\r
+      calc.keyTime = 0.5;\r
+      calc.to = base("$from").up();\r
+      calc.to.from = base("$from").up();    \r
+      calc.to.from.string = "rgb(100, 20, 32)";\r
+      calc.to.string = "rgb(0, 10, 50)";\r
+      expect(calc.call()(0.25)).toBe("rgb(50, 15, 41)");\r
     } );\r
     /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
     it("should be this for the value (the invalid partion)", function() {\r
+      calc.keyTime = null;\r
+      expect(calc.call()(1)).toEqual("0");\r
+      \r
+      calc.keyTime = 1/0;\r
+      expect(calc.call()(1)).toEqual("0");\r
     } );\r
   } );\r
 } );\r