From: dhrname Date: Sat, 8 Oct 2016 13:57:36 +0000 (+0900) Subject: Override the setFrame method on the . object X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=83811da99228924809fc5af8d29cce1f4f1381b0;p=sie%2Fsie.git Override the setFrame method on the . object --- diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 88d7dcf..f9c53be 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -204,6 +204,11 @@ base("$frame").mix ( { } cacheBegin = startTime = endTime = void 0; return this; + }, + + /*入力されたフレーム数fの場面に切り替えるメソッド*/ + setFrame: function( /*number*/ f) { + this.updateState(f); } } ); diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index b042a95..b26dd43 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -297,6 +297,45 @@ describe("SMIL Animation Spec", function() { expect(frame.updateState(4).state).toBe(frame.POSTWAITING); expect(frame.state).toBe(frame.POSTWAITING); } ); + /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ + it("should be this for the value (the invalid partion)", function() { + expect(frame.updateState()).toBe(frame); + expect(frame.updateState(null)).toBe(frame); + }); + describe("the setFrame method (override)", function() { + var frame = base("$frame").$list.up("$3"); + beforeEach( function() { + frame.timelines = []; + frame.isPaused = false; + frame.state = frame.WAITING; + frame.begin = 0; + } ); + afterEach( function() { + frame.timelines = []; + } ); + /*境界条件を調べておく (limit value analysis)*/ + it("should be this for the value (limit value analysis)", function() { + expect(typeof frame.setFrame).toBe("function"); + + frame.setFrame(0); + expect(frame.state).toBe(frame.WAITING); + frame.setFrame(1); + expect(frame.state).toBe(frame.WAITING); + + function appendBegin(num) { + frame.state = frame.WAITING; + frame.beginList = { + value: num, + next: frame.beginList + }; + }; + appendBegin(0); + frame.setFrame(0); + expect(frame.state).toBe(frame.BEGINNING); + frame.setFrame(1); + expect(frame.state).toBe(frame.PLAYING); + } ); + } ); } ); describe("$begin object", function() { var begin = base("$frame").$begin.up();