svnno****@sourc*****
svnno****@sourc*****
2011年 2月 6日 (日) 20:46:48 JST
Revision: 2372 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2372 Author: dhrname Date: 2011-02-06 20:46:48 +0900 (Sun, 06 Feb 2011) Log Message: ----------- setMatrixメソッドのチェック Modified Paths: -------------- trunk/Spec/spec/SvgDomSpec.js Modified: trunk/Spec/spec/SvgDomSpec.js =================================================================== --- trunk/Spec/spec/SvgDomSpec.js 2011-02-06 11:25:52 UTC (rev 2371) +++ trunk/Spec/spec/SvgDomSpec.js 2011-02-06 11:46:48 UTC (rev 2372) @@ -566,7 +566,7 @@ * * *The object is initialized to an identity matrix transform (SVG_TRANSFORM_MATRIX). */ - expect(s.type).toEqual(1); + expect(s.type).toEqual(1); //SVG_TRANSFORM_MATRIX = 1 expect(s.angle).toEqual(0); var d = s.matrix; expect(d.a).toEqual(1); @@ -577,23 +577,39 @@ expect(d.f).toEqual(0); d = null; }); - it("for the default value on the property of SVGTransform", function() { + /*境界条件を調べておく (limit value analysis about the 'setMatrix')*/ + it("should be this for the value, when it calls the 'setMatrix' method", function() { /*7.14.4 Interface SVGTransform *http://www.w3.org/TR/SVG/coords.html#InterfaceSVGTransform * * *void setMatrix(in SVGMatrix matrix) * *values from the parameter matrix are copied, the matrix parameter does not replace SVGTransform::matrix. */ - expect(s.type).toEqual(1); - 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(0); - expect(d.f).toEqual(0); - d = null; + var m = svg.createSVGMatrix(), t = [0, + -1, + 1, + Number.MAX_VALUE, + Number.MIN_VALUE]; + for (var i=0;i<t.length;++i) { + m.a = t[i]; + m.b = t[i]; + m.c = t[i]; + m.d = t[i]; + m.e = t[i]; + m.f = t[i]; + s.setMatrix(m); + expect(s.type).toEqual(1); + expect(s.angle).toEqual(0); + 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); + expect(d).toNotBe(m); + } + d = m = null; }); }); }); \ No newline at end of file