[Sie-announce] SIEコード [2428] setMatrixメソッドに関する同値テストを追加

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 2月 23日 (水) 23:04:36 JST


Revision: 2428
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2428
Author:   dhrname
Date:     2011-02-23 23:04:36 +0900 (Wed, 23 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-23 14:01:42 UTC (rev 2427)
+++ trunk/Spec/spec/SvgDomSpec.js	2011-02-23 14:04:36 UTC (rev 2428)
@@ -612,6 +612,40 @@
       }
       d = m = null;
     });
+    /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/
+    it("should be this for the value, when it calls a 'setMatrix' method", function() {
+      var m = svg.createSVGMatrix(), t = [Math.PI, 10/3], num = (t[0]+"").length - 1;
+      for (var i=1;i<num;++i) {
+        t[t.length] = Math.pow(10, i);
+        t[t.length] = Math.pow(10, -i);
+        t[t.length] = Math.pow(10, i);
+        t[t.length] = Math.pow(10, -i);
+      }
+      for (var i=0,tli=t.length;i<tli;++i) {
+        var n = svg.createSVGMatrix(), ti = t[i];
+        n.a = ti;
+        n.b = ti;
+        n.c = ti;
+        n.d = ti;
+        n.e = ti;
+        n.f = ti;
+        s.setMatrix(n);
+        s.setMatrix(n); //二重に指定しても問題はないはず
+        expect(s.type).toEqual(1);
+        expect(s.angle).toEqual(0);
+        var d = s.matrix;
+        /*注:sが単位行列であることに注意すること (Note that the variable 's' is a identity matrix)*/
+        expect(d.a).toEqual(ti);
+        expect(d.b).toEqual(ti);
+        expect(d.c).toEqual(ti);
+        expect(d.d).toEqual(ti);
+        expect(d.e).toEqual(ti);
+        expect(d.f).toEqual(ti);
+        expect(d).toNotBe(n);
+        n = d = null;
+      }
+      t = null;
+    });
     /*境界条件を調べておく (limit value analysis about the 'setTranslate')*/
     it("should be this for the value, when it calls the 'setTranslate' method", function() {
       var t = [0,




Sie-announce メーリングリストの案内
Back to archive index