gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO Documentation/VISION gfx/libutil/sav...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO Documentation/VISION gfx/libutil/sav...
Date: Wed, 16 Oct 2002 03:47:04 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/16 03:46:39

Modified files:
        .              : TODO 
        Documentation  : VISION 
        gfx/libutil    : saveanim.py 
        gzz/client/gl  : GLScreen.java 
        gzz/view       : CellVobFactory.java 
        gzz/vob        : OrthoCoorder.java OrthoCoordsys.java 
                         SolidBgVob.java TextVob.java 
        test           : testutil.py 
        test/gzz/gfx/gl: paper.test 
        test/gzz/view  : cellvobfactory.test 
        test/tools     : gfx.py 
Added files:
        test/gzz/vob   : textvob.test 

Log message:
        Testing graphics

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.296&tr2=1.297&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Documentation/VISION.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/saveanim.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/gl/GLScreen.java.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellVobFactory.java.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoCoorder.java.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/OrthoCoordsys.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/SolidBgVob.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/TextVob.java.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/testutil.py.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/paper.test.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/view/cellvobfactory.test.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/vob/textvob.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/tools/gfx.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/Documentation/VISION
diff -c gzz/Documentation/VISION:1.4 gzz/Documentation/VISION:1.5
*** gzz/Documentation/VISION:1.4        Tue Oct  8 05:36:10 2002
--- gzz/Documentation/VISION    Wed Oct 16 03:46:39 2002
***************
*** 42,54 ****
  
  Structure
  
  
  Storage
-     Eternal blocks of data identified by hashes.
  
!     Ability to search for Xu links outside local context
  
!     Blocks should move easily between machines
  
      Redaction of parts of blocks when publishing around certain circle
  
--- 42,67 ----
  
  Structure
  
+     zzStructure
+ 
+     Xanadu hypertext model
  
  Storage
  
!     P2P storage of data in eternal blocks
!     of data identified by hashes.
! 
! --- Research:
  
! User interfaces
! 
!     Research on the new possibilities that a more hyperstructural
!     approach to information opens to user interfaces. Many more 
!     things can be done.
! 
! Storage
! 
!     Ability to search for Xu links outside local context
  
      Redaction of parts of blocks when publishing around certain circle
  
***************
*** 57,59 ****
--- 70,73 ----
      Interaction with digital signatures
  
      Pointers
+ 
Index: gzz/TODO
diff -c gzz/TODO:1.296 gzz/TODO:1.297
*** gzz/TODO:1.296      Wed Oct 16 02:15:12 2002
--- gzz/TODO    Wed Oct 16 03:46:38 2002
***************
*** 34,39 ****
--- 34,53 ----
        - genimages lazily: pass existing images. Must check that the
          file is not zero-length though. Proper framework:
          get pdf and ps file size.
+       - complete test bodies in test/gzz/vob/textvob.test
+       - see (with ibid and buildbot) how we could run all tests nightly
+         on 
+           - pure software Mesa
+           - G400
+           - ATI 7500
+           - GeForce3
+           - GeForce4Ti
+           - GeForce2
+               -- others??
+         Note that only the tests in gzz/vob, gzz/view and gzz/gfx
+         are affected by the cards for now.
+         Also, make it possible to trigger these tests by daytime
+         (e.g. after having changed something relevant)
        - speed up tests: currently too much execfile().. could
          pre-compile and exec compiled in the same globals().
      tuukkah:
***************
*** 85,92 ****
        + [GI03] libpaper paletted texture (general)
        + [GI03] irregu animations
        + [GI03] paper animations?
-       - PEG 1009
-       - graphics tests that work for both OpenGL and AWT
        - Main zz view:
              - Clipping in awt
            - cell size in OpenGL
--- 99,104 ----
Index: gzz/gfx/libutil/saveanim.py
diff -c gzz/gfx/libutil/saveanim.py:1.1 gzz/gfx/libutil/saveanim.py:1.2
*** gzz/gfx/libutil/saveanim.py:1.1     Fri Oct  4 18:16:50 2002
--- gzz/gfx/libutil/saveanim.py Wed Oct 16 03:46:39 2002
***************
*** 4,21 ****
  from gzz.gfx.gl import GL
  import os
  
