SUnit testing for morphic
Colin Putney
cputney at wiresong.ca
Tue Feb 10 15:54:16 UTC 2004
On Feb 9, 2004, at 9:08 PM, Tom Koenig wrote:
> I'm working on creating some SUnit tests for Jerome Peace's Polygon
> fixes.
>
> Does anyone have any advice/examples of how I can pass events to
> messages
> programmatically? I can unit test some messages that pass evt,
> because the
> event really isn't used in the method. I guess I'm looking for a way
> to
> instantiate events? (But that can't be right because there is no Event
> Class (just EventSensor).
Every now and then I find myself about to tackle this problem, and
every time I end up deciding it's not necessary. I always seem to find
some way of simulating a user action without actually creating an
event. For example, to simulate a user clicking on a button I just send
it #performAction. For my purposes this is better than delivering an
event, since I'm not interested in testing Morphic's routing of events,
but my GUIs reaction to them.
This observation may or may not be applicable to your situation, Tom.
I'm not familiar with Jerome Peace's Polygon fixes - do you have a
pointer to further information?
> Pointers to any existing SUnit tests cases for Morphic would be useful.
Have a look at MCSnapshotBrowserTest in the Monticello package. It
creates an MCSnapshotBrowser, simulates clicks in various list panes
and verifies that the display changes correctly.
You might also have a look at the screenshot demo application Seaside.
It's a very crude web-based interface to a Squeak image. The World is
displayed as an image in a web page with server-side image map. When
the click coordinates come in, they are converted to mouse events and
passed on to Morphic.
You're right, there are no event classes, just arrays with bits of
info stored at "well-known" offsets. In input support to the screen
shot app, Avi and I didn't take the time to really grok all the fields
in a mouse event, we just kind of fiddled with it until it worked. But
it might give you a starting place for your own fiddling.
Good luck,
Colin
More information about the Squeak-dev
mailing list
|