gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob include/vob/Coorder.hxx src/jni/Transfor...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/Coorder.hxx src/jni/Transfor...
Date: Wed, 23 Apr 2003 09:35:25 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/04/23 09:35:25

Modified files:
        include/vob    : Coorder.hxx 
        src/jni        : Transform.cxx 
        test/vob/api   : vobcoorder.test 

Log message:
        A Coredumping test

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/Coorder.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Transform.cxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/api/vobcoorder.test.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: libvob/include/vob/Coorder.hxx
diff -u libvob/include/vob/Coorder.hxx:1.4 libvob/include/vob/Coorder.hxx:1.5
--- libvob/include/vob/Coorder.hxx:1.4  Tue Apr  1 06:03:54 2003
+++ libvob/include/vob/Coorder.hxx      Wed Apr 23 09:35:25 2003
@@ -102,6 +102,7 @@
                             int *inds2, float *points2, 
                             float fract, bool show1) ;
 
+    int size() { return cs.size(); }
     Transform *get(int i) {
        return cs[i];
     }
Index: libvob/src/jni/Transform.cxx
diff -u libvob/src/jni/Transform.cxx:1.4 libvob/src/jni/Transform.cxx:1.5
--- libvob/src/jni/Transform.cxx:1.4    Wed Apr 23 09:21:20 2003
+++ libvob/src/jni/Transform.cxx        Wed Apr 23 09:35:25 2003
@@ -52,13 +52,19 @@
                         (float)0, (bool)true);
 
       DBG(dbg_trans) << "SetPoints -- now: "<<coordsys<<"\n";
+      if(coordsys < 0 || coordsys > coordset.size()) {
+        jclass Exception = env->FindClass("java/lang/Exception");
+        env->ThrowNew(Exception,"Invalid coordsys ind!");
+       return false;
+      }
 
      int arrayLength = env->GetArrayLength(j_points);
      jfloat *points = env->GetFloatArrayElements(j_points, 0);
      int nInto = env->GetArrayLength(j_into);
-     if(arrayLength != nInto) {
+     if(arrayLength % 3 || arrayLength != nInto) {
         jclass Exception = env->FindClass("java/lang/Exception");
         env->ThrowNew(Exception,"Invalid into array length");
+       return false;
      }
      jfloat *into = env->GetFloatArrayElements(j_into, 0);
 
Index: libvob/test/vob/api/vobcoorder.test
diff -u libvob/test/vob/api/vobcoorder.test:1.4 
libvob/test/vob/api/vobcoorder.test:1.5
--- libvob/test/vob/api/vobcoorder.test:1.4     Mon Apr 14 08:13:29 2003
+++ libvob/test/vob/api/vobcoorder.test Wed Apr 23 09:35:25 2003
@@ -20,11 +20,14 @@
 # 
 # 
 
+from __future__ import nested_scopes
 
 
 from java.awt import Color
 from test.tools.gfx import *
 
+from jarray import zeros
+
 vs = getvs()
 c = vs.coords
 
@@ -35,6 +38,24 @@
 
     cs2 = c.scale(0, 2, 3)
     checkTrans(vs, cs2, [0, 0, 0, 1, 1, 1], [0, 0, 0, 2, 3, 1])
+
+def testFailTrans():
+    def er(x):
+       ok = 0
+       try:
+           x()
+       except e:
+           ok = 1
+       assert ok
+    cs1 = c.ortho(0, 5, 10, 15, 0.5, 1)
+    v2 = zeros(2, 'f')
+    v3 = zeros(3, 'f')
+    vs.coords.transformPoints3(0, v3, v3)
+    vs.coords.transformPoints3(cs1, v3, v3)
+    er(lambda : vs.coords.transformPoints3(-1, v3, v3))
+    er(lambda : vs.coords.transformPoints3(cs1+500000, v3, v3))
+    
+    
 
 def testActivateSimply():
     """First, trivial test: two "buttons", activate




reply via email to

[Prev in Thread] Current Thread [Next in Thread]