ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #06094
Re: Autopilot: Get dynamic elements contained within a ListView
On Wed, Jan 22, 2014 at 03:59:50PM -0600, Leo Arias wrote:
> Hello,
>
> On Wed, Jan 22, 2014 at 12:02 PM, Iain Lane <laney@xxxxxxxxxx> wrote:
>
> > I need to write some tests that operate on ListViews. The contents are
> > dynamic (some of the models are QAbstractTableModels from C++, even) so
> > I cannot address the items by objectName.
> >
> > How can I get at these? I can select the ListView itself, but I don't
> > see any way to get a list of elements in the model. I can use the
> > unreleased emulator for now, if that's necessary.
> >
>
> Copying from my IRC reply...
Cheers, with
> You can do something like:
> list = main_view.select_single(ubuntuuitoolkit.emulators.QQuickListView)
ubuntuuitoolkit.emulators.SingleValue
> elements = list.select_many(ubuntuuitoolkit.emulators.Base)
it works. I did need to sort it on the y coordinate but with that it
seems to work.
Sorry for the annoying questions, but I have another one now --- I can
expand the ItemSelector from AP (modulo bug #1271969 which I worked
around by calculating the coordinates), but then I don't know how to get
at the items in it. The introspection tree is
<http://paste.ubuntu.com/6804028/> (warning: huge) — I want to click the
"By size" label. Trying item_selector.select_single(text="By size")
doesn't find it. Is it because it's down a few levels of the tree? The
code is "ItemSelector { … model: ["By name", "By size"] }" which I don't
know how to attach ObjectNames to.
Cheers,
--
Iain Lane [ iain@xxxxxxxxxxxxxxxxxxx ]
Debian Developer [ laney@xxxxxxxxxx ]
Ubuntu Developer [ laney@xxxxxxxxxx ]
Attachment:
signature.asc
Description: Digital signature
Follow ups
References