OSDN Git Service

Change the frame property of the object
authordhrname <dhrname@users.sourceforge.jp>
Wed, 15 Apr 2015 13:06:04 +0000 (22:06 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Wed, 15 Apr 2015 13:06:04 +0000 (22:06 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index ae56d41..e9a99fa 100644 (file)
@@ -681,8 +681,8 @@ Math.qubicnewton = function(a0, a1, a2, a3, b) {
  * $calcModeオブジェクトから継承*/\r
 base("$calcMode").up("$attribute").mix( {\r
   \r
-  /*前述の$frameオブジェクトでフレームを記述*/\r
-  frame: base("$frame"),\r
+  /*$frameオブジェクトのフレームリスト*/\r
+  frame: [],\r
   \r
   /*アニメーションの対象となる要素。たとえば、animate要素の親要素*/\r
   element: null,\r
@@ -705,7 +705,8 @@ base("$calcMode").up("$attribute").mix( {
       return;\r
     }\r
     /*eleの属性の値を、それぞれオブジェクトに割り当て*/\r
-    var begin = this.frame.$begin,\r
+    var $frame = base("$frame"),\r
+        begin = $frame.$begin,\r
         frame = begin.up().mix( {\r
                   string: (getAttr("begin") || "0"),\r
                   $activate: begin.$activate.up().mix( {\r
@@ -723,7 +724,8 @@ base("$calcMode").up("$attribute").mix( {
       frame.listener( {\r
         timeStamp: Date.now()\r
       } );\r
-      this.frame.addLine(frame);\r
+      $frame.addLine(frame);\r
+      this.frame.push(frame);\r
     }\r
     /*属性を取得するためのインライン関数*/\r
     function getAttr(name) {\r
index d067ac3..cc504c4 100644 (file)
@@ -3311,7 +3311,7 @@ describe("SMIL Animation Spec", function() {
   } );\r
   describe("A $attribute object", function() {\r
     describe("An push method", function() {\r
-      var attr, s, p;\r
+      var attr, s;\r
       beforeEach( function() {\r
         attr = base("$calcMode").$attribute.up("width");\r
         base("$frame").timelines.length = 0;\r
@@ -3320,21 +3320,24 @@ describe("SMIL Animation Spec", function() {
       } );\r
       /*境界条件を調べておく (limit value analysis)*/\r
       it("should be this for the value  (limit value analysis)", function() {\r
-        expect(attr.frame).toBe(base("$frame"));\r
+        expect(attr.frame.length).toEqual(0);\r
         expect(attr.element).toBeNull();\r
         attr.push();\r
         expect(attr.element).toBeNull();\r
-        expect(attr.frame.timelines.length).toEqual(0);\r
+        expect(attr.frame.length).toEqual(0);\r
+        expect(base("$frame").timelines.length).toEqual(0);\r
         \r
         attr.push(s);\r
         expect(attr.element).toBeNull();\r
-        expect(attr.frame.timelines.length).toEqual(0);\r
+        expect(attr.frame.length).toEqual(0);\r
+        expect(base("$frame").timelines.length).toEqual(0);\r
         \r
         var p = document.createElement("g");\r
         p.appendChild(s);\r
         attr.push(s);\r
         expect(attr.element).toBe(p);\r
-        expect(attr.frame.timelines.length).toEqual(0);\r
+        expect(attr.frame.length).toEqual(0);\r
+        expect(base("$frame").timelines.length).toEqual(0);\r
         \r
         s.setAttribute("end", "0");\r
         check("from", 1);\r
@@ -3346,8 +3349,10 @@ describe("SMIL Animation Spec", function() {
           expect(s.hasAttributeNS(null, attrName)).toBeTruthy();\r
           attr.push(s);\r
           expect(attr.element).toBe(p);\r
-          expect(attr.frame.timelines.length).toEqual(num);\r
-          var line = attr.frame.timelines[num-1];\r
+          var timelines = base("$frame").timelines;\r
+          expect(timelines.length).toEqual(num);\r
+          var line = timelines[num-1];\r
+          expect(line).toBe(attr.frame[attr.frame.length-1]);\r
           expect(line.string).toBe("0");\r
           var act = line.$activate;\r
           expect(act.dur).toBeNull();\r
@@ -3362,7 +3367,7 @@ describe("SMIL Animation Spec", function() {
           expect(s.hasAttributeNS(null, attrName)).toBeFalsy();\r
           attr.push(s);\r
           expect(attr.element).toBe(p);\r
-          expect(attr.frame.timelines.length).toEqual(num);\r
+          expect(timelines.length).toEqual(num);\r
         };\r
       } );\r
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
@@ -3399,7 +3404,9 @@ describe("SMIL Animation Spec", function() {
           expect(s.hasAttributeNS(null, attrName)).toBeTruthy();\r
           attr.push(s);\r
           expect(attr.element).toBe(p);\r
-          var line = attr.frame.timelines[attr.frame.timelines.length-1];\r
+          var timelines = base("$frame").timelines;\r
+          var line = timelines[timelines.length-1];\r
+          expect(line).toBe(attr.frame[attr.frame.length-1]);\r
           expect(line.string).toBe(values[0]);\r
           var act = line.$activate;\r
           expect(act.dur).toBe(values[1]);\r
@@ -3413,6 +3420,16 @@ 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
+        var p = document.createElement("g");\r
+        p.appendChild(s);\r
+        \r
+        s.setAttributeNS(null, "begin", "1");\r
+        attr.push(s);\r
+        var timelines = base("$frame").timelines;\r
+        expect(timelines.length).toEqual(0);\r
+        s.setAttributeNS(null, "from", "1");\r
+        attr.push(s);\r
+        expect(timelines.length).toEqual(0);\r
       } );\r
     } );\r
     describe("A getAttr method", function() {\r