svnno****@sourc*****
svnno****@sourc*****
2011年 2月 6日 (日) 22:33:30 JST
Revision: 2374 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2374 Author: dhrname Date: 2011-02-06 22:33:30 +0900 (Sun, 06 Feb 2011) Log Message: ----------- setTranslateメソッドなどを追加 Modified Paths: -------------- trunk/Spec/spec/SvgDomSpec.js Modified: trunk/Spec/spec/SvgDomSpec.js =================================================================== --- trunk/Spec/spec/SvgDomSpec.js 2011-02-06 11:59:45 UTC (rev 2373) +++ trunk/Spec/spec/SvgDomSpec.js 2011-02-06 13:33:30 UTC (rev 2374) @@ -589,7 +589,8 @@ -1, 1, Number.MAX_VALUE, - Number.MIN_VALUE]; + Number.MIN_VALUE, + -Number.MIN_VALUE]; for (var i=0;i<t.length;++i) { m.a = t[i]; m.b = t[i]; @@ -611,5 +612,118 @@ } d = m = null; }); + /*境界条件を調べておく (limit value analysis about the 'setTranslate')*/ + it("should be this for the value, when it calls the 'setTranslate' method", function() { + var t = [0, + -1, + 1, + Number.MAX_VALUE, + Number.MIN_VALUE, + -Number.MIN_VALUE]; + for (var i=0;i<t.length;++i) { + s.setTranslate(t[i], t[i]); + expect(s.type).toEqual(2); //SVG_TRANSFORM_TRANSLATE = 2 + expect(s.angle).toEqual(0); + var d = s.matrix; + expect(d.a).toEqual(1); + expect(d.b).toEqual(0); + expect(d.c).toEqual(0); + expect(d.d).toEqual(1); + expect(d.e).toEqual(t[i]); + expect(d.f).toEqual(t[i]); + } + d = m = null; + }); + /*境界条件を調べておく (limit value analysis about the 'setScale')*/ + it("should be this for the value, when it calls the 'setScale' method", function() { + var t = [0, + -1, + 1, + Number.MAX_VALUE, + Number.MIN_VALUE, + -Number.MIN_VALUE]; + for (var i=0;i<t.length;++i) { + s.setScale(t[i], t[i]); + expect(s.type).toEqual(3); //SVG_TRANSFORM_SCALE = 3 + expect(s.angle).toEqual(0); + var d = s.matrix; + expect(d.a).toEqual(t[i]); + expect(d.b).toEqual(0); + expect(d.c).toEqual(0); + expect(d.d).toEqual(t[i]); + expect(d.e).toEqual(0); + expect(d.f).toEqual(0); + } + d = null; + }); + /*境界条件を調べておく (limit value analysis about the 'setRotate')*/ + it("should be this for the value, when it calls the 'setRotate' method", function() { + var t = [0, + -1, + 1]; + for (var i=0;i<t.length;++i) { + s.setRotate(10, t[i], t[i]); + var m = svg.createSVGMatrix(); + m = m.translate(t[i], t[i]).rotate(10).translate(-t[i], -t[i]); + expect(s.type).toEqual(4); //SVG_TRANSFORM_ROTATE = 4 + expect(s.angle).toEqual(10); + var d = s.matrix; + expect(d.a).toEqual(m.a); + expect(d.b).toEqual(m.b); + expect(d.c).toEqual(m.c); + expect(d.d).toEqual(m.d); + expect(d.e).toEqual(m.e); + expect(d.f).toEqual(m.f); + } + d = m = null; + }); + /*境界条件を調べておく (limit value analysis about the 'setSkewX')*/ + it("should be this for the value, when it calls the 'setSkewX' method", function() { + var t = [0, + -1, + 1, + Number.MAX_VALUE, + Number.MIN_VALUE, + -Number.MIN_VALUE]; + for (var i=0;i<t.length;++i) { + s.setSkewX(t[i]); + var m = svg.createSVGMatrix(); + m = m.skewX(t[i]); + expect(s.type).toEqual(5); //SVG_TRANSFORM_SKEWX = 5 + expect(s.angle).toEqual(t[i]); + var d = s.matrix; + expect(d.a).toEqual(m.a); + expect(d.b).toEqual(m.b); + expect(d.c).toEqual(m.c); + expect(d.d).toEqual(m.d); + expect(d.e).toEqual(m.e); + expect(d.f).toEqual(m.f); + } + t = null; + }); + /*境界条件を調べておく (limit value analysis about the 'setSkewY')*/ + it("should be this for the value, when it calls the 'setSkewY' method", function() { + var t = [0, + -1, + 1, + Number.MAX_VALUE, + Number.MIN_VALUE, + -Number.MIN_VALUE]; + for (var i=0;i<t.length;++i) { + s.setSkewY(t[i]); + var m = svg.createSVGMatrix(); + m = m.skewY(t[i]); + expect(s.type).toEqual(6); //SVG_TRANSFORM_SKEWY = 6 + expect(s.angle).toEqual(t[i]); + var d = s.matrix; + expect(d.a).toEqual(m.a); + expect(d.b).toEqual(m.b); + expect(d.c).toEqual(m.c); + expect(d.d).toEqual(m.d); + expect(d.e).toEqual(m.e); + expect(d.f).toEqual(m.f); + } + t = null; + }); }); }); \ No newline at end of file