/[gzz]/gzz/test/gzz/gfx/gl/pagespanpaper.test
ViewVC logotype

Diff of /gzz/test/gzz/gfx/gl/pagespanpaper.test

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by tjl, Mon Jan 27 14:33:19 2003 UTC revision 1.4 by tjl, Mon Jan 27 17:26:05 2003 UTC
# Line 21  def testTestSpan(): Line 21  def testTestSpan():
21      """      """
22      failUnlessEqual(sc.getCurrent().length(), 2)      failUnlessEqual(sc.getCurrent().length(), 2)
23    
24    
25    def excinfo():
26        global exc
27        typ, val, tra = sys.exc_info()
28        print (repr((typ, val)))
29        print str(val)
30        exc = "\n".join(traceback.format_list(traceback.extract_tb(tra)))
31    
32  def checkColors():  def checkColors():
33      try:      try:
34          # Check that the green rectangle is there          # Check that the green rectangle is there
35          checkAvgColor(160,150,50,50, (0, 255, 0))          checkAvgColor(160,150,50,50, (0, 255, 0), delta=110)
36          # Check that the red rectangle is there          # Check that the red rectangle is there
37          checkAvgColor(260,150,50,50, (255, 0, 0))          checkAvgColor(260,150,50,50, (255, 0, 0), delta=110)
38          # Check that the black rectangle is there          # Check that the black rectangle is there
39          checkAvgColor(150,225,20,50, (0, 0, 0))          checkAvgColor(150,225,20,50, (0, 0, 0))
40          checkAvgColor(330,225,20,50, (0, 0, 0))          checkAvgColor(330,225,20,50, (0, 0, 0))
# Line 35  def checkColors(): Line 43  def checkColors():
43          checkAvgColor(45, 0, 2, 500, (255, 255, 0))          checkAvgColor(45, 0, 2, 500, (255, 255, 0))
44          checkAvgColor(453, 0, 2, 500, (255, 255, 0))          checkAvgColor(453, 0, 2, 500, (255, 255, 0))
45      except:      except:
46          return 0          excinfo()
         # Let these run to print out the errors  
         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)  
47          return 0          return 0
48      return 1      return 1
49    
50  def testNobg():  def checkNonBlank():
51      """Test that the image gets loaded correctly from GLSpanner.      checkNotAvgColor(100, 100, 3, 20, (255, 255, 255))
52    
53      """  def checkBlank():
54        checkAvgColor(100, 100, 3, 20, (255, 255, 255))
55    
56    def checkPaper(bgpaper, blank):
57    
58      pagespan = GLSpanner.getSpanRect(sc.getCurrent()).page      pagespan = GLSpanner.getSpanRect(sc.getCurrent()).page
59      p = PageSpanPaper(None, pagespan)      p = PageSpanPaper(bgpaper, pagespan)
60    
61      pap = p.getPaper(0)      pap = p.getPaper(not blank)
62    
63      vs = getvs()      vs = getvs()
64      vs.map.put(SolidBgVob(Color.yellow))      vs.map.put(SolidBgVob(Color.yellow))
# Line 69  def testNobg(): Line 74  def testNobg():
74          render(vs)          render(vs)
75    
76          # check the rendered image's color          # check the rendered image's color
77          if checkColors(): return          if checkColors():
78                if blank:
79                    checkBlank()
80                else:
81                    checkNonBlank()
82                return
83    
84          Thread.sleep(100)          Thread.sleep(100)
85    
86        
87    
88        failUnlessEqual("didn't get the image " + exc, 0, 1)
89    
90    
91    def testPaperLoading():
92        """Test that the image gets loaded correctly from GLSpanner.
93    
94        """
95        checkPaper(None, 1)
96    
97    def testUnoptimized():
98        """Test that rendering the paper on top of fancy unoptimized
99        paper works.
100    
101        """
102    
103        checkPaper(PaperMill.getInstance().getPaper(42), 1)
104        checkPaper(PaperMill.getInstance().getPaper(42), 0)
105    
106    def testOptimized():
107        """Test that rendering the paper on top of fancy optimized
108        paper works.
109    
110        """
111    
112        checkPaper(PaperMill.getInstance().getOptimizedPaper(43, win), 1)
113        checkPaper(PaperMill.getInstance().getOptimizedPaper(43, win), 0)
114    
     failUnlessEqual("didn't get the image", 0, 1)  
115    
116  # : vim: set syntax=python :  # : vim: set syntax=python :

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26