! def saveframe(filename, win):
      x,y = 0,0
      s = win.getSize()
!     w,h = s.width, s.height
! 
!     v = GL.createByteVector(w * h * 3)
!     v.readFromBuffer_ubytes(win.window, "FRONT", x, y, w, h, "RGB")
!     barr = v.get()
!     f = FileOutputStream("img.tmp")
!     f.write(barr)
!     f.close()
!     os.system("rawtoppm %(w)s %(h)s img.tmp | pnmflip -tb | pnmtojpeg 
>%(filename)s" % locals())
  
  def savesequence(win, filebase, vs1, vs2, n):
      for frame in range(0, n+1):
--- 4,13 ----
  from gzz.gfx.gl import GL
  import os
  
! def save():
      x,y = 0,0
      s = win.getSize()
!     colors = win.readPixels(0, 0, s.width, s.height)
  
  def savesequence(win, filebase, vs1, vs2, n):
      for frame in range(0, n+1):
Index: gzz/gzz/client/gl/GLScreen.java
diff -c gzz/gzz/client/gl/GLScreen.java:1.36 
gzz/gzz/client/gl/GLScreen.java:1.37
*** gzz/gzz/client/gl/GLScreen.java:1.36        Mon Oct 14 14:15:19 2002
--- gzz/gzz/client/gl/GLScreen.java     Wed Oct 16 03:46:39 2002
***************
*** 33,39 ****
  import java.util.HashMap;
  
  public class GLScreen extends GraphicsAPI.Window {
! public static final String rcsid = "$Id: GLScreen.java,v 1.36 2002/10/14 
18:15:19 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
--- 33,39 ----
  import java.util.HashMap;
  
  public class GLScreen extends GraphicsAPI.Window {
! public static final String rcsid = "$Id: GLScreen.java,v 1.37 2002/10/16 
07:46:39 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
***************
*** 264,272 ****
        GL.ByteVector v = GL.createByteVector(w*h*4);
        Dimension d = getSize();
        v.readFromBuffer_ubytes(window, "FRONT",
!                   x, d.height-1-y, w, h,
                    "BGRA");
!       return v.getInts();
      }
      public float timeRender(VobScene vs, int iters) {
        return ((GLVobCoorder)vs.coords).timeRender(window, (GLVobMap)vs.map,
--- 264,281 ----
        GL.ByteVector v = GL.createByteVector(w*h*4);
        Dimension d = getSize();
        v.readFromBuffer_ubytes(window, "FRONT",
!                   x, d.height-y-h, w, h,
                    "BGRA");
!       int[] res = v.getInts();
!       // Exchange to get it right way up
!       for(int row = 0; row < h/2; row++) {
!           for(int col = 0; col < w; col++) {
!               int tmp = res[row*w + col];
!               res[row*w + col] = res[(h-1-row)*w + col];
!               res[(h-1-row)*w + col] = tmp;
!           }
!       }
!       return res;
      }
      public float timeRender(VobScene vs, int iters) {
        return ((GLVobCoorder)vs.coords).timeRender(window, (GLVobMap)vs.map,
Index: gzz/gzz/view/CellVobFactory.java
diff -c gzz/gzz/view/CellVobFactory.java:1.23 
gzz/gzz/view/CellVobFactory.java:1.24
*** gzz/gzz/view/CellVobFactory.java:1.23       Mon Oct 14 06:11:12 2002
--- gzz/gzz/view/CellVobFactory.java    Wed Oct 16 03:46:39 2002
***************
*** 46,52 ****
   */
  
  public class CellVobFactory implements CellView {
! public static final String rcsid = "$Id: CellVobFactory.java,v 1.23 
2002/10/14 10:11:12 tjl Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
--- 46,52 ----
   */
  
  public class CellVobFactory implements CellView {
! public static final String rcsid = "$Id: CellVobFactory.java,v 1.24 
2002/10/16 07:46:39 tjl Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
***************
*** 125,138 ****
  
      static Rectangle rect = new Rectangle();
  
!     /** Add the vobs that make up a cell into the given coordinate
       * system of the given vobscene.
       * @param c The cell
       * @param v The vobscene to add to
!      * @param cs The coordinate system index.
!      * @param w The w
!      * @param h The w
!      *                        when mapped .
       */
      public void place(final Cell c, final VobScene v, 
                        final Box box,
--- 125,137 ----
  
      static Rectangle rect = new Rectangle();
  
!     /** Add the vobs that make up an image of a cell 
!      * into the given coordinate
       * system of the given vobscene.
       * @param c The cell
       * @param v The vobscene to add to
!      * @param box The box in which the cell should be.
!      * @param context The view context, for querying cursors, marks etc.
       */
      public void place(final Cell c, final VobScene v, 
                        final Box box,
Index: gzz/gzz/vob/OrthoCoorder.java
diff -c gzz/gzz/vob/OrthoCoorder.java:1.35 gzz/gzz/vob/OrthoCoorder.java:1.36
*** gzz/gzz/vob/OrthoCoorder.java:1.35  Tue Oct 15 09:29:19 2002
--- gzz/gzz/vob/OrthoCoorder.java       Wed Oct 16 03:46:39 2002
***************
*** 28,34 ****
   */
  
  public class OrthoCoorder extends VobCoorder {
! public static final String rcsid = "$Id: OrthoCoorder.java,v 1.35 2002/10/15 
13:29:19 tjl Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
--- 28,34 ----
   */
  
  public class OrthoCoorder extends VobCoorder {
! public static final String rcsid = "$Id: OrthoCoorder.java,v 1.36 2002/10/16 
07:46:39 tjl Exp $";
      public static boolean dbg = false;
      private static void p(String s) { if(dbg) pa(s); }
      private static void pa(String s) { System.err.println(s); }
***************
*** 42,47 ****
--- 42,49 ----
        { return (a + fract * (b-a)); }
  
  
+     float[] cs1rect = new float[4];
+     float[] cs2rect = new float[4];
  
      void setInterpInfo(int cs1, OrthoCoorder other, int cs2,
                              float fract,
***************
*** 49,64 ****
                              float xscale, float yscale,
                              OrthoRenderInfo info
                        ) {
            OrthoCoordsys sys1 = sys, sys2 = other.sys;
            info.setCoords(sys1.depth[cs1],
!                       xscale * i(sys1.x[cs1], sys2.x[cs2], fract) + xoffs,
!                       yscale * i(sys1.y[cs1], sys2.y[cs2], fract) + yoffs,
!                       xscale * i(sys1.w[cs1], sys2.w[cs2], fract),
!                       yscale * i(sys1.h[cs1], sys2.h[cs2], fract),
!                       xscale * i(sys1.cx(cs1), sys2.cx(cs2), fract) + xoffs,
!                       yscale * i(sys1.cy(cs1), sys2.cy(cs2), fract) + yoffs,
!                       xscale * i(sys1.cw(cs1), sys2.cw(cs2), fract),
!                       yscale * i(sys1.ch(cs1), sys2.ch(cs2), fract));
            p("SetInterp: "+info.x+" "+info.y+" "+info.w+" "+info.h +
                        " \n\t"+xoffs+" "+yoffs+" "+xscale+" "+yscale);
      }
--- 51,70 ----
                              float xscale, float yscale,
                              OrthoRenderInfo info
                        ) {
+           for(int i=0; i<2; i++) 
+               cs1rect[i] = cs2rect[i] = 0;
+           for(int i=2; i<4; i++) 
+               cs1rect[i] = cs2rect[i] = 1;
            OrthoCoordsys sys1 = sys, sys2 = other.sys;
+           sys1.transformRect(cs1, cs1rect);
+           sys2.transformRect(cs2, cs2rect);
            info.setCoords(sys1.depth[cs1],
!                       xscale * i(cs1rect[0], cs2rect[0], fract) + xoffs,
!                       yscale * i(cs1rect[1], cs2rect[1], fract) + yoffs,
!                       xscale * i(cs1rect[2], cs2rect[2], fract),
!                       yscale * i(cs1rect[3], cs2rect[3], fract),
!                       0, 0, 2000, 2000);
!           // XXX Cliprect wrong
            p("SetInterp: "+info.x+" "+info.y+" "+info.w+" "+info.h +
                        " \n\t"+xoffs+" "+yoffs+" "+xscale+" "+yscale);
      }
***************
*** 110,115 ****
--- 116,122 ----
  
      public void setOrthoParams(int cs, float depth,
                float x, float y, float w, float h) {
+       if(maxdepth < depth) maxdepth = depth;
        sys.setParams(cs, depth, x, y, w, h);
      }
  
Index: gzz/gzz/vob/OrthoCoordsys.java
diff -c gzz/gzz/vob/OrthoCoordsys.java:1.6 gzz/gzz/vob/OrthoCoordsys.java:1.7
*** gzz/gzz/vob/OrthoCoordsys.java:1.6  Tue Oct 15 09:29:19 2002
--- gzz/gzz/vob/OrthoCoordsys.java      Wed Oct 16 03:46:39 2002
***************
*** 82,93 ****
        w[cs] = mw;
        h[cs] = mh;
  
!       // x,y,depth are stored as absolute, not relative to parent
        depth[cs] = depth[mparent] + mdepth;
!       x[cs] = x[mparent] + mx;
!       y[cs] = y[mparent] + my;
  
  
      }
  
      protected int next() {
--- 82,106 ----
        w[cs] = mw;
        h[cs] = mh;
  
!       // depth are stored as absolute, not relative to parent
        depth[cs] = depth[mparent] + mdepth;
!       // XXX Depth doesn't change right with setXParams later
!       x[cs] = mx;
!       y[cs] = my;
  
  
+     }
+ 
+     void transformRect(int cs, float[] rect) {
+       if(cs == 0) return;
+       rect[0] *= w[cs];
+       rect[1] *= h[cs];
+       rect[2] *= w[cs];
+       rect[3] *= h[cs];
+ 
+       rect[0] += x[cs];
+       rect[1] += y[cs];
+       transformRect(parent[cs], rect);
      }
  
      protected int next() {
Index: gzz/gzz/vob/SolidBgVob.java
diff -c gzz/gzz/vob/SolidBgVob.java:1.11 gzz/gzz/vob/SolidBgVob.java:1.12
*** gzz/gzz/vob/SolidBgVob.java:1.11    Mon Oct 14 05:57:31 2002
--- gzz/gzz/vob/SolidBgVob.java Wed Oct 16 03:46:39 2002
***************
*** 30,35 ****
--- 30,37 ----
  import gzz.util.ColorUtil;
  
  /** A solid clear-and-paint-background vob.
+  * CONFUSING NAME: NOT TO BE USED FOR BOX BACKGROUNDS, THIS IS FOR WHOLE
+  * VOBSCENES ONLY
   */
  public class SolidBgVob extends Vob{
      public static boolean dbg = false;
***************
*** 49,60 ****
                Vob.RenderInfo info1,
                Vob.RenderInfo info2)
      {
!       info1.getExtRect(rect);
! 
!         if(dbg) pa("Render solidbg: "+rect.x+" "+rect.y+" "+rect.width+" 
"+rect.height+" "+color);
  
        g.setColor(color);
!       g.fillRect(rect.x, rect.y, rect.width, rect.height);
        g.setColor(Color.black);
      }
  
--- 51,60 ----
                Vob.RenderInfo info1,
                Vob.RenderInfo info2)
      {
!         if(dbg) pa("Render solidbg");
  
        g.setColor(color);
!       g.fillRect(0, 0, 2000, 2000);
        g.setColor(Color.black);
      }
  
Index: gzz/gzz/vob/TextVob.java
diff -c gzz/gzz/vob/TextVob.java:1.40 gzz/gzz/vob/TextVob.java:1.41
*** gzz/gzz/vob/TextVob.java:1.40       Wed Oct  9 11:09:56 2002
--- gzz/gzz/vob/TextVob.java    Wed Oct 16 03:46:39 2002
***************
*** 27,37 ****
  import gzz.client.*;
  
  /** A single contiguous text string as a Vob.
!  * This vob implements the HBox interface so it is possible to create a 
paragraph
   * from these and use a LineBreaker.
   */
  public class TextVob extends HBox.VobHBox {
! String rcsid = "$Id: TextVob.java,v 1.40 2002/10/09 15:09:56 mudyc Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
--- 27,45 ----
  import gzz.client.*;
  
  /** A single contiguous text string as a Vob.
!  * This vob implements the HBox interface so it is 
!  * possible to create a paragraph
   * from these and use a LineBreaker.
+  * <p>
+  * A note on the relationship between this class and TextStyle:
+  * TextStyle can be constructed from GraphicsAPI by giving a size.
+  * That size is the virtual point or pixel size. However, since
+  * we are in a flexibly scaling world, that size has no bearing
+  * on how tall the text will appear: only the height of the coordinate
+  * system into which the textvob is placed affects that.
   */
  public class TextVob extends HBox.VobHBox {
! String rcsid = "$Id: TextVob.java,v 1.41 2002/10/16 07:46:39 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
Index: gzz/test/gzz/gfx/gl/paper.test
diff -c gzz/test/gzz/gfx/gl/paper.test:1.3 gzz/test/gzz/gfx/gl/paper.test:1.4
*** gzz/test/gzz/gfx/gl/paper.test:1.3  Tue Oct 15 06:50:12 2002
--- gzz/test/gzz/gfx/gl/paper.test      Wed Oct 16 03:46:39 2002
***************
*** 1,3 ****
--- 1,5 ----
+ needGL()
+ 
  from gzz.vob import *
  from java.awt import Color
  from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill
Index: gzz/test/gzz/view/cellvobfactory.test
diff -c gzz/test/gzz/view/cellvobfactory.test:1.2 
gzz/test/gzz/view/cellvobfactory.test:1.3
*** gzz/test/gzz/view/cellvobfactory.test:1.2   Tue Oct 15 13:42:19 2002
--- gzz/test/gzz/view/cellvobfactory.test       Wed Oct 16 03:46:39 2002
***************
*** 39,49 ****
  bgc = (0, 0, 255)
  
  def checkbox(x, y, w, h, color):
!     # Check that edges are background-colored
!     checkAvgColor(x-2, y-2, w+20, 1, bgc)
!     checkAvgColor(x-2, y-2, 1, h+20, bgc)
!     checkAvgColor(x-2, y+h+1, w+20, 1, bgc)
!     checkAvgColor(x+w+1, y-2, 1, h+20, bgc)
  
      # Check that center is of given color
      checkAvgColor(x+3, y+3, w-6, h-6, color)
--- 39,49 ----
  bgc = (0, 0, 255)
  
  def checkbox(x, y, w, h, color):
!     # Check that there is background-color behind the edges
!     checkAvgColor(x-3, y-3, w+20, 1, bgc)
!     checkAvgColor(x-3, y-3, 1, h+20, bgc)
!     checkAvgColor(x-3, y+h+2, w+20, 1, bgc)
!     checkAvgColor(x+w+2, y-3, 1, h+20, bgc)
  
      # Check that center is of given color
      checkAvgColor(x+3, y+3, w-6, h-6, color)
***************
*** 55,61 ****
      vs.map.put(SolidBgVob(Color.blue))
  
      box = Box()
!     box.set(vs, vs.orthoCS(0, "A", 0, 100, 100, 1, 1), 200, 50)
      
      cvf = CellVobFactory()
      context = VC()
--- 55,62 ----
      vs.map.put(SolidBgVob(Color.blue))
  
      box = Box()
!     orth = vs.orthoCS(0, "A", 0, 100, 100, 1, 1)
!     box.set(vs, orth, 200, 50)
      
      cvf = CellVobFactory()
      context = VC()
***************
*** 64,68 ****
--- 65,84 ----
      render(vs)
  
      checkbox(100, 100, 200, 50, (255,255,255))
+ 
+     # Check that setting the coordsys params works
+     vs.coords.setOrthoParams(orth, 0, 150, 200, .5, .5)
+     render(vs)
+     checkbox(150, 200, 100, 25, (255, 255, 255))
+ 
+     # Next, check that hierarchical coordinate systems work
+     vs = getvs()
+     vs.map.put(SolidBgVob(Color.blue))
+     parent = vs.orthoCS(0, "A", 0, 120, 60, 2, 2)
+     child = vs.orthoCS(parent, "B", 0, 20, 30, .25, .25)
+     box.set(vs, child, 200, 50)
+     cvf.place(cell, vs, box, context)
+     render(vs)
+     checkbox(160, 120, 100, 25, (255, 255, 255))
  
  # : vim: set syntax=python :
Index: gzz/test/testutil.py
diff -c gzz/test/testutil.py:1.27 gzz/test/testutil.py:1.28
*** gzz/test/testutil.py:1.27   Tue Oct 15 06:50:12 2002
--- gzz/test/testutil.py        Wed Oct 16 03:46:39 2002
***************
*** 32,46 ****
  import sys
  import traceback
  sys.path.insert(0, ".")
- 
  import unittest, os.path, fnmatch, string, imp
  import java
  from gzz.client import GraphicsAPI
  
  true = 1
  false = 0
  enableJNI = false
  
  class NeedGLError:
      pass
  
--- 32,80 ----
  import sys
  import traceback
  sys.path.insert(0, ".")
  import unittest, os.path, fnmatch, string, imp
  import java
  from gzz.client import GraphicsAPI
+ import gzz.util.saveimage
  
  true = 1
  false = 0
  enableJNI = false
  
+ 
+ class Result_SaveImage(unittest._TextTestResult):
+     def startTest(self, test):
+       from test.tools import gfx
+       print "START_RS\n"
+       gfx.didRender = 0
+       unittest._TextTestResult.startTest(self, test)
+     def addError(self, test, err):
+       self.saveFailure(test)
+       unittest._TextTestResult.addError(self, test, err)
+ 
+     def addFailure(self, test, err):
+       self.saveFailure(test)
+       unittest._TextTestResult.addFailure(self, test, err)
+ 
+     def saveFailure(self, test):
+       from test.tools import gfx
+       print "SAVEFAILURE? ", gfx.didRender
+       if not gfx.didRender: 
+           return
+       name = test.id()
+       file = "testfail_"+name+".png"
+       print "Saving result of graphical test to ", file
+       s = gfx.win.getSize()
+       gzz.util.saveimage.save(file,
+           gfx.win.readPixels(0, 0, s.width, s.height),
+           s.width, s.height
+           )
+           
+ class SavingTestRunner(unittest.TextTestRunner):
+   def _makeResult(self):
+       return Result_SaveImage(self.stream, self.descriptions, self.verbosity)
+ 
+ 
  class NeedGLError:
      pass
  
***************
*** 161,166 ****
--- 195,202 ----
                                 for t in tests(files) if load(t)])
  
  
+ 
+ # Have to do before importing test.tools.gfx
  if __name__ == '__main__':
      sys.path.insert(0, ".")
      import getopt
***************
*** 185,194 ****
      class Starter(java.lang.Runnable):
        def run(self):
            try:
!               unittest.TextTestRunner(verbosity=2).run(suite(test))
            except:
                typ, val, tra = sys.exc_info()
!               print (repr((typ, val, tra)))
                l = traceback.format_list(traceback.extract_tb(tra))
                print "\n".join(l)
            java.lang.System.exit(0)
--- 221,231 ----
      class Starter(java.lang.Runnable):
        def run(self):
            try:
!               SavingTestRunner(verbosity=2).run(suite(test))
            except:
                typ, val, tra = sys.exc_info()
!               print (repr((typ, val)))
!               print str(val)
                l = traceback.format_list(traceback.extract_tb(tra))
                print "\n".join(l)
            java.lang.System.exit(0)
Index: gzz/test/tools/gfx.py
diff -c gzz/test/tools/gfx.py:1.3 gzz/test/tools/gfx.py:1.4
*** gzz/test/tools/gfx.py:1.3   Tue Oct 15 13:42:19 2002
--- gzz/test/tools/gfx.py       Wed Oct 16 03:46:39 2002
***************
*** 3,8 ****
--- 3,10 ----
  print dir(gzz)
  print dir(gzz.client)
  
+ didRender = 0
+ 
  win = gzz.client.GraphicsAPI.getInstance().createWindow()
  win.setLocation(0, 0, 500, 500)
  
***************
*** 12,17 ****
--- 14,21 ----
      return win.createVobScene()
  
  def render(vs):
+     global didRender
+     didRender = 1
      win.renderStill(vs, 0)
  
  def getAvgColor(x, y, w, h):




reply via email to

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