[LDTP-Dev] How to use the array returned by getallstates()

Wang Qi, Scott wangqi.s at gmail.com
Wed Oct 14 06:57:31 PDT 2009


Hi, Nagappan,

I tried your method. Both work great.

But I found another interesting issue. For the APP I am testing, the state
of the menu item such as SENSITIVE is updated in a wx.EVT_UPDATE_UI event. I
think different UI framework get different name. But the basic mechanism
should work the same. The state of menu item only changes when user click on
the root menu. For example, I must try to manually click on 'mnuFile' to
show the menu list to make the state of 'mnuFile;mnuClose' get change
(updated in the wx.EVT_UPDATE_UI event handler).

So my question is how to trigger this wx.EVT_UPDATE_UI event in the test
script? I tried ldtp.selectmenuitem(win_name, 'mnuFile'). This call does not
do the same thing as what a manual click on 'mnuFile' item does, which
trigger the EVT_UPATE_UI event.

Thanks
Scott

P.S: I tried gedit and find the state of menu item is updated instantly. For
example, the SENSITIVE state of 'mnuFile;mnuClose' will change to off as
soon as the last edit tab is closed in gedit.


On Fri, Sep 25, 2009 at 10:28 AM, Nagappan A <nalagappan at vmware.com> wrote:

> Hi Scott,
>
> You can check with:
>
> 1. hasstate('window', 'object', state.ENABLED)
> 2. getallstates, from return value of it you can check:
>    enabled = False
>    for currentState in states:
>       if state.ENABLED == currentState:
>          print 'Enabled'
>          enabled = True
>          break
>
> In case of menu state.SENSITIVE will be checked.
>
> Thanks
> Nagappan
>
>
> Wang Qi, Scott wrote:
>
>> Hi, Nagappan,
>>
>> It seems ldtp.getallstates() return an array of integer. I look in the
>> online doc about how to use the index. Seems there is no information on it.
>>
>> Also, how to tell if a mnu is enabled or not? Seems button' state can be
>> get by calling stateenabled (). But stateenabled() will always return 0 for
>> mnu?
>>
>> Thanks
>> Scott Wang
>>
>>
>>
> --
> Linux Desktop Testing Project - http://ldtp.freedesktop.org
> http://nagappanal.blogspot.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/ldtp-dev/attachments/20091014/7b6f9e0d/attachment.html 


More information about the LDTP-dev mailing list