After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 547572 - Components should be exposed in a hierarchical way
Components should be exposed in a hierarchical way
Status: RESOLVED FIXED
Product: LDTP
Classification: Other
Component: ldtp
2.0.0
Other All
: Normal normal
: ---
Assigned To: Nagappan Alagappan
LDTP Development Mailing List
Depends on:
Blocks:
 
 
Reported: 2008-08-13 11:12 UTC by Ara Pulido
Modified: 2010-04-14 10:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (892 bytes, patch)
2009-02-07 02:21 UTC, Nagappan Alagappan
rejected Details | Review
Proposed patch for ooldtp (2.01 KB, patch)
2009-04-17 08:24 UTC, Ara Pulido
committed Details | Review
Proposed patch to fix the issue (1.55 KB, patch)
2010-04-06 03:07 UTC, Nagappan Alagappan
needs-work Details | Review

Description Ara Pulido 2008-08-13 11:12:13 UTC
Please describe the problem:
The way objects are arranged in the AT-SPI layer is very hierarchical.

It makes little sense that only context objects have a getchild method. It would be very useful if component also had this method.

It will improve a lot the way objects can be recognized. In example, if there are two text field without name (txt0 and txt1), and one is a child of a tab page that do have a name, the hierarchy can be used to select the correct text field.

This can be workaround using getobjectproperty(context, component, 'children'), but having getchild method will improve a lot the OO structure of the script and will allow to search the child by role.
 

Steps to reproduce:
This is an improvement

Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Ara Pulido 2009-02-06 15:29:40 UTC
Any updates on this bug?
Comment 2 Nagappan Alagappan 2009-02-07 02:21:54 UTC
Created attachment 128134 [details] [review]
Proposed patch

Ara, Could you please verify this for me :)
Comment 3 Nagappan Alagappan 2009-02-10 04:25:49 UTC
Ara: the above patch doesn't work. I thought its a simple work, but actually its not. Let me target this for LDTP 1.6.
Comment 4 Nagappan Alagappan 2009-04-16 05:26:22 UTC
Thanks for the bug report. Fixed in git.
Comment 5 Ara Pulido 2009-04-16 15:45:57 UTC
I had expected to have something more clear in ooldtp.

For ldtp.py the solution seems nice, but for ooldtp is more OO to have a getchild method in the component object, to be able to do something like:

button_close = frm1.getchild('Close')

Right now getchild is only available for contexts (in ooldtp)
Comment 6 Ara Pulido 2009-04-16 15:56:48 UTC
in ooldtp.py

Maybe moving getchild back to component and removing parent argument, something like:

    def getchild (self, name = '', role = ''):
        if name == '' and role == '':
            raise ldtp.LdtpExecutionError ('Atleast one argument should be provided <object name> or <role name>')
        if role != ''
            childList = ldtp.getchild (self.__window, name, role, self.__name)
            componentList = []
            for i in childList:
                componentList.append (component (self.__window, i, role, self.__name))
            return componentList
        else:
            return component (self.__window, name)

Parent would always be self.__name
Comment 7 Ara Pulido 2009-04-17 08:24:27 UTC
Created attachment 132809 [details] [review]
Proposed patch for ooldtp

This is a patch for ooldtp.

getchild moved from context to component
Added component name same as window for contexts
Fixes a bug when getting children by role (one more argument to component was given)
Comment 8 Ara Pulido 2009-04-23 11:05:41 UTC
Have you had the time to review the patch?

Thanks, Ara.
Comment 9 Nagappan Alagappan 2009-04-25 23:01:43 UTC
(In reply to comment #8)
> Have you had the time to review the patch?

Uploaded your patch to git. Thanks for the patch :)

Thanks
Comment 10 Ara Pulido 2010-03-31 12:40:22 UTC
Regression in LDTP2

getchild is, again, only available for Context
Comment 11 Nagappan Alagappan 2010-04-06 03:07:36 UTC
Created attachment 158015 [details] [review]
Proposed patch to fix the issue

Ara, request to verify this, also request to add a test for me to verify this issue.

Thanks
Comment 12 Ara Pulido 2010-04-09 11:30:46 UTC
Review of attachment 158015 [details] [review]:

Hello Nagappan,

The fix does not work.

Now, when using getchild for a Context, I get a list of strings, rather than a list of Components

Ideally this is how it would work:

Open gedit with an unsaved documents

gedit = ooldtp.context('frm*gedit')
unsaved = gedit.getchild('ptabUnsavedDocument1')

That would return a Component for the tab and you could do:

unsaved.getchild("txt0")

to get the list of children (also, as a component)

but, currently, you get a string, which does not solves the problem
Comment 13 Nagappan Alagappan 2010-04-14 10:54:07 UTC
Thanks Ara for verifying the fix