on xenial help sign in
more tweaks and test fixes
5dea3c2Nick Dedekind
qml/Panel/IndicatorItemRow.qml+7−7
@@ -25,7 +25,7 @@ Item {
25 property QtObject indicatorsModel: null
25 property QtObject indicatorsModel: null
26 property real overFlowWidth: width
26 property real overFlowWidth: width
27 property bool expanded: false
27 property bool expanded: false
28− property var currentItem: null
28+ property var currentItem
29 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
29 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
30
30
31 property real unitProgress: 0.0
31 property real unitProgress: 0.0
@@ -82,16 +82,16 @@ Item {
82 }
82 }
83
83
84 function resetCurrentItem() {
84 function resetCurrentItem() {
85− currentItem = null;
86− d.previousItem = null;
87 d.firstItemSwitch = true;
85 d.firstItemSwitch = true;
86+ d.previousItem = undefined;
87+ currentItem = undefined;
88 }
88 }
89
89
90 function setCurrentItemIndex(index) {
90 function setCurrentItemIndex(index) {
91 for (var i = 0; i < row.children.length; i++) {
91 for (var i = 0; i < row.children.length; i++) {
92 var item = row.children[i];
92 var item = row.children[i];
93 if (item.hasOwnProperty("ownIndex") && item.ownIndex === index) {
93 if (item.hasOwnProperty("ownIndex") && item.ownIndex === index) {
94− currentItem = item;
94+ if (currentItem !== item) currentItem = item;
95 break;
95 break;
96 }
96 }
97 }
97 }
@@ -111,14 +111,14 @@ Item {
111 break;
111 break;
112 }
112 }
113 }
113 }
114− currentItem = item;
114+ if (currentItem !== item) currentItem = item;
115 }
115 }
116 }
116 }
117
117
118 QtObject {
118 QtObject {
119 id: d
119 id: d
120 property bool firstItemSwitch: true
120 property bool firstItemSwitch: true
121− property var previousItem: null
121+ property var previousItem
122 }
122 }
123
123
124 onCurrentItemChanged: {
124 onCurrentItemChanged: {
@@ -170,7 +170,7 @@ Item {
170 anchors.bottom: row.bottom
170 anchors.bottom: row.bottom
171 height: units.dp(2)
171 height: units.dp(2)
172 color: root.hightlightColor
172 color: root.hightlightColor
173− visible: currentItem !== null
173+ visible: currentItem !== undefined
174 opacity: 0.0
174 opacity: 0.0
175
175
176 width: currentItem ? currentItem.width : 0
176 width: currentItem ? currentItem.width : 0
qml/Panel/IndicatorsBar.qml+2−2
@@ -73,7 +73,7 @@ Item {
73
73
74 QtObject {
74 QtObject {
75 id: d
75 id: d
76− property var initialItem: null
76+ property var initialItem
77 // the non-expanded distance from row offset to center of initial item
77 // the non-expanded distance from row offset to center of initial item
78 property real originalDistanceFromRight: -1
78 property real originalDistanceFromRight: -1
79 property real originalItemWidth: -1
79 property real originalItemWidth: -1
@@ -113,7 +113,7 @@ Item {
113 Connections {
113 Connections {
114 target: row
114 target: row
115 onCurrentItemChanged: {
115 onCurrentItemChanged: {
116− if (!row.currentItem) d.initialItem = null;
116+ if (!row.currentItem) d.initialItem = undefined;
117 else if (!d.initialItem) d.initialItem = row.currentItem;
117 else if (!d.initialItem) d.initialItem = row.currentItem;
118 }
118 }
119 }
119 }
qml/Panel/IndicatorsMenu.qml+1
@@ -25,6 +25,7 @@ Showable {
25 property alias showDragHandle: __showDragHandle
25 property alias showDragHandle: __showDragHandle
26 property alias hideDragHandle: __hideDragHandle
26 property alias hideDragHandle: __hideDragHandle
27 property alias overFlowWidth: bar.overFlowWidth
27 property alias overFlowWidth: bar.overFlowWidth
28+ property alias verticalVelocityThreashold: yVelocityCalculator.velocityThreashold
28
29
29 property int minimizedPanelHeight: units.gu(3)
30 property int minimizedPanelHeight: units.gu(3)
30 property int expandedPanelHeight: units.gu(7)
31 property int expandedPanelHeight: units.gu(7)
tests/qmltests/Panel/tst_IndicatorsMenu.qml+11−6
@@ -53,6 +53,9 @@ IndicatorTest {
53 openedHeight: parent.height
53 openedHeight: parent.height
54 indicatorsModel: root.indicatorsModel
54 indicatorsModel: root.indicatorsModel
55 shown: false
55 shown: false
56+
57+ // no vertical movement allowed while dragging
58+ verticalVelocityThreashold: 0
56 }
59 }
57 }
60 }
58
61
@@ -120,12 +123,10 @@ IndicatorTest {
120
123
121 function test_progress_changes_state_to_reveal() {
124 function test_progress_changes_state_to_reveal() {
122 indicatorsMenu.height = indicatorsMenu.openedHeight / 2;
125 indicatorsMenu.height = indicatorsMenu.openedHeight / 2;
123− compare(indicatorsMenu.state, "reveal", "Indicators should be locked when fully opened.");
126+ compare(indicatorsMenu.state, "reveal", "Indicators should be revealing when partially opened.");
124− }
125
127
126− function test_progress_changes_state_to_locked() {
127 indicatorsMenu.height = indicatorsMenu.openedHeight;
128 indicatorsMenu.height = indicatorsMenu.openedHeight;
128− compare(indicatorsMenu.state, "locked", "Indicators should be locked when fully opened.");
129+ compare(indicatorsMenu.state, "reveal", "Indicators should still be revealing when fully opened.");
129 }
130 }
130
131
131 function test_open_state() {
132 function test_open_state() {
@@ -218,10 +219,14 @@ IndicatorTest {
218 touchFlick(indicatorsMenu,
219 touchFlick(indicatorsMenu,
219 firstItemMappedPosition.x, indicatorsMenu.minimizedPanelHeight * 2,
220 firstItemMappedPosition.x, indicatorsMenu.minimizedPanelHeight * 2,
220 nextItemMappedPosition.x, indicatorsMenu.openedHeight / 3,
221 nextItemMappedPosition.x, indicatorsMenu.openedHeight / 3,
221− false /* beginTouch */, true /* endTouch */,
222+ false /* beginTouch */, false /* endTouch */,
222− units.gu(5) /* speed */, 10 /* iterations */); // more samples needed for accurate velocity
223+ units.gu(50) /* speed */, 5 /* iterations */); // more samples needed for accurate velocity
223
224
224 compare(indicatorItemRow.currentItem, firstItem, "First indicator should still be the current item");
225 compare(indicatorItemRow.currentItem, firstItem, "First indicator should still be the current item");
226+ // after waiting in the same spot with touch down, it should update to the next item.
227+ tryCompare(indicatorItemRow, "currentItem", nextItem);
228+
229+ touchRelease(indicatorsMenu, nextItemMappedPosition.x, indicatorsMenu.openedHeight / 3);
225 }
230 }
226 }
231 }
227}
232}