/[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.3 by benja, Wed Feb 26 20:54:23 2003 UTC revision 1.4 by benja, Wed Feb 26 21:32:54 2003 UTC
# Line 52  def distance(p1, p2): Line 52  def distance(p1, p2):
52      """Return the distance between p1 and p2 (AWT points)"""      """Return the distance between p1 and p2 (AWT points)"""
53      return math.sqrt((p1.x-p2.x)**2 + (p1.y-p2.y)**2)      return math.sqrt((p1.x-p2.x)**2 + (p1.y-p2.y)**2)
54    
55    def angle(p1, p2):
56        """
57        If p1 is the origin, return the angle between a
58        line from p1 to p2 and the x axis.
59        """
60        x, y = (p2.x-p1.x) * 1.0, (p2.y-p1.y) * 1.0
61        if x == 0: return math.pi/2
62        return math.asin(y/x)
63    
64    
65  def testWheel():  def testWheel():
66      r.addProperty(p, s)      r.addProperty(p, s)
# Line 83  def testWheel(): Line 92  def testWheel():
92      for px in (pt, pu, pv, pw):      for px in (pt, pu, pv, pw):
93          assert abs(distance(pr,ps) - distance(pr,px)) < 1          assert abs(distance(pr,ps) - distance(pr,px)) < 1
94    
95        # Check the angles XXX
96        # This code doesn't seem to work right? XXX
97    
98        assert angle(pr, ps) == 0
99        assert angle(pr, pw) == 0
100        print angle(pr, pt), angle(pr, pu), angle(pr, pv)
101    
102      # Test that WheelView calls its NodeView      # Test that WheelView calls its NodeView
103      # with all the correct parameters.      # with all the correct parameters.
104    

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