gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/lava/test/gzz/loom WheelView.test


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/lava/test/gzz/loom WheelView.test
Date: Wed, 26 Feb 2003 15:54:24 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      03/02/26 15:54:24

Modified files:
        lava/test/gzz/loom: WheelView.test 

Log message:
        Another simple test checking that the distances
        from the focus are all approximately equal

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/test/gzz/loom/WheelView.test.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gzz/lava/test/gzz/loom/WheelView.test
diff -u gzz/lava/test/gzz/loom/WheelView.test:1.2 
gzz/lava/test/gzz/loom/WheelView.test:1.3
--- gzz/lava/test/gzz/loom/WheelView.test:1.2   Wed Feb 26 15:45:16 2003
+++ gzz/lava/test/gzz/loom/WheelView.test       Wed Feb 26 15:54:23 2003
@@ -21,6 +21,7 @@
 
 import gzz, java
 import jarray
+import math
 from test.tools.gfx import getvs
 from com.hp.hpl.mesa.rdf import jena
 
@@ -46,6 +47,12 @@
 
 view = gzz.loom.WheelView(NodeView())
 
+
+def distance(p1, p2):
+    """Return the distance between p1 and p2 (AWT points)"""
+    return math.sqrt((p1.x-p2.x)**2 + (p1.y-p2.y)**2)
+
+
 def testWheel():
     r.addProperty(p, s)
     r.addProperty(p, t)
@@ -69,6 +76,12 @@
     assert pw.y == pr.y == ps.y
     assert pt.y < ps.y < pv.y
     assert pt.x < ps.x > pv.x
+
+    # Check that all nodes have approximately the same distance
+    # from r
+    
+    for px in (pt, pu, pv, pw):
+        assert abs(distance(pr,ps) - distance(pr,px)) < 1
 
     # Test that WheelView calls its NodeView
     # with all the correct parameters.




reply via email to

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