Time Picker behaves erractically when min and max is set

Bug #1346669 reported by Nicholas Skaggs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Confirmed
High
Zsombor Egri

Bug Description

Using this example qml,

import QtQuick 2.0
import Ubuntu.Components 1.1
import Ubuntu.Components.Pickers 1.0

MainView {
    width: units.gu(48)
    height: units.gu(60)

    Column {
        DatePicker {
            id: datePicker
            objectName: 'datePicker'
            mode: 'Years|Months|Days'
            maximum: {
                var d = new Date()
                d.setFullYear('2030')
                return d
            }
            minimum: {
                var d = new Date()
                d.setFullYear('1990')
                return d
            }
            date: {
                var d = new Date()
                d.setFullYear('2010')
                d.setMonth('5')
                d.setDate('15')
                return d
            }
        }
        DatePicker {
            id: timePicker
            objectName: 'timePicker'
            mode: 'Hours|Minutes|Seconds'
            maximum: {
                var d = new Date()
                d.setFullYear('2030')
                return d
            }
            minimum: {
                var d = new Date()
                d.setFullYear('1990')
                return d
            }
            date: {
                var d = new Date()
                d.setHours(12)
                d.setMinutes('30')
                d.setSeconds('30')
                return d
            }
        }
    }
}

The timepicker behaves erractically. When selecting a minute, the hour picker. When selecting things with the second picker, both the hour and minute pickers advance forward as well.

It's interesting the min and max dates are being set (this was discovered trying to workaround bug https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1328600) as a timepicker likely doesn't make sense to have a year, but since they can be set the pickers likely should behave properly when done so.

Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Zsombor Egri (zsombi)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Let's please expand the pickers testcases to include a regression test for this so we don't regress on it in the future. It would be trivial to add.

Revision history for this message
Zsombor Egri (zsombi) wrote :

Ok, I guess I got the point. The logic adjusting the time is erroneous depending on the change. If the time component is set forward to the previous value (i.e. seconds), the major time component is also adjusted (i.e. minutes). This is due to a binding loop inside the DatePicker:
"modules/Ubuntu/Components/Pickers/DatePicker.qml:400, unknown) - file:///home/zsombor/projects/datepicker-fix-1346669/modules/Ubuntu/Components/Pickers/DatePicker.qml:400:5: QML MinutesModel: Binding loop detected for property "date""

And I cannot find a pattern to reproduce. So me times the failure happens immediately I run the app, sometimes it only happens on hour, sometimes happens only if at least two tumblers are spanned same time. And sometimes the binding loop does not appear but the failure is there... This is hard to create a test to.

Changed in ubuntu-ui-toolkit:
status: Triaged → Confirmed
Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Zsombor Egri (zsombi)
importance: Undecided → High
status: New → Confirmed
Zoltan Balogh (bzoltan)
no longer affects: ubuntu-ui-toolkit
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.