How to use the array returned by getallstates()

View: New views
5 Messages — Rating Filter:   Alert me  

How to use the array returned by getallstates()

by Wang Qi, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: How to use the array returned by getallstates()

by Nagappan A :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: How to use the array returned by getallstates()

by Wang Qi, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: How to use the array returned by getallstates()

by Wang Qi, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Nagappan,

I found a not-so-perfect work-around for this issue.

I can use ldtp.generatekeyevent ('<alt>F') (i.e. Ctrl-F) to request the root-menu 'File' to display all the sub-menus. Then, do a ldtp.generatekeyevent ('esc').

One issue with this solution is that AUT must get the focus (not like other LDTP API).

Another even-worse solution is to update the application code to add a trigger for EVT_UPDATE_UI for all menu's event handler function. But this seems a big change and no-optimized update.

Or does anyone have better solutions?

Thanks
Scott




On Wed, Oct 14, 2009 at 9:57 PM, Wang Qi, Scott <wangqi.s@...> 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).

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@...> 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@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: How to use the array returned by getallstates()

by Nagappan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Scott,

Apologize for my delayed response.

On Wed, Oct 14, 2009 at 6:57 AM, Wang Qi, Scott <wangqi.s@...> 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@...> 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@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev




--
Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org
http://nagappanal.blogspot.com

_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev