ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #06096
Re: Autopilot: Get dynamic elements contained within a ListView
On 23/01/14 17:40, Iain Lane wrote:
> 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 Also Stuart Langridge is doing a nice guide on using u1db in list
views at the minute you could look at that code. See
http://planet.ubuntu.com
--
You make it, I'll break it!
I love my job :)
http://www.ubuntu.com
http://www.canonical.com
Attachment:
signature.asc
Description: OpenPGP digital signature
References