From 471ccd46330f4f7db262e2db2fddb76f3cdc4c85 Mon Sep 17 00:00:00 2001 From: dhrname Date: Sat, 14 Feb 2015 21:46:24 +0900 Subject: [PATCH] Modify an addLine method --- org/w3c/dom/smil.js | 3 +++ tool/Spec/spec/SvgDomSpec.js | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index 565bf46..a70e506 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -168,6 +168,9 @@ base("$frame").mix ( { /*どちらのプロパティも未確認の場合、タイムラインは追加されない*/ return false; } + if ( this.timelines.indexOf(obj) >= 0 ) { + this.removeLine(obj); + } this.timelines.push( obj ); return true; }, diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 4c17cdf..b5001f8 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -2101,7 +2101,15 @@ describe("SMIL Animation Spec", function() { var timeline = frame.timelines[0]; expect(timeline.begin).toBe(0); expect(timeline.activeTime).toBe(0); - + /*timelineの再追加*/ + expect(frame.timelines[0]).toBe(timeline); + frame.addLine({begin:1, activeTime:1}); + expect(frame.timelines[1]).not.toBe(timeline); + frame.addLine(timeline); + expect(frame.timelines[0]).not.toBe(timeline); + expect(frame.timelines[1]).toBe(timeline); + + timeline = frame.timelines[0]; frame.removeLine({}); expect(frame.timelines[0]).toBe(timeline); frame.removeLine(timeline); @@ -2407,15 +2415,34 @@ describe("SMIL Animation Spec", function() { obj.up().mix( { begin: 1, $activate: begin.$activate.up().mix( { - dur: "12" + end: begin.$activate.end.up().mix( { + string: "1s" + } ) } ) }) .listener( { timeStamp: 0 } ); expect(obj.$1.begin).toBe(1); - expect(obj.$1.activeTime).toEqual(Math.floor(12000*obj.fpms)); + expect(obj.$1.activeTime).toEqual(Math.floor(1000*obj.fpms) - 1); + expect(obj.$1.$activate.begin).toBe(obj.$1.begin); + expect(obj.timelines[0]).toBe(obj.$1); + obj.up().mix( { + begin: 1, + $activate: begin.$activate.up().mix( { + end: begin.$activate.end.up().mix( { + string: "1s" + } ) + } ) + }) + .listener( { + timeStamp: 0 + } ); + expect(obj.$1.begin).toBe(1); + expect(obj.$1.activeTime).toEqual(Math.floor(1000*obj.fpms) - 1); + expect(obj.$1.$activate.begin).toBe(obj.$1.begin); + expect(obj.timelines[1]).toBe(obj.$1); } ); /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ it("should be this for the value (the invalid partion)", function() { -- 2.11.0