From b51fea8161b99fb0d18d6ed8a02674863c51e189 Mon Sep 17 00:00:00 2001 From: dhrname Date: Wed, 4 Mar 2015 23:44:17 +0900 Subject: [PATCH] Support the object --- org/w3c/dom/smil.js | 6 ++++-- tool/Spec/spec/SvgDomSpec.js | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/org/w3c/dom/smil.js b/org/w3c/dom/smil.js index d93ea2a..767a4f0 100644 --- a/org/w3c/dom/smil.js +++ b/org/w3c/dom/smil.js @@ -462,7 +462,7 @@ base("$from").of( { }, /*計算モード。advanceメソッドで時間の圧縮率を求めるのに使う*/ - calcMode: base("$calcMode"), + calc: base("$calcMode"), /*$toオブジェクトにこのオブジェクトを適用させる関数*/ call: function() { @@ -504,6 +504,8 @@ base("$from").of( { if (!this.string || !this.from) { return ""; } + /*時間の圧縮率をもとに変換 ($calcMode オブジェクトを参照)*/ + t = this.calc(t); var str = "", numList = this.numList, strList = this.strList, @@ -533,7 +535,7 @@ base("$from").of( { /*keyTimesの区間 * たとえば、"0, 0.5, 0.7, 1"の場合、時間の区間はそれぞれ、0.5 (=0.5-0) 0.2 (=0.7-0.5) 0.3 (=1-0.7)である * このうち、どれか一つが値として入力される*/ - keyTime: 0, + keyTime: 1, /*keySpline属性の値を設定*/ keySpline: null, diff --git a/tool/Spec/spec/SvgDomSpec.js b/tool/Spec/spec/SvgDomSpec.js index 88473ec..a1d1b82 100644 --- a/tool/Spec/spec/SvgDomSpec.js +++ b/tool/Spec/spec/SvgDomSpec.js @@ -3055,24 +3055,39 @@ describe("SMIL Animation Spec", function() { } ) } ); describe("A $calcMode object", function() { - var calc = base("$calcMode"); + var calc = base("$calcMode"), + from = base("$from"); beforeEach( function() { calc = calc.up(); + from = from.up(); + from.up("$to"); } ); /*境界条件を調べておく (limit value analysis)*/ it("should be this for the value (limit value analysis)", function() { expect(calc.mode).toBe("linear"); - expect(calc.keyTime).toEqual(0); + expect(calc.keyTime).toEqual(1); expect(calc.keySpline).toBeNull(); expect(calc.call()(0)).toEqual(0); - expect(calc.keyTime).toBe(0); - expect(calc.call()(1)).toEqual(0); + expect(calc.keyTime).toBe(1); + expect(calc.call()(1)).toEqual(1); } ); /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/ it("should be this for the value (the valid partion)", function() { calc.keyTime = 0.5; expect(calc.call()(0.2)).toEqual(0.4); + expect(calc.call()(0.3)).toEqual(0.6); + /*もう一度確かめる*/ + expect(calc.call()(0.2)).toEqual(0.4); + + from.$to.calc = from.calc.up(); + from.$to.calc.keyTime = 0.2; + from.string = "0s"; + from.$to.string = "1s"; + from.$to.degit = 1; + from.$to.call(); + from.call(); + expect(from.$to.advance(0.1)).toBe("0.5s"); } ); /*無効同値クラスを調べておく (Equivalence partitioning, the following is the invalid partion)*/ it("should be this for the value (the invalid partion)", function() { -- 2.11.0