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

Nagappan Alagappan nagappan at gmail.com
Tue Oct 20 11:48:14 PDT 2009


Hi Scott,

Apologize for my delayed response.

On Wed, Oct 14, 2009 at 6:57 AM, Wang Qi, Scott <wangqi.s at gmail.com> wrote:

> 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).
>

In LDTP, we restricted clicking mnuFile due to bug in accessibility.

http://cgit.freedesktop.org/ldtp/ldtp/tree/src/menu.c#n38

Unfortunately this bug still exist, verified with v2.

Thanks
Nagappan

>
> 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
>>
>>
>
> _______________________________________________
> LDTP-dev mailing list
> LDTP-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/ldtp-dev
>
>


-- 
Linux Desktop (GUI Application) 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/20091020/dde39d34/attachment.html 


More information about the LDTP-dev mailing list