OSDN Git Service

Modify the Spec
authordhrname <dhrname@users.sourceforge.jp>
Mon, 4 Apr 2016 11:14:11 +0000 (20:14 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Mon, 4 Apr 2016 11:14:11 +0000 (20:14 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index fe3dcd1..d8134cd 100644 (file)
@@ -477,6 +477,8 @@ base("$from").of( {
   \r
   /*$toオブジェクトにこのオブジェクトを適用させる関数*/\r
   call: function() {\r
+    /*advanceメソッドで使うために、stringを保持*/\r
+    this.numList.string = this.string;\r
     if (this.numList.length\r
           && (this.additive[0] === 0)\r
           && (this.accumulate[0] === 0)\r
@@ -529,8 +531,11 @@ base("$from").of( {
       if ( (t < 0) || (1 < t)) {\r
         throw new Error("An Invalid Number Error");\r
       }\r
-      if (!this.string || !this.from.length) {\r
+      if (!this.string) {\r
         return "";\r
+      } else if (!this.from.length) {\r
+        /*discreteのために、this.stringに数値が入っていない場合の対処*/\r
+        return this.from.string;\r
       }\r
       var str = "",\r
           numList = this.numList,\r
index 48af4b6..248faf9 100644 (file)
@@ -1121,7 +1121,9 @@ describe("SMIL Animation Spec", function() {
       from.up("$to").mix( function() {\r
         this.string = "12cm";\r
         this.call();\r
-        expect(this.numList).toEqual([]);\r
+        var arr = [];\r
+        arr.string = this.string;\r
+        expect(this.numList).toEqual(arr);\r
         expect(this.strList).toBeNull();\r
       } );\r
     } );\r
@@ -1147,7 +1149,12 @@ describe("SMIL Animation Spec", function() {
           from.$to.advance(-0.01);\r
         }).toThrow("An Invalid Number Error");\r
         \r
-        from.string = "0";\r
+        var arr = [];\r
+        \r
+        from = base("$from").up();\r
+        from.up("$to");\r
+        from.$to.from = from;\r
+        arr.string = from.string = "0";\r
         from.$to.string = "1";\r
         expect(from.$to.call()).toBe(from.$to.numList);\r
         expect(from.$to.numList[0]).toBe(1);\r
@@ -1158,6 +1165,22 @@ describe("SMIL Animation Spec", function() {
         expect(from.$to.from).toBe(from.numList);\r
         expect(from.$to.advance(0)).toBe("0");       \r
         expect(from.call()).toBe(from.numList);\r
+        \r
+        from = base("$from").up();\r
+        from.up("$to");\r
+        from.$to.from = from;\r
+        from.string = "inline";\r
+        arr.string = from.$to.string = "block";\r
+        expect(from.$to.call()).toBe(from.$to.numList);\r
+        expect(from.$to.numList).toEqual(arr);\r
+        expect(from.$to.strList).toEqual(["block"]);\r
+        arr.string = from.string;\r
+        expect(from.numList).toEqual(arr);\r
+        expect(from.strList).toEqual(["inline"]);\r
+        expect(from.advance(0)).toBe("");\r
+        expect(from.$to.from).toBe(from.numList);\r
+        expect(from.$to.advance(0)).toBe("inline");       \r
+        expect(from.call()).toBe(from.numList);\r
       } );\r
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
       it("should be this for the value (the valid partion)", function() {\r
@@ -1280,13 +1303,17 @@ describe("SMIL Animation Spec", function() {
         expect(from.setAdditive()).toBe(0);\r
         expect(from.setAdditive("")).toBe(0);\r
         expect(from.additive).toEqual([0]);\r
-        expect(from.setAdditive("1")).toEqual([1]);\r
-        expect(from.additive).toEqual([1]);\r
+        var arr = [1];\r
+        arr.string = "1";\r
+        expect(from.setAdditive("1")).toEqual(arr);\r
+        expect(from.additive).toEqual(arr);\r
       } );\r
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
       it("should be this for the value (the valid partion)", function() {\r
-        expect(from.setAdditive("1 2, 3")).toEqual([1, 2, 3]);\r
-        expect(from.additive).toEqual([1, 2, 3]);\r
+        var arr = [1, 2, 3];\r
+        arr.string = "1 2, 3";\r
+        expect(from.setAdditive("1 2, 3")).toEqual(arr);\r
+        expect(from.additive).toEqual(arr);\r
       } );\r
       /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
       it("should be this for the value (the invalid partion)", function() {\r
@@ -1420,6 +1447,16 @@ describe("SMIL Animation Spec", function() {
       expect(calc.call()(0.3)).toBe("0.5");\r
       /*もう一度確かめる*/\r
       expect(calc.call()(0.2)).toBe("0.5");\r
+      \r
+      calc.to = base("$from").up();\r
+      calc.to.from = base("$from").up();    \r
+      calc.mode = "discrete";\r
+      calc.keyTime = 0.5;\r
+      calc.to.degit = 1;\r
+      calc.to.string = "block";\r
+      calc.to.from.string = "inline";\r
+      expect(calc.call()(0.2)).toBe("inline");\r
+      expect(calc.call()(0.3)).toBe("inline");\r
     } );\r
     /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
     it("should be this for the value (the invalid partion)", function() {\r