[Dev] Functional test experience report

Grant Baillie grant at osafoundation.org
Mon Nov 7 09:42:47 PST 2005


On Nov 3, 2005, at 8:39 , Heikki Toivonen wrote:

> (removing content not part of this discussion, and cleaning CC list as
> we are all on dev)
>
> John Anderson wrote:
>> Ted Leung wrote:
>>
>> Did you try it with just the Yield (e.g. wx.GetApp().Yield())?. I  
>> think
>> that may be all that's necessary to run the Idle loop.
>
> Yield() alone is not enough. I don't know the exact details but Katie,
> Grant and Donn have been working out the kinks and so far the best
> workaround is the processNextIdle() below.
>
>>>     def processNextIdle():
>>>         wx.GetApp().Yield()
>>>         ev = wx.IdleEvent()
>>>         wx.GetApp().ProcessEvent(ev)
>>>         wx.GetApp().Yield()

Looking at the profiles generated by this function, it seems the Yield 
() calls trigger painting the UI (if needed). This is consistent with  
the documented behaviour:

> Process all currently pending events right now, instead of waiting  
> until return to the event loop.

(From <http://www.wxpython.org/docs/api/wx.PyApp-class.html#Yield>)

Even in cases where there's no painting to be done (i.e. events to be  
processed), a Yield() does not trigger an Idle event. In fact, the  
documented behaviour of wx.App.ProcessIdle() is:

> Called from the MainLoop when the application becomes idle (there  
> are no pending events) and sends a wx.IdleEvent to all interested  
> parties

So, since Yield() essentially bypasses the main event loop, it  
doesn't lead to posting of idle events.

Regardless, we should probably move the above function to  
QAUITestLib.py.

--Grant



More information about the Dev mailing list