/[gzz]/gzz/lava/test/gzz/loom/WheelView.test
ViewVC logotype

Diff of /gzz/lava/test/gzz/loom/WheelView.test

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

revision 1.2 by benja, Wed Feb 26 20:45:16 2003 UTC revision 1.3 by benja, Wed Feb 26 20:54:23 2003 UTC
# Line 21  Line 21 
21    
22  import gzz, java  import gzz, java
23  import jarray  import jarray
24    import math
25  from test.tools.gfx import getvs  from test.tools.gfx import getvs
26  from com.hp.hpl.mesa.rdf import jena  from com.hp.hpl.mesa.rdf import jena
27    
# Line 46  class Cmp(java.util.Comparator): Line 47  class Cmp(java.util.Comparator):
47    
48  view = gzz.loom.WheelView(NodeView())  view = gzz.loom.WheelView(NodeView())
49    
50    
51    def distance(p1, p2):
52        """Return the distance between p1 and p2 (AWT points)"""
53        return math.sqrt((p1.x-p2.x)**2 + (p1.y-p2.y)**2)
54    
55    
56  def testWheel():  def testWheel():
57      r.addProperty(p, s)      r.addProperty(p, s)
58      r.addProperty(p, t)      r.addProperty(p, t)
# Line 70  def testWheel(): Line 77  def testWheel():
77      assert pt.y < ps.y < pv.y      assert pt.y < ps.y < pv.y
78      assert pt.x < ps.x > pv.x      assert pt.x < ps.x > pv.x
79    
80        # Check that all nodes have approximately the same distance
81        # from r
82        
83        for px in (pt, pu, pv, pw):
84            assert abs(distance(pr,ps) - distance(pr,px)) < 1
85    
86      # Test that WheelView calls its NodeView      # Test that WheelView calls its NodeView
87      # with all the correct parameters.      # with all the correct parameters.
88    

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

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