Fixed ussue with Handle.x/y. Returned None

This commit is contained in:
Arjan Molenaar 2009-11-12 09:06:03 +01:00
parent fdbebf0e49
commit 5bee8aca4b
2 changed files with 31 additions and 3 deletions

View File

@ -10,7 +10,10 @@ from gaphas.state import observed, reversible_property
from gaphas.geometry import distance_line_point, distance_point_point
from gaphas.constraint import LineConstraint, PositionConstraint
from decorator import deprecated
def deprecated(e):
return e
class Position(object):
"""
@ -113,7 +116,7 @@ class Handle(object):
"""
self._pos.x = x
def _get_x(self): self._pos.x
def _get_x(self): return self._pos.x
x = property(deprecated(_get_x), deprecated(_set_x))
@ -123,7 +126,7 @@ class Handle(object):
"""
self._pos.y = y
def _get_y(self): self._pos.y
def _get_y(self): return self._pos.y
y = property(deprecated(_get_y), deprecated(_set_y))

View File

@ -0,0 +1,25 @@
import unittest
from gaphas.connector import Position, Handle
class PositionTestCase(unittest.TestCase):
def test_position(self):
pos = Position((0, 0))
self.assertEquals(0, pos.x)
self.assertEquals(0, pos.y)
def test_position(self):
pos = Position((1, 2))
self.assertEquals(1, pos.x)
self.assertEquals(2, pos.y)
class HandleTestCase(unittest.TestCase):
def test_handle_x_y(self):
h = Handle()
self.assertEquals(0.0, h.x)
self.assertEquals(0.0, h.y)
# vim: sw=4:et:ai