OSDN Git Service

New a listener method in the object
authordhrname <dhrname@users.sourceforge.jp>
Thu, 5 Feb 2015 12:08:25 +0000 (21:08 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Thu, 5 Feb 2015 12:08:25 +0000 (21:08 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 2222dcd..8290f65 100644 (file)
@@ -201,15 +201,6 @@ base("$frame").mix ( {
     /*イベントが適用される要素*/\r
     eventTarget: document.documentElement,\r
     \r
-    /*イベントのリスナーとして、parseメソッドで使う*/\r
-    listener: function(evt) {\r
-      /*以下の式については、開始時刻を求める式なので、\r
-       * W3C仕様 SMILアニメーション 「3.2.1. アニメーション関数のタイミング」を参照*/\r
-      var rD = evt.timeStamp - Date.now(),\r
-          o = Math.abs(this.begin),\r
-          mb = o - ( d * Math.floor(o / d) ) - rD;\r
-    },\r
-\r
     /*trim メソッド\r
      * 文字列中の空白を除去*/\r
     trim: function() {\r
@@ -264,7 +255,7 @@ base("$frame").mix ( {
     },\r
     \r
     /*parse メソッド\r
-     * stringプロパティを解析して、時刻を算出し、結果を$frame::beginプロパティに出力\r
+     * stringプロパティを解析して、フレーム数を算出し、結果を$frame::beginプロパティに出力\r
      * また、イベントリスナーに登録をしておく*/\r
     parse: function() {\r
       this.begin = 0;\r
@@ -285,17 +276,35 @@ base("$frame").mix ( {
         /*イベントもindefiniteもないので、解決済みと考える*/\r
         this.isResolved = true;\r
       }\r
+      this.begin = Math.floor( this.begin * this.fpms);\r
       if (event) {\r
         ele = event.id ? this.eventTarget.ownerDocument.getElementById(event.id)\r
                         : this.eventTarget;\r
         ele && ele.addEventListener(event.event, this.listener.bind(this));\r
       }\r
       return this;\r
+    },\r
+    \r
+    /*イベントのリスナーとして、parseメソッドで使う*/\r
+    listener: function(evt) {\r
+      var s = this.$activate.up();\r
+      /*イベント発生時の時間*/\r
+      s.timeStamp= evt.timeStamp;\r
+      this.addLine(s.call());\r
+      return s;\r
+    }\r
+  } ).up("$activate").of( {\r
+    /*$activate オブジェクト\r
+     * 活動持続時間などを計算するための計算実体*/\r
+     \r
+    /*解決した(計算する)ときの時間*/\r
+    resolovedTime: function() {\r
+      return Date.now();\r
     }\r
   } );\r
 } );\r
 /*$presentvalue オブジェクト\r
- * 呈示値 (presentation value)の計算をする。値そのものを返すためのオブジェクト*/\r
+ * 呈示値 (presentation value)の計算をする。値そのものを返すための計算実体*/\r
 base("$presentvalue").mix( {\r
 } );\r
 //#endif // _SMIL_IDL_\r
index 2db3a0d..aa29a96 100644 (file)
@@ -2331,11 +2331,11 @@ describe("SMIL Animation Spec", function() {
         begin.string="+0";\r
         expect(begin.parse().begin).toEqual(0);\r
         begin.string = "+1";\r
-        expect(begin.parse().begin).toEqual(1000);\r
+        expect(begin.parse().begin).toEqual(1000*begin.fpms);\r
         begin.string = " ";\r
         expect(begin.parse().begin).toEqual(0);\r
         begin.string = "1";\r
-        expect(begin.parse().begin).toEqual(1000);\r
+        expect(begin.parse().begin).toEqual(1000*begin.fpms);\r
         begin.string = "+0ms";\r
         expect(begin.parse().begin).toEqual(0);\r
         begin.string = "-0ms";\r
@@ -2349,20 +2349,17 @@ describe("SMIL Animation Spec", function() {
       /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
       it("should be this for the value (the valid partion)", function() {\r
         begin.string = " 1 0 0 m s";\r
-        expect(begin.parse().begin).toEqual(100);\r
-        begin.string = "ms";\r
-        begin.isResolved = false;\r
-        expect(begin.parse().begin).toEqual(0);\r
-        expect(begin.isResolved).toBeFalsy();\r
+        expect(begin.parse().begin).toEqual(Math.floor(100*begin.fpms));\r
+\r
         begin.string = "1ms";\r
         begin.isResolved = false;\r
-        expect(begin.parse().begin).toEqual(1);\r
+        expect(begin.parse().begin).toEqual(Math.floor(1*begin.fpms));\r
         expect(begin.isResolved).toBeTruthy();\r
 \r
         begin.string="click+0";\r
         expect(begin.parse().begin).toEqual(0);\r
         begin.string = "click+1";\r
-        expect(begin.parse().begin).toEqual(1000);\r
+        expect(begin.parse().begin).toEqual(1000*begin.fpms);\r
         begin.string = " click ";\r
         expect(begin.parse().begin).toEqual(0);\r
         begin.string = "click+0ms";\r
@@ -2373,7 +2370,7 @@ describe("SMIL Animation Spec", function() {
         begin.string="id.click+0";\r
         expect(begin.parse().begin).toEqual(0);\r
         begin.string = "id.click+1";\r
-        expect(begin.parse().begin).toEqual(1000);\r
+        expect(begin.parse().begin).toEqual(1000*begin.fpms);\r
         begin.string = " id . click ";\r
         expect(begin.parse().begin).toEqual(0);\r
         begin.string = "id.click+0ms";\r
@@ -2383,7 +2380,30 @@ 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)", function() {\r
-        \r
+        begin.string = "ms";\r
+        begin.isResolved = false;\r
+        expect(begin.parse().begin).toEqual(0);\r
+        expect(begin.isResolved).toBeFalsy();\r
+      } );\r
+    } );\r
+    \r
+    describe("A listener method in $begin object", function() {\r
+       beforeEach( function() {\r
+        begin.string = "";\r
+      } );\r
+      /*境界条件を調べておく (limit value analysis)*/\r
+      it("should be this for the value  (limit value analysis)", function() {\r
+        expect(begin.listener({\r
+            timeStamp: 0\r
+          }).timeStamp).toEqual(0);\r
+      } );\r
+      /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
+      it("should be this for the value (the valid partion)", function() {\r
+\r
+      } );\r
+      /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
+      it("should be this for the value (the invalid partion)", function() {\r
+\r
       } );\r
     } );\r
   } );\r