OSDN Git Service

Override the setFrame method on the . object
authordhrname <dhrname@users.sourceforge.jp>
Sat, 8 Oct 2016 13:57:36 +0000 (22:57 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sat, 8 Oct 2016 13:57:36 +0000 (22:57 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index 88d7dcf..f9c53be 100644 (file)
@@ -204,6 +204,11 @@ base("$frame").mix ( {
       }\r
       cacheBegin = startTime = endTime = void 0;\r
       return this;\r
+    },\r
+    \r
+    /*入力されたフレーム数fの場面に切り替えるメソッド*/\r
+    setFrame: function( /*number*/ f) {\r
+      this.updateState(f);\r
     }\r
   } );\r
   \r
index b042a95..b26dd43 100644 (file)
@@ -297,6 +297,45 @@ describe("SMIL Animation Spec", function() {
       expect(frame.updateState(4).state).toBe(frame.POSTWAITING);\r
       expect(frame.state).toBe(frame.POSTWAITING);\r
     } );\r
+    /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
+    it("should be this for the value (the invalid partion)", function() {\r
+      expect(frame.updateState()).toBe(frame);\r
+      expect(frame.updateState(null)).toBe(frame);\r
+    });\r
+    describe("the setFrame method (override)", function() {\r
+      var frame = base("$frame").$list.up("$3");\r
+      beforeEach( function() {\r
+          frame.timelines = [];\r
+          frame.isPaused = false;\r
+          frame.state = frame.WAITING;\r
+          frame.begin = 0;\r
+      } );\r
+      afterEach( function() {\r
+          frame.timelines = [];\r
+      } );\r
+      /*境界条件を調べておく (limit value analysis)*/\r
+      it("should be this for the value  (limit value analysis)", function() {\r
+        expect(typeof frame.setFrame).toBe("function");\r
+        \r
+        frame.setFrame(0);\r
+        expect(frame.state).toBe(frame.WAITING);\r
+        frame.setFrame(1);\r
+        expect(frame.state).toBe(frame.WAITING);\r
+        \r
+        function appendBegin(num) {\r
+          frame.state = frame.WAITING;\r
+          frame.beginList = {\r
+            value: num,\r
+            next: frame.beginList\r
+          };\r
+        };\r
+        appendBegin(0);\r
+        frame.setFrame(0);\r
+        expect(frame.state).toBe(frame.BEGINNING);\r
+        frame.setFrame(1);\r
+        expect(frame.state).toBe(frame.PLAYING);\r
+      } );\r
+    } );\r
   } );\r
   describe("$begin object", function() {\r
     var begin = base("$frame").$begin.up();\r