/[libvob]/libvob/test/vob/vobs/textvob.test
ViewVC logotype

Diff of /libvob/test/vob/vobs/textvob.test

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

revision 1.3 by humppake, Tue Apr 8 15:26:10 2003 UTC revision 1.4 by humppake, Sun Aug 17 21:00:15 2003 UTC
# Line 1  Line 1 
1    # -*-python-*-
2  #  #
3  # Copyright (c) 2003, Asko Soukka  # Copyright (c) 2003, Asko Soukka
4  #  #
# Line 21  Line 22 
22  #  #
23    
24    
25  """Test text sizes, rendering etc.  """
26    Test text sizes, rendering etc.
27  """  """
28    
29  from test.tools.gfx import *  from test.tools.gfx import *
30  from java.awt import Color  from java.awt import Color
31    
32  sty1 = win.getGraphicsAPI().getTextStyle("SansSerif", 0, 20)  sty1 = win.getGraphicsAPI().getTextStyle("SansSerif", 0, 20)
 sty2 = win.getGraphicsAPI().getTextStyle("SansSerif", 0, 50)  
 sty3 = win.getGraphicsAPI().getTextStyle("SansSerif", 0, 10)  
   
 def testStyleSize():  
     """Test that the different styles give out suitable heights.  
     """  
     failUnlessApprox(4, sty1.getHeight(1), 20)  
     failUnlessApprox(15, sty2.getHeight(1), 50)  
     failUnlessApprox(4, sty3.getHeight(1), 10)  
   
     failUnlessApprox(10, sty1.getHeight(2), 40)  
     failUnlessApprox(25, sty2.getHeight(2), 100)  
     failUnlessApprox(8, sty3.getHeight(2), 20)  
   
     failUnlessApprox(20, sty2.getWidth("xx", 1), 50)  
     failUnlessApprox(4, sty3.getWidth("xx", 1), 10)  
   
 def testStyleScaling():  
     """Test scaling by height.  
     """  
     for height in range (0, 100):  
         scale = sty1.getScaleByHeight(height)  
         failUnlessApprox(1, sty1.getHeight(scale), height, "height")  
         failUnlessApprox(1, sty1.getAscent(scale) + sty1.getDescent(scale), height, "ascender + descender")  
           
 def testSize():  
     """Test, for various box sizes, that text consisting of  
     lower-case letter x is on the baseline or slightly above.  
     """  
   
 def testScale():  
     """Test that hierarchical coordinate systems affect the scaling  
     in the same way.  
     """  
33    
34  def testWH():  def testWH():
35      """Test that TextVob is drawn with the width and height      """Test that TextVob is drawn with the width and height

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