--On Thursday, October 2, 2003 11:26 PM +1000 Adrian Sutton <[EMAIL PROTECTED]> wrote:

Not much interesting to report, just been improving the unit testing of
FreeCard.

Here's a problem I'm facing:

How do you test a button?

There are certainly some aspects that are simple to test like checking
that when clicked it sends a mouseUp event and so on, but how do you test
it's reaction to all the different properties that can be set like font
size and font style.  I'd really like to avoid doing a screen scrape of
the button as the look of the button is allowed to change it just has to
represent the styled text somehow.

No, I agree that Optical Style Recognition is not called for here. :-)


Anyway, maybe someone out there has more experience with unit testing
than I do and can help me out.

I don't have any actual experience with unit testing, but I have thought about it a great deal as I consider how to implement it for myself. In the case of GUI elements, I suggest the 'mock object' approach: If you were testing a Mac OS button, you might redirect Mac Toolbox calls (via macros, perhaps) to test code, for example SizeControl() would call a test function instead of the real thing. Then you'd know what size the button would be. Or, you could verify that the button calls TextFace() (to set the font) before calling DrawControl(). You could then call through to the actual OS routine if desired.


I don't know how you'd map that to Java, but that's my suggestion.

Josh

--
Joshua Juran
Metamage Software Creations - Mac Software and Consulting
http://www.metamage.com/

* Creation at the highest state of the art *




------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Freecard-general mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freecard-general

Reply via email to