diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/components.api ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/components.api --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/components.api 2014-03-04 13:01:19.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/components.api 2014-03-06 12:46:27.000000000 +0000 @@ -271,6 +271,7 @@ readonly property int minutes readonly property int seconds property var locale + readonly property bool moving modules/Ubuntu/Components/Pickers/Dialer.qml StyledItem property real minimumValue @@ -296,6 +297,8 @@ property Component delegate property int selectedIndex property bool live + readonly property bool moving + function positionViewAtIndex(index) property int __clickedIndex modules/Ubuntu/Components/Pickers/PickerDelegate.qml AbstractButton diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/debian/changelog ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/debian/changelog --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/debian/changelog 2014-03-13 18:50:14.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/debian/changelog 2014-03-13 18:50:15.000000000 +0000 @@ -1,3 +1,16 @@ +ubuntu-ui-toolkit (0.1.46+14.04.20140306.1-0ubuntu1) trusty; urgency=low + + [ Zsombor Egri ] + * DatePicker flaky test fix. (LP: #1287009) + + [ Ubuntu daily release ] + * New rebuild forced + + [ Michael Zanetti ] + * Make the UbuntuListView tests more stable (LP: #1288597) + + -- Ubuntu daily release Thu, 06 Mar 2014 12:46:50 +0000 + ubuntu-ui-toolkit (0.1.46+14.04.20140304-0ubuntu1) trusty; urgency=low [ CI bot ] diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/DatePicker.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/DatePicker.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-03-06 12:46:27.000000000 +0000 @@ -292,6 +292,14 @@ */ property var locale: Qt.locale() + /*! + \qmlproperty bool moving + \readonly + The property holds whether the component's pickers are moving. + \sa Picker::moving + */ + readonly property alias moving: positioner.moving + implicitWidth: units.gu(36) implicitHeight: units.gu(20) @@ -453,6 +461,13 @@ */ id: tumblerModel + /* + Signal triggered when the model is about to remove a picker. We cannot rely on + rowAboutToBeRemoved, as by the time the signal is called the list element is + already removed from the model. + */ + signal pickerRemoved(int index) + // the function checks whether a pickerModel was added or not // returns the index of the model object the pickerModel was found // or -1 on error. @@ -480,6 +495,7 @@ function removePicker(name) { var idx = pickerModelIndex(name); if (idx >= 0) { + pickerRemoved(idx); remove(idx); } } diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/PickerDelegate.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/PickerDelegate.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/PickerDelegate.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/PickerDelegate.qml 2014-03-06 12:46:27.000000000 +0000 @@ -51,7 +51,7 @@ QtObject { id: internal - property bool inListView: QuickUtils.className(pickerDelegate.parent) !== "QQuickPathView" + property bool inListView: pickerDelegate.parent && (QuickUtils.className(pickerDelegate.parent) !== "QQuickPathView") property Item itemList: !inListView ? pickerDelegate.PathView.view : pickerDelegate.ListView.view property Picker picker: itemList ? itemList.pickerItem : null } diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/PickerModelBase.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/PickerModelBase.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/PickerModelBase.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/PickerModelBase.qml 2014-03-06 12:46:27.000000000 +0000 @@ -141,7 +141,14 @@ if (!pickerCompleted || !pickerItem || resetting) { return; } - pickerItem.selectedIndex = indexOf(); + // use animated index update only if the change had happened because of the delegate update + if (pickerItem.__clickedIndex >= 0) { + pickerItem.selectedIndex = indexOf(); + } else { + // in case the date property was changed due to binding/update, + // position tumbler without animating + pickerItem.positionViewAtIndex(indexOf()); + } } } diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/Picker.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/Picker.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/Picker.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/Picker.qml 2014-03-06 12:46:27.000000000 +0000 @@ -121,6 +121,40 @@ */ property bool live: false + /*! + The property holds whether the picker's view is moving due to the user + interaction either by dragging, flicking or due to the manual change of + the selectedIndex property. + */ + readonly property bool moving: (loader.item ? loader.item.moving : false) || movingPoll.indexChanging + + /*! + The function positions the picker's view to the given index without animating + the view. The component must be ready when calling the function, e.g. to make + sure the Picker shows up at the given index, do the following: + \qml + Picker { + model: 120 + delegate: PickerDelegate { + Label { + anchors.fill: parent + verticalCenter: Text.AlignVCenter + text: modelData + } + } + Component.onCompleted: positionViewAtIndex(10) + } + \endqml + */ + function positionViewAtIndex(index) { + if (!loader.item || !internals.completed) { + return; + } + loader.item.positionViewAtIndex(index, loader.isListView ? ListView.SnapPosition : PathView.SnapPosition); + // update selectedIndex + selectedIndex = loader.item.currentIndex; + } + implicitWidth: units.gu(8) implicitHeight: units.gu(20) @@ -137,6 +171,34 @@ when: __styleInstance.hasOwnProperty("view") && loader.item } + /* + ListView/PathView do not change moding property when the current index is + changed manually. Therefore we use an idle timer to poll the contentY to + detect whether the views are still moving. + PathView's currentIndex changes while the component is moving, however this + is not true for ListView. + */ + Timer { + id: movingPoll + interval: 50 + running: false + property bool indexChanging: false + property real prevContentY + onTriggered: { + if (prevContentY === loader.item.contentY) { + indexChanging = false; + } else { + kick(); + } + } + function kick() { + if (!loader.item) return; + indexChanging = true; + prevContentY = loader.item.contentY; + running = true; + } + } + // tumbler Loader { id: loader @@ -171,12 +233,14 @@ } } onCurrentIndexChanged: { + movingPoll.kick(); if (!loader.completed) return; if (picker.live || (modelWatcher.modelSize() <= 0) || (picker.__clickedIndex >= 0 && (picker.__clickedIndex === loader.item.currentIndex)) || modelWatcher.cropping) { picker.selectedIndex = loader.item.currentIndex; modelWatcher.cropping = false; + picker.__clickedIndex = -1; } } onModelChanged: { @@ -216,6 +280,8 @@ property Item pickerItem: picker // property holding view completion property bool viewCompleted: false + // declared to ease moving detection + property real contentY: offset anchors { top: parent ? parent.top : undefined bottom: parent ? parent.bottom : undefined diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/PickerRow.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/PickerRow.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Pickers/PickerRow.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Pickers/PickerRow.qml 2014-03-06 12:46:27.000000000 +0000 @@ -35,10 +35,51 @@ */ property real margins: units.gu(1.5) + /* + Reports whether either of the pickers is moving + */ + property bool moving + + // the following functions/properties should be kept private in case the + // component is ever decided to be published + + function pickerMoving(isMoving) { + if (isMoving === undefined) { + isMoving = this.moving; + } + + if (isMoving) { + row.moving = true; + } else { + for (var i = 0; i < row.model.count; i++) { + var pickerItem = model.get(i).pickerModel.pickerItem; + if (!pickerItem) return; + if (pickerItem.moving) { + row.moving = true; + return; + } + } + row.moving = false; + } + } + + function disconnectPicker(index) { + var pickerItem = model.get(index).pickerModel.pickerItem; + if (pickerItem) { + pickerItem.onMovingChanged.disconnect(pickerMoving); + } + } + + Connections { + target: row.model + onPickerRemoved: disconnectPicker(index) + } + objectName: "PickerRow_Positioner"; Repeater { id: rowRepeater + onModelChanged: row.pickerMoving(true) Picker { id: unitPicker objectName: "PickerRow_" + pickerName @@ -47,7 +88,7 @@ circular: pickerModel.circular live: false width: pickerModel.pickerWidth - height: parent.height + height: parent ? parent.height : 0 style: Rectangle { anchors.fill: parent @@ -56,7 +97,7 @@ delegate: PickerDelegate { Label { objectName: "PickerRow_PickerLabel" - text: pickerModel.text(modelData) + text: pickerModel ? pickerModel.text(modelData) : "" anchors.fill: parent verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter @@ -82,12 +123,14 @@ pickerModel.reset(); pickerModel.resetLimits(textSizer, margins); pickerModel.resetCompleted(); - selectedIndex = pickerModel.indexOf(); + positionViewAtIndex(pickerModel.indexOf()); } Component.onCompleted: { // update model with the item instance pickerModel.pickerItem = unitPicker; + unitPicker.onMovingChanged.connect(pickerMoving.bind(unitPicker)); + row.pickerMoving(unitPicker.moving); } } } diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/plugin/quickutils.cpp ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/plugin/quickutils.cpp --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/plugin/quickutils.cpp 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/plugin/quickutils.cpp 2014-03-06 12:46:27.000000000 +0000 @@ -112,6 +112,9 @@ */ QString QuickUtils::className(QObject *item) { + if (!item) { + return QString(); + } QString result = item->metaObject()->className(); return result.left(result.indexOf("_QML")); } diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Themes/Ambiance/PickerDelegateStyle.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Themes/Ambiance/PickerDelegateStyle.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/modules/Ubuntu/Components/Themes/Ambiance/PickerDelegateStyle.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/modules/Ubuntu/Components/Themes/Ambiance/PickerDelegateStyle.qml 2014-03-06 12:46:27.000000000 +0000 @@ -22,7 +22,7 @@ property real maxFade: 0.95 property bool fadingEnabled: true - property bool inListView: QuickUtils.className(styledItem.parent) !== "QQuickPathView" + property bool inListView: styledItem.parent && (QuickUtils.className(styledItem.parent) !== "QQuickPathView") property Item itemList: inListView ? styledItem.ListView.view : styledItem.PathView.view property Item picker: styledItem.picker property Item highlightItem: itemList.highlightItem diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/resources/pickers/DatePickerTest.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/resources/pickers/DatePickerTest.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/resources/pickers/DatePickerTest.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/resources/pickers/DatePickerTest.qml 2014-03-06 12:46:27.000000000 +0000 @@ -32,6 +32,7 @@ date: new Date() onDateChanged: print("CHANGED DATE=" + Qt.formatDateTime(date, "yyyy/MM/dd, hh:mm:ss")) + onMovingChanged: print("MOVING?", moving) } Slider { value: 0.0//units.gu(36) @@ -47,21 +48,25 @@ spacing: units.gu(1) Button { text: "HU" + width: units.gu(5) height: units.gu(2) onClicked: picker.locale = Qt.locale("hu_HU") } Button { text: "DE" + width: units.gu(5) height: units.gu(2) onClicked: picker.locale = Qt.locale("de_DE") } Button { text: "EN(US)" + width: units.gu(9) height: units.gu(2) onClicked: picker.locale = Qt.locale("en_US") } Button { text: "FI" + width: units.gu(5) height: units.gu(2) onClicked: { picker.locale = Qt.locale("fi_FI") diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/resources/pickers/PickerTest.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/resources/pickers/PickerTest.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/resources/pickers/PickerTest.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/resources/pickers/PickerTest.qml 2014-03-06 12:46:27.000000000 +0000 @@ -42,6 +42,7 @@ height: units.gu(40) model: pickerModel delegate: PickerDelegate { + property string text: modelData ? modelData : "" Label { anchors.fill: parent horizontalAlignment: Text.AlignHCenter @@ -50,6 +51,7 @@ } } onSelectedIndexChanged: print("circular index="+selectedIndex) + onMovingChanged: print("MOVING?", moving) } Picker { @@ -59,6 +61,7 @@ model: pickerModel circular: false delegate: PickerDelegate { + property string text: modelData ? modelData : "" Label { anchors.fill: parent horizontalAlignment: Text.AlignHCenter @@ -67,6 +70,7 @@ } } onSelectedIndexChanged: print("linear index="+selectedIndex) + onMovingChanged: print("MOVING?", moving) } Picker { @@ -82,6 +86,7 @@ } } onSelectedIndexChanged: print("circular index="+selectedIndex) + onMovingChanged: print("MOVING?", moving) } Picker { @@ -98,6 +103,7 @@ } } onSelectedIndexChanged: print("linear index="+selectedIndex) + onMovingChanged: print("MOVING?", moving) } } diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/unit_x11/tst_components/tst_datepicker.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/unit_x11/tst_components/tst_datepicker.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/unit_x11/tst_components/tst_datepicker.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/unit_x11/tst_components/tst_datepicker.qml 2014-03-06 12:46:27.000000000 +0000 @@ -25,58 +25,44 @@ width: units.gu(40) height: units.gu(71) - DatePicker { - id: picker - width: parent.width - } - - SignalSpy { - id: modeChange - target: picker - signalName: "modeChanged" - } - - SignalSpy { - id: dateChange - target: picker - signalName: "dateChanged" - } - - SignalSpy { - id: yearChange - target: picker - signalName: "yearChanged" - } - - SignalSpy { - id: monthChange - target: picker - signalName: "monthChanged" - } - - SignalSpy { - id: dayChange - target: picker - signalName: "dayChanged" + Component { + id: testComponent + DatePicker { + width: testSuite.width + } } - - SignalSpy { - id: weekChange - target: picker - signalName: "weekChanged" + Loader { + id: pickerLoader + asynchronous: false + width: parent.width } UbuntuTestCase { name: "DatePickerAPI" when: windowShown + readonly property DatePicker picker: pickerLoader.item + + function init() { + pickerLoader.sourceComponent = testComponent; + tryCompareFunction(function(){return pickerLoader.status}, Loader.Ready); + waitPickerMoving(); + } + function cleanup() { + pickerLoader.sourceComponent = undefined; + } + function waitPickerMoving() { + waitForRendering(picker); + tryCompareFunction(function(){return picker.moving}, false); + } + function getPickerLabel(picker, name) { var pickerItem = findChild(picker, name); var pickerCurrent = findChild(pickerItem, "Picker_ViewLoader"); return findChild(pickerCurrent.item.currentItem, "PickerRow_PickerLabel"); } function getPickerModel(picker, name) { - var pickerItem = findChild(picker, name); + var pickerItem = findInvisibleChild(picker, name); return pickerItem ? pickerItem.model : undefined; } function setHMS(date, h, m, s) { @@ -114,213 +100,149 @@ var newMode = "Years|Months"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeMD() { var newMode = "Days|Months"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeYD() { var newMode = "Years|Days"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + // no rendering is expected, no need to wait var positioner = findChild(picker, "PickerRow_Positioner"); expectFailContinue("", "Invalid mode"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeY() { var newMode = "Years"; var pickerCount = 1 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeM() { var newMode = "Months"; var pickerCount = 1 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeD() { var newMode = "Days"; var pickerCount = 1 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeHMS() { var newMode = "Hours|Minutes|Seconds"; var pickerCount = 3 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeHM() { var newMode = "Hours|Minutes"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeMS() { var newMode = "Minutes|Seconds"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeHS() { var newMode = "Hours|Seconds"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); expectFailContinue("", "cannot set mode to Hours|Minutes"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeH() { var newMode = "Hours"; var pickerCount = 1 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeMinute() { var newMode = "Minutes"; var pickerCount = 1 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeS() { var newMode = "Seconds"; var pickerCount = 1 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeYMDHMS() { var newMode = "Years|Months|Days|Hours|Minutes|Seconds"; var pickerCount = 6 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); expectFailContinue("", "cannot combine date and time pickers"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeYH() { var newMode = "Years|Hours"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + waitPickerMoving(); var positioner = findChild(picker, "PickerRow_Positioner"); expectFailContinue("", "cannot combine date and time pickers"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeModeUnhandled() { var newMode = "Years|Whatever"; var pickerCount = 2 + 1; // +1 is the Repeater picker.mode = newMode; - wait(500); + // no rendering is expected, no need to wait var positioner = findChild(picker, "PickerRow_Positioner"); expectFailContinue("", "unhandled mode flag should not pass"); compare(positioner.children.length, pickerCount, "invalid amount of pickers"); - - picker.mode = "Years|Months|Days"; - pickerCount = 3 + 1; // +1 is the Repeater - compare(positioner.children.length, pickerCount, "invalid amount of pickers"); } function test_1_changeLocale() { @@ -328,16 +250,14 @@ var locale = Qt.locale("hu_HU"); picker.minimum = new Date(2012, 11, 1); picker.date = new Date(2012, 11, 1); - wait(500) picker.locale = Qt.locale("hu_HU"); - wait(500) + waitPickerMoving(); var label = getPickerLabel(picker, "PickerRow_MonthPicker"); compare(label.text, locale.monthName(picker.date.getMonth(), Locale.LongFormat), "locale for month wrong"); label = getPickerLabel(picker, "PickerRow_DayPicker"); var dayModel = getPickerModel(picker, "PickerRow_DayPicker"); compare(label.text, dayModel.text(picker.date.getDate() - 1, testSuite.width), "locale for day name wrong"); - picker.locale = prevLocale; } function test_1_changeMinimumBeforeDate() { @@ -346,7 +266,8 @@ date.setFullYear(date.getFullYear() - 1); date.setDate(1); picker.minimum = date; - wait(500); + // no rendering is expected, so no need to wait + var year = getPickerLabel(picker, "PickerRow_YearPicker"); compare(year.text, originalDate.getFullYear().toString(), "year differs"); var month = getPickerLabel(picker, "PickerRow_MonthPicker"); @@ -362,7 +283,7 @@ date.setFullYear(date.getFullYear() + 1); date.setDate(1); picker.maximum = date; - wait(500); + waitPickerMoving(); var year = getPickerLabel(picker, "PickerRow_YearPicker"); compare(year.text, originalDate.getFullYear().toString(), "year differs"); var month = getPickerLabel(picker, "PickerRow_MonthPicker"); @@ -375,26 +296,27 @@ // make infinite function test_1_changeMinimumInvalid() { picker.minimum = Date.prototype.getInvalidDate.call(); + // no rendering is expected compare(picker.minimum, picker.date, "invalid minimum hasn't been adjusted to date"); } // make infinite function test_1_changeMaximumInvalid() { picker.maximum = Date.prototype.getInvalidDate.call(); - + waitPickerMoving(); // check if the year picker model is autoExtending var yearModel = getPickerModel(picker, "PickerRow_YearPicker"); compare(yearModel.autoExtend, true, "the year picker is not auto-extending one"); } function test_1_changeDate() { - var date = picker.date; - date.setFullYear(date.getFullYear() + 2); + var date = new Date(); + date.setFullYear(picker.date.getFullYear() + 2); date.setMonth(5); date.setDate(21); picker.date = date; picker.mode = "Years|Months|Days"; - wait(500); + waitPickerMoving(); var yearLabel = getPickerLabel(picker, "PickerRow_YearPicker"); var monthLabel = getPickerLabel(picker, "PickerRow_MonthPicker"); @@ -410,15 +332,15 @@ picker.minimum = new Date(2013, 9, 1); picker.date = new Date(2013, 09, 31); picker.locale = Qt.locale("hu_HU") - wait(500); + waitPickerMoving(); // click on the month picker to set the next month var monthPicker = findChild(picker, "PickerRow_MonthPicker"); var monthCurrent = findChild(monthPicker, "Picker_ViewLoader"); var my = monthPicker.y + (monthPicker.height / 2) + monthCurrent.item.currentItem.height; var mx = monthPicker.x + monthPicker.width / 2; - mouseClick(testSuite, mx, my); - wait(500); + mouseClick(picker, mx, my); + waitPickerMoving(); var yearLabel = getPickerLabel(picker, "PickerRow_YearPicker"); var monthLabel = getPickerLabel(picker, "PickerRow_MonthPicker"); @@ -433,8 +355,8 @@ // set it back my = monthPicker.y + (monthPicker.height / 2) - monthCurrent.item.currentItem.height; - mouseClick(testSuite, mx, my); - wait(500); + mouseClick(picker, mx, my); + waitPickerMoving(); compare(yearLabel.text, "2013", "different year value"); // October @@ -451,8 +373,9 @@ var maxDate = new Date(2013, 11, 31); picker.minimum = minDate; picker.maximum = maxDate; - wait(500); + waitPickerMoving(); picker.date = date; + waitPickerMoving(); var yearPicker = findChild(picker, "PickerRow_YearPicker"); compare(yearPicker.enabled, false, "year picker should be disabled"); @@ -465,6 +388,7 @@ picker.minimum = minDate; picker.maximum = maxDate; picker.date = date; + waitPickerMoving(); var yearPicker = findChild(picker, "PickerRow_YearPicker"); compare(yearPicker.enabled, false, "year picker should be disabled"); @@ -491,10 +415,11 @@ function test_3_changeHours() { picker.mode = "Hours|Minutes|Seconds"; + waitPickerMoving(); var date = new Date(picker.date); date.setHours((date.getHours() + 10) % 24); picker.date = date; - wait(500); + waitPickerMoving(); var hoursLabel = getPickerLabel(picker, "PickerRow_HoursPicker"); verify(hoursLabel, "hour label undefined"); @@ -512,7 +437,7 @@ var date = new Date(picker.date); date.setMinutes((date.getMinutes() + 40) % 60); picker.date = date; - wait(500); + waitPickerMoving(); var hoursLabel = getPickerLabel(picker, "PickerRow_HoursPicker"); verify(hoursLabel, "hour label undefined"); @@ -530,7 +455,7 @@ var date = new Date(picker.date); date.setSeconds((date.getSeconds() + 50) % 60); picker.date = date; - wait(500); + waitPickerMoving(); var hoursLabel = getPickerLabel(picker, "PickerRow_HoursPicker"); verify(hoursLabel, "hour label undefined"); @@ -550,7 +475,7 @@ date.setFullYear(date.getFullYear() - 1); date.setDate(1); picker.minimum = date; - wait(500); + waitPickerMoving(); var hoursLabel = getPickerLabel(picker, "PickerRow_HoursPicker"); verify(hoursLabel, "hour label undefined"); @@ -570,7 +495,7 @@ date.setFullYear(date.getFullYear() + 1); date.setDate(1); picker.maximum = date; - wait(500); + waitPickerMoving(); var hoursLabel = getPickerLabel(picker, "PickerRow_HoursPicker"); verify(hoursLabel, "hour label undefined"); compare(hoursLabel.text, ("00" + originalDate.getHours()).slice(-2), "hours differ"); @@ -583,12 +508,13 @@ } function test_4_disabledHour() { + picker.mode = "Hours|Minutes|Seconds"; var date = setHMS(new Date(), 12, 10, 45); var minDate = setHMS(new Date(), 12, 0, 0); var maxDate = setHMS(new Date(), 12, 59, 59); picker.minimum = minDate; picker.maximum = maxDate; - wait(500); + waitPickerMoving(); picker.date = date; var hoursPicker = findChild(picker, "PickerRow_HoursPicker"); @@ -596,13 +522,14 @@ } function test_4_disabledHoursAndMinutes() { + picker.mode = "Hours|Minutes|Seconds"; var date = setHMS(new Date(), 12, 10, 45); var minDate = setHMS(new Date(), 12, 10, 0); var maxDate = setHMS(new Date(), 12, 10, 59); picker.minimum = minDate; picker.maximum = maxDate; picker.date = date; - wait(500); + waitPickerMoving(); var hoursPicker = findChild(picker, "PickerRow_HoursPicker"); compare(hoursPicker.enabled, false, "hours picker should be disabled"); @@ -611,13 +538,14 @@ } function test_4_linearSecondsPicker() { + picker.mode = "Hours|Minutes|Seconds"; var date = setHMS(new Date(), 12, 10, 45); var minDate = setHMS(new Date(), 12, 10, 1); var maxDate = setHMS(new Date(), 12, 10, 59); picker.minimum = minDate; picker.maximum = maxDate; picker.date = date; - wait(500); + waitPickerMoving(); var hoursPicker = findChild(picker, "PickerRow_HoursPicker"); compare(hoursPicker.enabled, false, "hours picker should be disabled"); diff -Nru ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/unit_x11/tst_components/tst_ubuntulistview.qml ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/unit_x11/tst_components/tst_ubuntulistview.qml --- ubuntu-ui-toolkit-0.1.46+14.04.20140304/tests/unit_x11/tst_components/tst_ubuntulistview.qml 2014-03-04 13:00:39.000000000 +0000 +++ ubuntu-ui-toolkit-0.1.46+14.04.20140306.1/tests/unit_x11/tst_components/tst_ubuntulistview.qml 2014-03-06 12:46:40.000000000 +0000 @@ -82,6 +82,7 @@ ubuntuListView.expandedIndex = index; var targetHeight = Math.min(item.expandedHeight, ubuntuListView.height - item.collapsedHeight); tryCompare(item, "height", targetHeight); + waitForRendering(ubuntuListView) } function collapse() { @@ -92,6 +93,7 @@ var expandedItem = findChild(ubuntuListView, "expandable" + ubuntuListView.expandedIndex); ubuntuListView.expandedIndex = -1; tryCompare(expandedItem, "height", expandedItem.collapsedHeight); + waitForRendering(ubuntuListView); } function test_expandedItem() {