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 |
|
|
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) |
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 |
|
|