If you were writing straight code, I would say you could simulate 'weirdo contexts' by sending your dummy clicks from the idle loop, e.g., by callOnIdle. But lzunit already runs your tests from the idle loop, so you really don't have to do anything. They are already in a 'weido context'.

The trick will be coordinating a simulated asynchronous event with the test. There was some mail to the list recently with a proposal for making it easier to do asynchronous tests in lzunit by [EMAIL PROTECTED] I don't think it has been implemented though.

On 29 Nov 2005, at 15:48, Henry Minsky wrote:

So, I've got a new chunk of code for an improved context-menu API, and this
seems to
me like one of those "difficult to test" situations. It involves
right-clicking the mouse
and then looking for and selecting menu items. What is the best unit testing
I can do here,
using the "something is better than nothing" theory? I can manually send the
events and
execute the callbacks that ought to be coming from the user mouse clicks,
but that seems
about all. The real difficulty in the code is making sure the weirdo
contexts of the menu callbacks
aren't getting screwed up, and I don't really know how to  or want to
simulate the calling contexts
 (i.e., what is "this" going to be bound to, etc).





--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to