[Python-Dev] xturtle.py a replacement for turtle.py(!?) ATTENTION PLEASE!
edloper at gradient.cis.upenn.edu
Thu Jun 29 17:34:39 CEST 2006
Gregor Lingl wrote:
> Yes,, and I have some ideas in this respect, but mainly a prioncipal
> question. I read about
> using doctest and unittest, but how does one devise
> automatic test suites for graphical output. In the end it depends on how
> it looks like.
There are a few options here.. Two that come to mind are:
- Check the output -- e.g., run a demo, and then use Tkinter.Canvas to
write its output to postscript, and then check the contents of that
postscript file against a known correct file.
- Monkey-patching -- replace specific classes (e.g., ScrolledCanvas?)
with new testing classes that simply intercept drawing primitives,
rather than displaying graphics. Then check that the right drawing
primitives (lines, circles, etc) are generated in the right order.
The former may be more robust, but requires that you have a display
surface available. With the former approach, you may also run into some
problems with different postscript files being generated on different
systems (esp. with respect to font sizes -- I seem to remember that
using negative font sizes might help there?).
More information about the Python-Dev