[Sie-announce] SIEコード [2323] SVGMatrixのinverseメソッドを記述

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 1月 23日 (日) 23:03:45 JST


Revision: 2323
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2323
Author:   dhrname
Date:     2011-01-23 23:03:45 +0900 (Sun, 23 Jan 2011)

Log Message:
-----------
SVGMatrixのinverseメソッドを記述

Modified Paths:
--------------
    trunk/Spec/SvgDomSpec.js

Modified: trunk/Spec/SvgDomSpec.js
===================================================================
--- trunk/Spec/SvgDomSpec.js	2011-01-23 09:44:29 UTC (rev 2322)
+++ trunk/Spec/SvgDomSpec.js	2011-01-23 14:03:45 UTC (rev 2323)
@@ -137,7 +137,7 @@
         var ti = t[i], sn = function() {
           s.newValueSpecifiedUnits(ti, 0);
         };
-        expect(sn).toThrow("Not Supported Error");
+        expect(sn).toThrow();
         ti = sn = null;
       }
       t = null;
@@ -184,7 +184,7 @@
       expect(s.e).toEqual(0);
       expect(s.f).toEqual(0);
     });
-    /*境界条件を調べておく (limit value analysis)*/
+    /*境界条件を調べておく (limit value analysis about a 'multiply')*/
     it("should be this for the value, when it calls a 'multiply' method", function() {
       var t = [Number.MAX_VALUE, Number.MIN_VALUE, 0, Number.MAX_VALUE/2, Number.MIN_VALUE/2, 0];
       for (var i=0,tli=t.length;i<tli;++i) {
@@ -278,6 +278,40 @@
       }
       t = null;
     });
-
+    /*逆行列に関する境界条件を調べておく (limit value analysis about a 'inverse')*/
+    it("should be this for the value, when it calls a 'inverse' method", function() {
+      var si = s.inverse(), t = [s.multiply(si), si.multiply(s)];
+      s.a = -1;
+      si = s.inverse();
+      t[t.length] = s.multiply(si);
+      t[t.length] = si.multiply(s);
+      s.a = 1;
+      s.d = -1;
+      si = s.inverse();
+      t[t.length] = s.multiply(si);
+      t[t.length] = si.multiply(s);
+      s.b = -1;
+      s.c = 1;
+      s.d = 1;
+      si = s.inverse();
+      t[t.length] = s.multiply(si);
+      t[t.length] = si.multiply(s);
+      s.b = 1;
+      s.c = -1;
+      si = s.inverse();
+      t[t.length] = s.multiply(si);
+      t[t.length] = si.multiply(s);
+      for (var i=0;i<t.length;++i) {
+        var d = t[i];
+        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;
+      }
+      si = t = null;
+    });
   });
 });
\ No newline at end of file




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