Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

Commit caeddaf

Browse files
author
Frederik De Bleser
committed
ellipse() is now an alias for oval().
Ellipse is actually a more correct term for the thing we're drawing.
1 parent 9610269 commit caeddaf

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

nodebox/graphics/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ def oval(self, x, y, width, height, draw=True, **kwargs):
172172
path.draw()
173173
return path
174174

175+
ellipse = oval
176+
175177
def line(self, x1, y1, x2, y2, draw=True, **kwargs):
176178
BezierPath.checkKwargs(kwargs)
177179
p = self.BezierPath(**kwargs)

nodebox/graphics/cocoa.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ def rect(self, x, y, width, height):
281281
def oval(self, x, y, width, height):
282282
self._segment_cache = None
283283
self._nsBezierPath.appendBezierPathWithOvalInRect_( ((x, y), (width, height)) )
284+
285+
ellipse = oval
284286

285287
def line(self, x1, y1, x2, y2):
286288
self._segment_cache = None

tests/graphics.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import unittest
2+
import sys
3+
4+
# To run the test, make sure you have at least built the NodeBox Extensions.
5+
# Run the following command in the Terminal:
6+
# xcodebuild -target "Build Extensions"
7+
sys.path.append('..')
8+
sys.path.append('../build/libs')
9+
10+
from nodebox.graphics import *
11+
12+
class GraphicsTestCase(unittest.TestCase):
13+
14+
def test_ellipse(self):
15+
"""Test if ellipse is an alias for oval."""
16+
ctx = Context()
17+
self.assertTrue(hasattr(ctx, "ellipse"))
18+
self.assertTrue(ctx.ellipse == ctx.oval)
19+
p = BezierPath(ctx)
20+
self.assertTrue(hasattr(p, "ellipse"))
21+
self.assertTrue(p.ellipse == p.oval)
22+
23+
if __name__=='__main__':
24+
unittest.main()

0 commit comments

Comments
 (0)