Autopilot-qt does not support QDateTime

Bug #1193397 reported by Nicholas Skaggs
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Autopilot Qt Support
Fix Released
Undecided
Michael Zanetti

Bug Description

A property that is initialized via function or variable doesn't seem to be introspectable with autopilot. For example, imagine my qml file contains this:

 myProperty A= newCoolness()
myPropertyB = 1

myPropertyA will fail and give the noneType = none attribute error -- it returns a blank object -- when issuing a select against it. This even fails when using Omer's "retry function" to select_single, sleep and then loop until we get the result with a timeout. It

The myPropertyB however works as expected with no issue.

Related branches

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> For example, imagine my qml file contains this:
>
> myProperty A= newCoolness()
> myPropertyB = 1

This can be anything... Can you please provide more context? The way it stands here does not compile in QML.

Changed in autopilot-qt:
status: New → Incomplete
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Sure, let me provide the specific branch that exhibits this behavior:

lp:~pkunal-parmar/ubuntu-calendar-app/today

See this merge for reference if you wish:
https://code.launchpad.net/~pkunal-parmar/ubuntu-calendar-app/today/+merge/169436

Specifically if you look in the .qml file you'll see this:

property var monthStart: currentItem != null ? currentItem.monthStart : (new Date()).monthStart()

however, If I set monthStart to something like this, the testcase passes:
property var monthStart: "test"

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Some snippets to make it easier

The testcase looks like this:
def test_monthview_change_month(self):
...
 month_view = self.main_window.get_month_view()

The function is defined as:
    def get_month_view(self):
        return self.app.select_single("MonthView")

And the Month.qml file looks like this:

ListView {
    id: monthView

    readonly property var monthStart: currentItem != null ? currentItem.monthStart : (new Date()).monthStart()
    readonly property var monthEnd: currentItem != null ? currentItem.monthEnd : (new Date()).monthStart().addMonths(1)
    readonly property var currentDayStart: intern.currentDayStart
...

Finally, the error given is:

 AttributeError: Class 'MonthView' has no attribute 'currentDayStart'.

summary: - Dynamically set properties are not introspectable
+ Autopilot-qt does not support QDateTime
Revision history for this message
Michael Zanetti (mzanetti) wrote :

After digging a bit deeper this seems to be caused by the fact that those properties are of type QDateTime which cannot be serialized through D-Bus.

Not entirely sure right now how to handle this. I guess this could be serialized by transmitting the unix timestamp for example. In the test you would have to use it like this:

var monthStart = time.ctime(self.main_window.get_month_view().monthStart)

Which is not really intuitive. So lets explore other solution before just hacking in this ugly solution.

Chris, Thomi: Is there any format I could use for serializing a datetime so python would automatically recognize it as such?

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote : Re: [Bug 1193397] Re: Autopilot-qt does not support QDateTime

On Tue, Jun 25, 2013 at 10:26 PM, Michael Zanetti <
<email address hidden>> wrote:

> Chris, Thomi: Is there any format I could use for serializing a datetime
> so python would automatically recognize it as such?
>

No, but we need a system for patching the types of attributes on the
autopilot side already - there's an open work item for this. We'd need to
spend some time figuring out what the best way to support this is though.

My guess is that it would require a dbus wire protocol change, which would
be somewhat disruptive at this point...

--
Thomi Richards
<email address hidden>

Revision history for this message
Michael Zanetti (mzanetti) wrote :

Right... so I probably could transmit the unix timestamp as an integer for now like suggested before. That would not be disruptive and at least allow to work with date time objects.

Only downside, it is subject to break once support for real datetime types is added. However, I guess still better then the current state.

Changed in autopilot-qt:
assignee: nobody → Michael Zanetti (mzanetti)
status: Incomplete → In Progress
Changed in autopilot-qt:
status: In Progress → Fix Released
status: Fix Released → In Progress
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:autopilot-qt at revision 67, scheduled for release in autopilot-qt, milestone Unknown

Changed in autopilot-qt:
status: In Progress → Fix Committed
Changed in autopilot-qt:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.