gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz gzz/gfx/gl/PageSpanPaper.java gzz/view/Page...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz gzz/gfx/gl/PageSpanPaper.java gzz/view/Page...
Date: Wed, 29 Jan 2003 03:50:46 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        03/01/29 03:50:46

Modified files:
        gzz/gfx/gl     : PageSpanPaper.java 
        gzz/view       : PageSpanCellView.java 
        gzz/vob/buoy   : SimpleBuoy.java 
        test/gzz/view  : pagespancellview.test 

Log message:
        Working test

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/PageSpanPaper.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/PageSpanCellView.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/buoy/SimpleBuoy.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/view/pagespancellview.test.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/gzz/gfx/gl/PageSpanPaper.java
diff -u gzz/gzz/gfx/gl/PageSpanPaper.java:1.5 
gzz/gzz/gfx/gl/PageSpanPaper.java:1.6
--- gzz/gzz/gfx/gl/PageSpanPaper.java:1.5       Tue Jan 28 13:42:11 2003
+++ gzz/gzz/gfx/gl/PageSpanPaper.java   Wed Jan 29 03:50:46 2003
@@ -15,10 +15,10 @@
     /** Return the paper X coordinate for the given full page span coordinate.
      */
     public float getX(float fullPageX) {
-       return p.getX(fullPageX);
+       return w * p.getX(fullPageX) / p.x1;
     }
     public float getY(float fullPageY) {
-       return p.getY(fullPageY);
+       return h * p.getY(fullPageY) / p.y1;
     }
 
     Object identity;
Index: gzz/gzz/view/PageSpanCellView.java
diff -u gzz/gzz/view/PageSpanCellView.java:1.1 
gzz/gzz/view/PageSpanCellView.java:1.2
--- gzz/gzz/view/PageSpanCellView.java:1.1      Tue Jan 28 13:42:11 2003
+++ gzz/gzz/view/PageSpanCellView.java  Wed Jan 29 03:50:46 2003
@@ -16,6 +16,9 @@
  * XXX Doesn't work in AWT -- maybe should be in gzz.view.gl?
  */
 public class PageSpanCellView {
+    public static boolean dbg = false;
+    private static void pa(String s) { System.out.println(s); }
+
     public static final float scale = 72 * 6;
 
     public boolean useBg = true;
@@ -63,6 +66,13 @@
            xywh[4*p + 1] = psps[p].getY(l_p.y);
            xywh[4*p + 2] = psps[p].getX(d_p.width);
            xywh[4*p + 3] = psps[p].getY(d_p.height);
+
+           if(dbg) pa("Page "+p+" "+
+                       xywh[4*p+0]+" "+
+                       xywh[4*p+1]+" "+
+                       xywh[4*p+2]+" "+
+                       xywh[4*p+3]+" "+
+                       pages[p]);
 
            if(!foundCenter && center != null && center.intersects(pages[p])) {
                foundCenter = true;
Index: gzz/gzz/vob/buoy/SimpleBuoy.java
diff -u gzz/gzz/vob/buoy/SimpleBuoy.java:1.1 
gzz/gzz/vob/buoy/SimpleBuoy.java:1.2
--- gzz/gzz/vob/buoy/SimpleBuoy.java:1.1        Mon Aug 26 04:21:40 2002
+++ gzz/gzz/vob/buoy/SimpleBuoy.java    Wed Jan 29 03:50:46 2003
@@ -29,9 +29,8 @@
  *  When called to place itself in a vobscene, this buoy places the given vob.
  */
 public class SimpleBuoy implements BuoyPlacer.Buoy {
-public static final String rcsid = "$Id: SimpleBuoy.java,v 1.1 2002/08/26 
08:21:40 tjl Exp $";
+public static final String rcsid = "$Id: SimpleBuoy.java,v 1.2 2003/01/29 
08:50:46 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); }
 
     public int prefWidth, prefHeight, minWidth, minHeight;
Index: gzz/test/gzz/view/pagespancellview.test
diff -u gzz/test/gzz/view/pagespancellview.test:1.1 
gzz/test/gzz/view/pagespancellview.test:1.2
--- gzz/test/gzz/view/pagespancellview.test:1.1 Tue Jan 28 13:42:11 2003
+++ gzz/test/gzz/view/pagespancellview.test     Wed Jan 29 03:50:46 2003
@@ -14,36 +14,79 @@
 id = "01ACE8A2E202A26072012715A94A270CD012F9B0F2"
 
 sc = gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(id))
+size = sc.getCurrent().getSize()
 
 enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker()
 
+
+def excinfo():
+    global exc
+    typ, val, tra = sys.exc_info()
+    print (repr((typ, val)))
+    print str(val)
+    exc = "\n".join(traceback.format_list(traceback.extract_tb(tra)))
+
+def checkColors(x, y):
+    try:
+       # Check that the green rectangle is there
+       checkAvgColor(x+30,y+40,20,20, (0, 255, 0), delta=60)
+       # Check that the red rectangle is there
+       checkAvgColor(x+65,y+40,20,20, (255, 0, 0), delta=60)
+       # Check that the black rectangle is there
+       checkAvgColor(x+30, y+80, 60, 2, (0, 0, 0))
+
+       # Check that the blue rectangle is there on the second page
+       checkAvgColor(x+150, y+40, 40, 40, (0, 0, 255), delta=60)
+
+       # Check that the border is yellow
+       checkAvgColor(x-2, y-2, 1, 160, (255, 255, 0))
+       checkAvgColor(x-2, y-2, 250, 1, (255, 255, 0))
+       checkAvgColor(x+260, y-2, 1, 160, (255, 255, 0))
+       checkAvgColor(x-2, y+170, 250, 1, (255, 255, 0))
+    except:
+       excinfo()
+       return 0
+    return 1
+
+
 def testTestSpan():
     """Test that we really have the pagespan images.
 
     If not, all other tests in this file will fail too.
     """
     failUnlessEqual(sc.getCurrent().length(), 2)
+    s = sc.getCurrent().getSize()
+    failUnlessEqual(s.width, 612)
+    failUnlessEqual(s.height, 792)
 
 def testSimply():
     """Test that the view renders something
 
-    fail: *
     """
-    vs = getvs()
-    vs.map.put(SolidBgVob(Color.yellow))
-    render(vs)
-    checkAvgColor(160,150,50,50, (255, 255, 0), delta=5)
-    
-    v = PageSpanCellView()
-    v.useBg = 0
 
+    for i in range(0, 30):
+       gzz.client.AbstractUpdateManager.tickIdle()
 
-    v.placeCentered(enfMaker.makeEnfilade(sc.getCurrent()), vs, 0, None, None, 
1, 100000)
-
-    render(vs)
-    checkAvgColor(160,150,50,50, (255, 255, 0), delta=5)
+       vs = getvs()
+       vs.map.put(SolidBgVob(Color.yellow))
+       render(vs)
+       checkAvgColor(160,150,50,50, (255, 255, 0), delta=5)
        
+       v = PageSpanCellView()
+       v.useBg = 0
+
+
+       scaled = vs.orthoCS(0, "X", 0, 100, 100, .2, .2)
+       v.placeCentered(enfMaker.makeEnfilade(sc.getCurrent()), vs, scaled, 
+                       None, None, 1, 100000)
+
+       render(vs)
+
+       if checkColors(100, 100): return 
+
+       Thread.sleep(100)
 
+    failUnlessEqual("didn't get the image " + exc, 0, 1)
 
     
 




reply via email to

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