to: "",\r
\r
/*initメソッドで使われるアニメーション関数*/\r
- _setFrame: function () {\r
+ _setFrame: function ($list) {\r
this.setAttribute(this.to);\r
},\r
\r
timeline: base("$frame").$begin,\r
\r
/*アニメが終了した際の後処理*/\r
- _setEndFrame: function (frame) {\r
+ _setEndFrame: function ($list) {\r
/*removeの場合、アニメーションを凍結せずに、もとに戻す*/\r
if (this.fill === "remove") {\r
this.removeAttribute();\r
line.$list.addEvent("end", this._setEndFrame.bind(this));\r
base("$frame").addLine(line.$list);\r
/*アニメーションが再起動する可能性もあるため、$listのstateプロパティはここで初期化*/\r
- line.$list.state = this.$list.WAITING;\r
+ line.$list.state = line.$list.WAITING;\r
}\r
line = thisele = void 0;\r
}\r
return "";\r
},\r
\r
- _setFrame: function(currentTime) {\r
+ _setFrame: function($list) {\r
+ var currentTime = $list.currentFrame;\r
/*durationは単純継続時間\r
*advanceは継続時間内での、進捗率\r
* 仕様を参照 http://www.w3.org/TR/smil-animation/#AnimFuncValues\r
},\r
\r
/*_setEndFrameメソッドは、終了処理と凍結作業をするときに、falseを返す*/\r
- _setEndFrame: function(frame) {\r
+ _setEndFrame: function($list) {\r
+ var frame = $list.currentFrame;\r
/*上書きされたメソッドを呼び出してアニメーションの凍結作業をする*/\r
- if (!this.checkEnd(frame)) {\r
- return;\r
- }\r
if (this.fill === "freeze") {\r
var line = this.timeline,\r
duration = line.simpleDuration;\r
\r
_setEndFrame: function(currentFrame) {\r
var list = this.element.__transformList;\r
- if (!this.checkEnd(currentFrame) || (this.fill !== "remove") || !list) {\r
+ if ((this.fill !== "remove") || !list) {\r
return;\r
}\r
if (!this.isSum) {\r
expect($set.element).toBeNull();\r
} );\r
} );\r
- describe("An checkEnd method", function() {\r
- var $set, ele, frame;\r
- beforeEach( function() {\r
- $set = base("$calcMode").$attribute.$setElement.up();\r
- var p = document.createElementNS("http://www.w3.org/2000/svg", "g");\r
- ele = document.createElementNS("http://www.w3.org/2000/svg", "set");\r
- p.appendChild(ele);\r
- frame = base("$frame");\r
- } );\r
- /*境界条件を調べておく (limit value analysis)*/\r
- it("should be this for the value (limit value analysis)", function() {\r
- expect($set.checkEnd()).toBeFalsy();\r
- $set.init(ele);\r
- frame.setFrame(0);\r
- frame.$endFrame.setFrame(0);\r
- expect($set.checkEnd()).toBeFalsy();\r
- } );\r
- /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
- it("should be this for the value (the valid partion)", function() {\r
- ele.setAttributeNS(null, "dur", "1s");\r
- ele.setAttributeNS(null, "attributeName", "fill");\r
- ele.setAttributeNS(null, "to", "red");\r
- $set.init(ele);\r
- expect($set.checkEnd(0)).toBeFalsy();\r
- expect($set.checkEnd(24)).toBeFalsy();\r
- $set.state = "playing";\r
- expect($set.checkEnd(25)).toBeTruthy();\r
- expect($set.state).toBe("idling");\r
- expect($set.checkEnd(26)).toBeFalsy();\r
- } );\r
- /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/\r
- it("should be this for the value (the invalid partion)", function() {\r
- $set.timeline.isResolved = false;\r
- expect($set.checkEnd(0)).toBeFalsy();\r
- $set.timeline.activeTime = null;\r
- expect($set.checkEnd(0)).toBeFalsy();\r
- $set.timeline = null;\r
- expect(function() {\r
- $set.checkEnd(0);\r
- } ).toThrow();\r
- } );\r
- } );\r
\r
describe("An init method", function() {\r
var $set, ele, frame;\r
/*境界条件を調べておく (limit value analysis)*/\r
it("should be this for the value (limit value analysis)", function() {\r
expect($set.isEnd).toBeFalsy();\r
- expect($set.state).toBe("idling");\r
ele.setAttributeNS(null, "dur", "1s");\r
ele.setAttributeNS(null, "attributeName", "fill");\r
ele.setAttributeNS(null, "to", "red");\r
frame.setFrame(0);\r
frame.$endFrame.setFrame(0);\r
expect(ele.parentNode.getAttributeNS(null, "fill")).toBe("red");\r
- expect($set.state).toBe("playing");\r
\r
frame.setFrame(24);\r
frame.$endFrame.setFrame(24);\r
expect(ele.parentNode.hasAttributeNS(null, "fill")).toBeFalsy();\r
- expect($set.state).toBe("idling");\r
} );\r
/*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
it("should be this for the value (the valid partion)", function() {\r
$animate.init(ele);\r
$animate.isCSS = false;\r
expect(p.getAttributeNS(null, "fill") || null).toBeNull();\r
- expect($animate.state).toBe("idling");\r
evt = ele.ownerDocument.createEvent("MouseEvents");\r
evt.initMouseEvent("beginEvent",true, true, window, 0, 0, 0, 0, 0, false, false, false, false,0, ele);\r
- expect($animate.state).toBe("idling");\r
p.dispatchEvent(evt);\r
- expect($animate.state).toBe("idling");\r
expect(p.getAttributeNS(null, "fill") || null).toBeNull();\r
\r
evt = ele.ownerDocument.createEvent("MouseEvents");\r
frame.setFrame(frame.currentFrame);\r
frame.$endFrame.setFrame(frame.currentFrame);\r
expect($animate.isEnd).toBeFalsy();\r
- expect($animate.state).toBe("idling");\r
p.dispatchEvent(evt);\r
frame.setFrame(frame.currentFrame + 1);\r
frame.$endFrame.setFrame(frame.currentFrame + 1);\r
- expect($animate.state).toBe("playing");\r
frame.setFrame(frame.currentFrame + 24);\r
frame.$endFrame.setFrame(frame.currentFrame + 24);\r
- expect($animate.state).toBe("idling");\r
expect(evt.target.getAttributeNS(null, "fill") || null).toBe("rgb(10, 10, 1)");\r
} );\r
} );\r