Merge lp:~nick-dedekind/unity8/remove.overview into lp:unity8

Proposed by Nick Dedekind
Status: Merged
Approved by: MichaƂ Sawicz
Approved revision: 117
Merged at revision: 120
Proposed branch: lp:~nick-dedekind/unity8/remove.overview
Merge into: lp:unity8
Diff against target: 1420 lines (+74/-879)
15 files modified
Panel/IndicatorRow.qml (+1/-2)
Panel/Indicators.qml (+21/-44)
Panel/MenuContent.qml (+8/-67)
Panel/Menus/IndicatorMenuWindow.qml (+0/-35)
Panel/Menus/Overview.qml (+0/-70)
Panel/Menus/Overview/FlightModeWidget.qml (+0/-60)
Panel/Menus/Overview/OverviewGrid.qml (+0/-135)
Panel/Menus/Overview/VolumeWidget.qml (+0/-88)
tests/qmltests/CMakeLists.txt (+0/-2)
tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml (+0/-68)
tests/qmltests/Panel/tst_IndicatorRow.qml (+0/-14)
tests/qmltests/Panel/tst_Indicators.qml (+1/-39)
tests/qmltests/Panel/tst_MenuContent.qml (+10/-80)
tests/qmltests/Panel/tst_Overview.qml (+0/-142)
tests/qmltests/Panel/tst_Panel.qml (+33/-33)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/remove.overview
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Daniel d'Andrada (community) Approve
Review via email: mp+175294@code.launchpad.net

Commit message

Removed overview from indicators.

Description of the change

Removed overview from indicators.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Quite many changes are solely fixing coding style. It distracts from the relevant changes of this patch.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

All seems to work and changes look fine, even though you're piggybacking a coding style cleanup.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> All seems to work and changes look fine, even though you're piggybacking a
> coding style cleanup.

Didn't want Saviq coming at me with semi-colon changes ;)

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Panel/IndicatorRow.qml'
--- Panel/IndicatorRow.qml 2013-06-17 09:02:14 +0000
+++ Panel/IndicatorRow.qml 2013-07-17 16:45:32 +0000
@@ -24,7 +24,6 @@
24 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -124 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
25 property alias row: row25 property alias row: row
26 property QtObject indicatorsModel: null26 property QtObject indicatorsModel: null
27 property bool overviewActive: false // "state of the menu"
2827
29 Behavior on y {NumberAnimation {duration: 300; easing.type: Easing.OutCubic} }28 Behavior on y {NumberAnimation {duration: 300; easing.type: Easing.OutCubic} }
3029
@@ -76,7 +75,7 @@
76 height: indicatorRow.height75 height: indicatorRow.height
77 y: {76 y: {
78 //FIXME: all indicators will be initial for now.77 //FIXME: all indicators will be initial for now.
79 if (!highlighted && !overviewActive && (indicatorRow.state == "locked" || indicatorRow.state == "commit")) {78 if (!highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")) {
80 return -indicatorRow.height79 return -indicatorRow.height
81 } else {80 } else {
82 return 081 return 0
8382
=== modified file 'Panel/Indicators.qml'
--- Panel/Indicators.qml 2013-07-03 16:33:58 +0000
+++ Panel/Indicators.qml 2013-07-17 16:45:32 +0000
@@ -56,36 +56,22 @@
5656
57 onHeightChanged: {57 onHeightChanged: {
58 // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)58 // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
59 var contentProgress = indicators.height - handle.get_height()59 var contentProgress = indicators.height - handle.get_height();
60 if (!showAnimation.running && !hideAnimation.running) {60 if (!showAnimation.running && !hideAnimation.running) {
61 if (contentProgress <= hintValue && indicators.state == "reveal") {61 if (contentProgress <= hintValue && indicators.state == "reveal") {
62 indicators.state = "hint"62 indicators.state = "hint";
63 menuContent.hideAll()
64 } else if (contentProgress > hintValue && contentProgress < lockThreshold) {63 } else if (contentProgress > hintValue && contentProgress < lockThreshold) {
65 menuContent.showMenu()64 indicators.state = "reveal";
66 indicators.state = "reveal"
67 } else if (contentProgress >= lockThreshold && lockThreshold > 0) {65 } else if (contentProgress >= lockThreshold && lockThreshold > 0) {
68 // If we've shown the overview and are closing the view with progress changes (revealer handle),66 indicators.state = "locked";
69 // we dont want to switch to a indicator menu until we hit reveal state.
70 if (menuContent.overviewActive) {
71 menuContent.showOverview()
72 } else {
73 menuContent.showMenu()
74 }
75 indicators.state = "locked"
76 }67 }
77 }68 }
7869
79 if (contentProgress == 0) {70 if (contentProgress == 0) {
80 menuContent.releaseContent()71 menuContent.releaseContent();
81 }72 }
82 }73 }
8374
84 function openOverview() {
85 indicatorRow.currentItem = null
86 menuContent.showOverview()
87 }
88
89 function calculateCurrentItem(xValue, useBuffer) {75 function calculateCurrentItem(xValue, useBuffer) {
90 var rowCoordinates76 var rowCoordinates
91 var itemCoordinates77 var itemCoordinates
@@ -93,7 +79,7 @@
93 var distanceFromRightEdge79 var distanceFromRightEdge
94 var bufferExceeded = false80 var bufferExceeded = false
9581
96 if (indicators.state == "commit" || indicators.state == "locked" || showAnimation.running || hideAnimation.running) return82 if (indicators.state == "commit" || indicators.state == "locked" || showAnimation.running || hideAnimation.running) return;
9783
98 /*84 /*
99 If user drags the indicator handle bar down a distance hintValue or less, this is 0.85 If user drags the indicator handle bar down a distance hintValue or less, this is 0.
@@ -102,14 +88,14 @@
102 */88 */
103 var verticalProgress =89 var verticalProgress =
104 MathLocal.clamp((indicators.height - handle.height - hintValue) /90 MathLocal.clamp((indicators.height - handle.height - hintValue) /
105 (lockThreshold - hintValue), 0, 1)91 (lockThreshold - hintValue), 0, 1);
10692
107 /*93 /*
108 Percentage of an indicator icon's width the user's press can stray horizontally from the94 Percentage of an indicator icon's width the user's press can stray horizontally from the
109 focused icon before we change focus to another icon. E.g. a value of 0.5 means you must95 focused icon before we change focus to another icon. E.g. a value of 0.5 means you must
110 go right a distance of half an icon's width before focus moves to the icon on the right96 go right a distance of half an icon's width before focus moves to the icon on the right
111 */97 */
112 var maxBufferThreshold = 0.598 var maxBufferThreshold = 0.5;
11399
114 /*100 /*
115 To help users find the indicator of their choice while opening the indicators, we add logic to add a101 To help users find the indicator of their choice while opening the indicators, we add logic to add a
@@ -126,12 +112,12 @@
126 itemCoordinates = indicatorRow.row.mapToItem(currentItem, rowCoordinates.x, 0);112 itemCoordinates = indicatorRow.row.mapToItem(currentItem, rowCoordinates.x, 0);
127 distanceFromRightEdge = (currentItem.width - itemCoordinates.x) / (currentItem.width)113 distanceFromRightEdge = (currentItem.width - itemCoordinates.x) / (currentItem.width)
128 if (Math.abs(currentItem.ownIndex - indicatorRow.currentItemIndex) > 1) {114 if (Math.abs(currentItem.ownIndex - indicatorRow.currentItemIndex) > 1) {
129 bufferExceeded = true115 bufferExceeded = true;
130 } else {116 } else {
131 if (indicatorRow.currentItemIndex < currentItem.ownIndex && distanceFromRightEdge < (1 - effectiveBufferThreshold)) {117 if (indicatorRow.currentItemIndex < currentItem.ownIndex && distanceFromRightEdge < (1 - effectiveBufferThreshold)) {
132 bufferExceeded = true118 bufferExceeded = true;
133 } else if (indicatorRow.currentItemIndex > currentItem.ownIndex && distanceFromRightEdge > effectiveBufferThreshold) {119 } else if (indicatorRow.currentItemIndex > currentItem.ownIndex && distanceFromRightEdge > effectiveBufferThreshold) {
134 bufferExceeded = true120 bufferExceeded = true;
135 }121 }
136 }122 }
137 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItem < 0 || indicatorRow.currentItem == null) {123 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItem < 0 || indicatorRow.currentItem == null) {
@@ -172,8 +158,7 @@
172 bottom: parent.bottom158 bottom: parent.bottom
173 }159 }
174 indicatorsModel: indicatorsModel160 indicatorsModel: indicatorsModel
175 animate: false161 clip: !indicators.fullyOpened
176 clip: indicators.partiallyOpened
177162
178 onMenuSelected: {163 onMenuSelected: {
179 indicatorRow.setItem(index)164 indicatorRow.setItem(index)
@@ -209,7 +194,7 @@
209 clip: height < handleImage.height194 clip: height < handleImage.height
210195
211 function get_height() {196 function get_height() {
212 return Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0)197 return Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0);
213 }198 }
214199
215 BorderImage {200 BorderImage {
@@ -264,7 +249,6 @@
264 height: indicators.panelHeight249 height: indicators.panelHeight
265 indicatorsModel: indicatorsModel250 indicatorsModel: indicatorsModel
266 state: indicators.state251 state: indicators.state
267 overviewActive: menuContent.overviewActive
268252
269 onCurrentItemIndexChanged: menuContent.currentIndex = currentItemIndex253 onCurrentItemIndexChanged: menuContent.currentIndex = currentItemIndex
270254
@@ -279,9 +263,10 @@
279 onRunningChanged: {263 onRunningChanged: {
280 if (hideAnimation.running) {264 if (hideAnimation.running) {
281 indicators.state = "initial"265 indicators.state = "initial"
282 menuContent.hideAll()
283 } else {266 } else {
284 if (state == "initial") indicatorRow.setDefaultItem()267 if (state == "initial") {
268 indicatorRow.setDefaultItem()
269 }
285 }270 }
286 }271 }
287 }272 }
@@ -289,13 +274,8 @@
289 target: showAnimation274 target: showAnimation
290 onRunningChanged: {275 onRunningChanged: {
291 if (showAnimation.running) {276 if (showAnimation.running) {
292 if (indicators.state == "initial") {277 indicators.calculateCurrentItem(dragHandle.touchX, false);
293 openOverview()278 indicators.state = "commit";
294 } else {
295 indicators.calculateCurrentItem(dragHandle.touchX, false)
296 menuContent.showMenu()
297 }
298 indicators.state = "commit"
299 }279 }
300 }280 }
301 }281 }
@@ -303,8 +283,8 @@
303 Connections {283 Connections {
304 target: dragHandle284 target: dragHandle
305 onTouchXChanged: {285 onTouchXChanged: {
306 var buffer = dragHandle.dragging ? true : false286 var buffer = dragHandle.dragging ? true : false;
307 indicators.calculateCurrentItem(dragHandle.touchX, buffer)287 indicators.calculateCurrentItem(dragHandle.touchX, buffer);
308 }288 }
309 }289 }
310290
@@ -339,8 +319,7 @@
339319
340 onStatusChanged: {320 onStatusChanged: {
341 if (status === DirectionalDragArea.Recognized) {321 if (status === DirectionalDragArea.Recognized) {
342 menuContent.hideAll()322 menuContent.activateContent();
343 menuContent.activateContent()
344 }323 }
345 }324 }
346 }325 }
@@ -368,7 +347,6 @@
368 State {347 State {
369 name: "reveal"348 name: "reveal"
370 extend: "hint"349 extend: "hint"
371 PropertyChanges { target: menuContent; animate: true }
372 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }350 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
373 },351 },
374 State {352 State {
@@ -390,7 +368,6 @@
390 },368 },
391 State {369 State {
392 name: "reveal"370 name: "reveal"
393 PropertyChanges { target: menuContent; animate: true }
394 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }371 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
395 },372 },
396 State {373 State {
397374
=== modified file 'Panel/MenuContent.qml'
--- Panel/MenuContent.qml 2013-07-17 11:03:15 +0000
+++ Panel/MenuContent.qml 2013-07-17 16:45:32 +0000
@@ -17,16 +17,12 @@
17import QtQuick 2.017import QtQuick 2.0
18import Ubuntu.Components 0.118import Ubuntu.Components 0.1
19import Unity.Indicators 0.1 as Indicators19import Unity.Indicators 0.1 as Indicators
20import "Menus"
21import "../Components"20import "../Components"
2221
23Rectangle {22Rectangle {
24 id: content23 id: content
2524
26 property QtObject indicatorsModel: null25 property QtObject indicatorsModel: null
27 property bool animate: true // FIXME: Remove. This doesnt seem to be being used and it's referenced in Indicators.
28 property bool overviewActive: true // "state of the menu"
29 property bool __shown: false
30 property bool __contentActive: false26 property bool __contentActive: false
31 property alias currentIndex : menus.currentIndex27 property alias currentIndex : menus.currentIndex
32 property color backgroundColor: "#221e1c" // FIXME not in palette yet28 property color backgroundColor: "#221e1c" // FIXME not in palette yet
@@ -35,32 +31,17 @@
35 width: units.gu(40)31 width: units.gu(40)
36 height: units.gu(42)32 height: units.gu(42)
37 color: backgroundColor33 color: backgroundColor
38 enabled: __shown
3934
40 signal menuSelected(int index)35 signal menuSelected(int index)
4136
42 function showMenu() {
43 __shown = true
44 overviewActive = false
45 }
46
47 function showOverview() {
48 __shown = true
49 overviewActive = true
50 }
51
52 function hideAll() {
53 __shown = false
54 }
55
56 function activateContent() {37 function activateContent() {
57 contentReleaseTimer.stop()38 contentReleaseTimer.stop();
58 __contentActive = true39 __contentActive = true;
59 }40 }
6041
61 function releaseContent() {42 function releaseContent() {
62 if (__contentActive)43 if (__contentActive)
63 contentReleaseTimer.restart()44 contentReleaseTimer.restart();
64 }45 }
6546
66 ListView {47 ListView {
@@ -72,7 +53,6 @@
72 width: parent.width53 width: parent.width
7354
74 spacing: units.gu(0.5)55 spacing: units.gu(0.5)
75 opacity: !overviewActive && __shown ? 1 : 0
76 enabled: opacity != 056 enabled: opacity != 0
77 orientation: ListView.Horizontal57 orientation: ListView.Horizontal
78 model: indicatorsModel58 model: indicatorsModel
@@ -87,20 +67,19 @@
8767
88 onContentActiveChanged: {68 onContentActiveChanged: {
89 if (contentActive && item) {69 if (contentActive && item) {
90 item.start()70 item.start();
91 } else if (!contentActive && item) {71 } else if (!contentActive && item) {
92 item.stop()72 item.stop();
93 }73 }
94 }74 }
9575
96 width: menus.width76 width: menus.width
97 height: menus.height77 height: menus.height
98 source: pageSource78 source: pageSource
99 visible: content.__shown
100 onVisibleChanged: {79 onVisibleChanged: {
101 // Reset the indicator states80 // Reset the indicator states
102 if (!visible && item && item["reset"]) {81 if (!visible && item && item["reset"]) {
103 item.reset()82 item.reset();
104 }83 }
105 }84 }
106 asynchronous: true85 asynchronous: true
@@ -108,11 +87,11 @@
108 onLoaded: {87 onLoaded: {
109 for(var pName in indicatorProperties) {88 for(var pName in indicatorProperties) {
110 if (item.hasOwnProperty(pName)) {89 if (item.hasOwnProperty(pName)) {
111 item[pName] = indicatorProperties[pName]90 item[pName] = indicatorProperties[pName];
112 }91 }
113 }92 }
114 if (contentActive && menus.visible) {93 if (contentActive && menus.visible) {
115 item.start()94 item.start();
116 }95 }
117 }96 }
11897
@@ -124,40 +103,6 @@
124 value: handle.height103 value: handle.height
125 }104 }
126 }105 }
127
128 Behavior on opacity { NumberAnimation {duration: 200} }
129 }
130
131 Overview {
132 id: overview
133 objectName: "overview"
134
135 anchors.top: header.bottom
136 anchors.bottom: parent.bottom
137 // FIXME: Dont know why we're using handle height (introduces dep).. Check with design about bottom margin
138 anchors.bottomMargin: handle.height
139
140 width: content.width
141 indicatorsModel: content.indicatorsModel
142 enabled: content.overviewActive && content.__shown
143 opacity: content.overviewActive && content.__shown ? 1 : 0
144 Behavior on opacity {NumberAnimation{duration: 200}}
145 visible: opacity != 0
146
147 onMenuSelected: {
148 var storedDuration = menus.highlightMoveDuration
149 var storedVelocity = menus.highlightMoveVelocity
150 menus.highlightMoveDuration = 0
151 menus.highlightMoveVelocity = 100000
152
153 menus.currentIndex = modelIndex
154 content.overviewActive = false
155
156 menus.highlightMoveDuration = storedDuration
157 menus.highlightMoveVelocity = storedVelocity
158
159 content.menuSelected(modelIndex)
160 }
161 }106 }
162107
163 Rectangle {108 Rectangle {
@@ -181,14 +126,10 @@
181 right: parent.right126 right: parent.right
182 }127 }
183 text: {128 text: {
184 if (content.overviewActive)
185 return i18n.tr("Device");
186 if (indicatorsModel && menus.currentIndex >= 0 && menus.currentIndex < indicatorsModel.count)129 if (indicatorsModel && menus.currentIndex >= 0 && menus.currentIndex < indicatorsModel.count)
187 return indicatorsModel.data(menus.currentIndex, Indicators.IndicatorsModelRole.Title);130 return indicatorsModel.data(menus.currentIndex, Indicators.IndicatorsModelRole.Title);
188 return "";131 return "";
189 }132 }
190 opacity: __shown ? 1 : 0
191 Behavior on opacity {NumberAnimation{duration: 100}}
192 }133 }
193 }134 }
194135
195136
=== removed directory 'Panel/Menus'
=== removed file 'Panel/Menus/IndicatorMenuWindow.qml'
--- Panel/Menus/IndicatorMenuWindow.qml 2013-06-05 22:03:08 +0000
+++ Panel/Menus/IndicatorMenuWindow.qml 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19Item {
20 id: menuWindow
21
22 property bool shown: false
23 property int contentHeight: height
24 property string headingText: name
25 property string name
26
27 enabled: shown
28 opacity: shown ? 1.0 : 0.0
29 Behavior on opacity { NumberAnimation {duration: shown ? 300 : 150 } }
30
31 // don't pass any events under this screen
32 MouseArea {
33 anchors.fill: parent
34 }
35}
360
=== removed directory 'Panel/Menus/Overview'
=== removed file 'Panel/Menus/Overview.qml'
--- Panel/Menus/Overview.qml 2013-06-05 22:03:08 +0000
+++ Panel/Menus/Overview.qml 1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../Components/ListItems" as ListItems
20import "Overview"
21
22IndicatorMenuWindow {
23 id: overview
24
25 property QtObject indicatorsModel: null
26
27 signal menuSelected(int modelIndex)
28
29 VisualItemModel {
30 id: itemModel
31
32 FlightModeWidget {
33 anchors {
34 left: parent ? parent.left : undefined
35 right: parent ? parent.right : undefined
36 }
37 height: units.gu(8)
38
39 ListItems.ThinDivider {
40 anchors {
41 bottom: parent.bottom
42 bottomMargin: -units.dp(1)
43 }
44 }
45 }
46
47 VolumeWidget {
48 anchors {
49 left: parent ? parent.left : undefined
50 right: parent ? parent.right : undefined
51 }
52 height: units.gu(10)
53 }
54
55 OverviewGrid {
56 model: indicatorsModel
57 anchors {
58 left: parent ? parent.left : undefined
59 right: parent ? parent.right : undefined
60 }
61 }
62 }
63
64 ListView {
65 id: listView
66 anchors.fill: parent
67 model: itemModel
68 interactive: false
69 }
70}
710
=== removed file 'Panel/Menus/Overview/FlightModeWidget.qml'
--- Panel/Menus/Overview/FlightModeWidget.qml 2013-07-17 10:34:41 +0000
+++ Panel/Menus/Overview/FlightModeWidget.qml 1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20Item {
21 id: flightModeWidget
22
23 Image {
24 id: flightIcon
25 source: "graphics/plane_icon.png"
26 anchors {
27 left: parent.left
28 leftMargin: units.gu(2)
29 verticalCenter: parent.verticalCenter
30 }
31 width: units.gu(4)
32 height: units.gu(4)
33 }
34
35 Label {
36 anchors {
37 left: flightIcon.right
38 right: flightModeSwitch.left
39 margins: units.gu(2)
40 verticalCenter: parent.verticalCenter
41 }
42 text: i18n.tr("Flight mode")
43 color: Theme.palette.selected.backgroundText
44 style: Text.Raised
45 styleColor: "black"
46 opacity: 0.6;
47 fontSize: "medium"
48 elide: Text.ElideRight
49 horizontalAlignment: Text.AlignLeft
50 }
51
52 Switch {
53 id: flightModeSwitch
54 anchors {
55 right: parent.right
56 rightMargin: units.gu(2)
57 verticalCenter: parent.verticalCenter
58 }
59 }
60}
610
=== removed file 'Panel/Menus/Overview/OverviewGrid.qml'
--- Panel/Menus/Overview/OverviewGrid.qml 2013-07-17 11:03:15 +0000
+++ Panel/Menus/Overview/OverviewGrid.qml 1970-01-01 00:00:00 +0000
@@ -1,135 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19
20import "../../../Components/ListItems" as ListItems
21
22Item {
23 id: overviewGrid
24
25 height: childrenRect.height
26
27 property var model
28
29 UbuntuShape {
30 id: gridBackground
31 anchors.fill: grid
32 color: "#282421" // FIXME missing palette
33 radius: "medium"
34 }
35
36 GridView {
37 id: grid
38 objectName: "overviewGrid"
39
40 property int columnCount: 3
41 property int rowCount: Math.ceil(model.count / columnCount)
42
43 anchors {
44 top: parent.top
45 left: parent.left
46 right: parent.right
47 topMargin: units.gu(3)
48 leftMargin: units.gu(2)
49 rightMargin: units.gu(2)
50 }
51 height: cellWidth * rowCount
52 cellWidth: Math.floor((width) / columnCount)
53 cellHeight: cellWidth
54 model: overviewGrid.model
55 visible: opacity != 0
56 interactive: false
57 delegate:
58 AbstractButton {
59 objectName: "overviewGridButton" + index
60 width: grid.cellWidth
61 height: grid.cellHeight
62
63 Loader {
64 id: loader
65 source: widgetSource
66
67 width: units.gu(5)
68 height: units.gu(5)
69 anchors.centerIn: parent
70 anchors.verticalCenterOffset: -units.gu(1)
71
72 onLoaded: {
73 for(var pName in indicatorProperties) {
74 if (item.hasOwnProperty(pName)) {
75 item[pName] = indicatorProperties[pName]
76 }
77 }
78 }
79 }
80
81 Label {
82 text: title
83 color: Theme.palette.selected.backgroundText
84 fontSize: "small"
85 anchors {
86 left: parent.left
87 right: parent.right
88 bottom: parent.bottom
89 leftMargin: units.gu(0.5)
90 rightMargin: units.gu(0.5)
91 bottomMargin: units.gu(1.5)
92 }
93 elide: Text.ElideRight
94 horizontalAlignment: Text.AlignHCenter
95
96 }
97 onClicked: overview.menuSelected(index)
98 }
99 }
100
101 Item {
102 id: gridOverlay
103 anchors.fill: grid
104
105 Column {
106 anchors {
107 left: parent.left
108 right: parent.right
109 }
110 spacing: grid.cellHeight
111 y: grid.cellHeight - units.dp(1)
112 Repeater {
113 model: grid.rowCount - 1
114 ListItems.ThinDivider {
115 anchors.margins: units.dp(1)
116 }
117 }
118 }
119
120 Row {
121 anchors {
122 top: parent.top
123 bottom: parent.bottom
124 }
125 spacing: grid.cellWidth - units.dp(1)
126 x: grid.cellWidth - units.dp(1)
127 Repeater {
128 model: grid.columnCount - 1
129 ListItems.VerticalThinDivider {
130 anchors.margins: units.dp(1)
131 }
132 }
133 }
134 }
135}
1360
=== removed file 'Panel/Menus/Overview/VolumeWidget.qml'
--- Panel/Menus/Overview/VolumeWidget.qml 2013-06-05 22:03:08 +0000
+++ Panel/Menus/Overview/VolumeWidget.qml 1970-01-01 00:00:00 +0000
@@ -1,88 +0,0 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import Ubuntu.Components 0.1
19import "../../../Components/"
20
21Item {
22 id: volumeWidget
23
24 Image {
25 id: minVolumeIcon
26 objectName: "minVolumeIcon"
27 source: "graphics/sound_off_icon.png"
28 anchors {
29 left: parent.left
30 leftMargin: units.gu(2)
31 verticalCenter: parent.verticalCenter
32 }
33 width: units.gu(4)
34 height: units.gu(4)
35
36 MouseArea {
37 anchors.fill: parent
38 onClicked: volumeControl.volumeDown();
39 }
40 }
41
42 Slider {
43 id: slider
44 objectName: "volumeSlider"
45 anchors {
46 left: minVolumeIcon.right
47 right: maxVolumeIcon.left
48 margins: units.gu(1)
49 verticalCenter: parent.verticalCenter
50 }
51 live: false
52 minimumValue: 0
53 maximumValue: 100
54 value: 50
55
56 onValueChanged: {
57 volumeControl.volume = value;
58 }
59
60 Binding {
61 target: slider
62 property: "value"
63 value: volumeControl.volume
64 }
65
66 function formatValue(v) {
67 return ""
68 }
69 }
70
71 Image {
72 id: maxVolumeIcon
73 objectName: "maxVolumeIcon"
74 source: "graphics/sound_on_icon.png"
75 anchors {
76 right: parent.right
77 rightMargin: units.gu(2)
78 verticalCenter: parent.verticalCenter
79 }
80 width: units.gu(4)
81 height: units.gu(4)
82
83 MouseArea {
84 anchors.fill: parent
85 onClicked: volumeControl.volumeUp();
86 }
87 }
88}
890
=== removed directory 'Panel/Menus/Overview/graphics'
=== removed file 'Panel/Menus/Overview/graphics/plane_icon@18.png'
90Binary files Panel/Menus/Overview/graphics/plane_icon@18.png 2013-06-05 22:03:08 +0000 and Panel/Menus/Overview/graphics/plane_icon@18.png 1970-01-01 00:00:00 +0000 differ1Binary files Panel/Menus/Overview/graphics/plane_icon@18.png 2013-06-05 22:03:08 +0000 and Panel/Menus/Overview/graphics/plane_icon@18.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'Panel/Menus/Overview/graphics/sound_off_icon@18.png'
91Binary files Panel/Menus/Overview/graphics/sound_off_icon@18.png 2013-06-05 22:03:08 +0000 and Panel/Menus/Overview/graphics/sound_off_icon@18.png 1970-01-01 00:00:00 +0000 differ2Binary files Panel/Menus/Overview/graphics/sound_off_icon@18.png 2013-06-05 22:03:08 +0000 and Panel/Menus/Overview/graphics/sound_off_icon@18.png 1970-01-01 00:00:00 +0000 differ
=== removed file 'Panel/Menus/Overview/graphics/sound_on_icon@18.png'
92Binary files Panel/Menus/Overview/graphics/sound_on_icon@18.png 2013-06-05 22:03:08 +0000 and Panel/Menus/Overview/graphics/sound_on_icon@18.png 1970-01-01 00:00:00 +0000 differ3Binary files Panel/Menus/Overview/graphics/sound_on_icon@18.png 2013-06-05 22:03:08 +0000 and Panel/Menus/Overview/graphics/sound_on_icon@18.png 1970-01-01 00:00:00 +0000 differ
=== modified file 'tests/qmltests/CMakeLists.txt'
--- tests/qmltests/CMakeLists.txt 2013-07-11 09:09:20 +0000
+++ tests/qmltests/CMakeLists.txt 2013-07-17 16:45:32 +0000
@@ -61,10 +61,8 @@
61add_qml_test(Panel IndicatorRow)61add_qml_test(Panel IndicatorRow)
62add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})62add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
63add_qml_test(Panel MenuContent)63add_qml_test(Panel MenuContent)
64add_qml_test(Panel Overview)
65add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})64add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
66add_qml_test(Panel SearchIndicator)65add_qml_test(Panel SearchIndicator)
67add_qml_test(Panel/Menus IndicatorMenuWindow IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
68add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}66add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
69 ${CMAKE_BINARY_DIR}/tests/mocks67 ${CMAKE_BINARY_DIR}/tests/mocks
70 ${CMAKE_BINARY_DIR}/plugins)68 ${CMAKE_BINARY_DIR}/plugins)
7169
=== removed directory 'tests/qmltests/Panel/Menus'
=== removed file 'tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml'
--- tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml 2013-06-05 22:03:08 +0000
+++ tests/qmltests/Panel/Menus/tst_IndicatorMenuWindow.qml 1970-01-01 00:00:00 +0000
@@ -1,68 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import "../.."
20import "../../../../Panel/Menus"
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
23
24Item {
25 id: testIndicatorMenuWindowItem
26 width: units.gu(9)
27 height: units.gu(3)
28
29 MouseArea {
30 id: mouseArea
31 anchors.fill: parent
32 }
33
34 IndicatorMenuWindow {
35 id: indicatorMenuWindow
36 name: "TestIndicatorMenuWindow"
37 anchors.fill: parent
38 }
39
40 UT.UnityTestCase {
41 name: "IndicatorMenuWindow"
42 when: windowShown
43
44 function test_mouseEvent_data() {
45 return [
46 {tag: "visible", shown: true, opacity: 1.0, mouseClicks: 0},
47 {tag: "invisible", shown: false, opacity: 0.0, mouseClicks: 1},
48 ]
49 }
50
51 function test_mouseEvent(data) {
52 indicatorMenuWindow.shown = data.shown
53 tryCompare(indicatorMenuWindow, "opacity", data.opacity)
54
55 clickedSpy.clear()
56 mouseClick(indicatorMenuWindow, indicatorMenuWindow.width / 2,
57 indicatorMenuWindow.height / 2)
58 compare(clickedSpy.count, data.mouseClicks,
59 "Check for Mouse event eating by indicatorMenuWindow failed")
60 }
61 }
62
63 SignalSpy {
64 id: clickedSpy
65 target: mouseArea
66 signalName: "clicked"
67 }
68}
690
=== modified file 'tests/qmltests/Panel/tst_IndicatorRow.qml'
--- tests/qmltests/Panel/tst_IndicatorRow.qml 2013-07-03 15:39:46 +0000
+++ tests/qmltests/Panel/tst_IndicatorRow.qml 2013-07-17 16:45:32 +0000
@@ -32,7 +32,6 @@
3232
33 function init_test()33 function init_test()
34 {34 {
35 indicatorRow.overviewActive = false;
36 indicatorRow.state = "initial";35 indicatorRow.state = "initial";
37 indicatorRow.currentItem = null;36 indicatorRow.currentItem = null;
38 }37 }
@@ -241,18 +240,5 @@
241 compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in locked state");240 compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in locked state");
242 compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in locked state");241 compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in locked state");
243 }242 }
244
245 function test_active_overview() {
246 init_test();
247
248 indicatorRow.overviewActive = true;
249 indicatorRow.state = "commit";
250
251 compare(get_indicator_item_at(0).dimmed, true, "Indicator should dim when in overview");
252 compare(get_indicator_item_at(1).dimmed, true, "Indicator should dim when in overview");
253 compare(get_indicator_item_at(2).dimmed, true, "Indicator should dim when in overview");
254 compare(get_indicator_item_at(3).dimmed, true, "Indicator should dim when in overview");
255 compare(get_indicator_item_at(4).dimmed, true, "Indicator should dim when in overview");
256 }
257 }243 }
258}244}
259245
=== modified file 'tests/qmltests/Panel/tst_Indicators.qml'
--- tests/qmltests/Panel/tst_Indicators.qml 2013-07-03 16:33:58 +0000
+++ tests/qmltests/Panel/tst_Indicators.qml 2013-07-17 16:45:32 +0000
@@ -69,7 +69,6 @@
6969
70 onClicked: {70 onClicked: {
71 if (!indicators.shown) {71 if (!indicators.shown) {
72 indicators.openOverview();
73 indicators.show();72 indicators.show();
74 } else {73 } else {
75 indicators.hide();74 indicators.hide();
@@ -89,47 +88,10 @@
89 tryCompare(indicators, "state", "initial");88 tryCompare(indicators, "state", "initial");
90 }89 }
9190
92 // Showing the indicators should fully open the indicator panel with the overview menu visible.91 // Showing the indicators should fully open the indicator panel.
93 function test_show() {92 function test_show() {
94 indicators.show()93 indicators.show()
95 tryCompare(indicators, "fullyOpened", true);94 tryCompare(indicators, "fullyOpened", true);
96
97 // A show must open the indicators.
98 compare(findChild(indicators, "indicatorRow").overviewActive, true, "Overview indicator should be active when opened overview.")
99 }
100
101 // Opening the overview menu will activate the overview panel.
102 function test_open_overview() {
103 indicators.openOverview();
104 compare(findChild(indicators, "indicatorRow").overviewActive, true, "Overview should be active when opened overview.")
105 }
106
107 // Showing the indicators, then changing the progress (simulating drag) should keep the overview panel open until
108 // the reveal state is reached.
109 function test_slow_close_open_overview() {
110
111 var indicator_row = findChild(indicators, "indicatorRow");
112 verify(indicator_row != undefined);
113
114 indicators.show()
115 // wait for animation to end. (progress needs to be updated)
116 tryCompare(indicators.showAnimation, "running", false);
117 compare(indicator_row.overviewActive, true, "Overview should be active when opened overview.")
118
119 // iteratively decrease the progress and ensure that it keeps the correct behaviour
120 var current_progress = indicators.progress - shell.height/20;
121 while (current_progress > 0) {
122 indicators.progress = current_progress;
123
124 if (indicators.state == "commit" || indicators.state == "locked") {
125 compare(indicator_row.overviewActive, true, "Overview should be active when in locked or commit state after show.")
126 }
127 else if (indicators.state == "reveal" || indicators.state == "hint") {
128 compare(indicator_row.overviewActive, false, "Overview should be not active when not in commit or locked state.")
129 }
130
131 current_progress = current_progress - shell.height/20;
132 }
133 }95 }
13496
135 // Test the change in the revealer lateral position changes the current panel menu to fit the position97 // Test the change in the revealer lateral position changes the current panel menu to fit the position
13698
=== modified file 'tests/qmltests/Panel/tst_MenuContent.qml'
--- tests/qmltests/Panel/tst_MenuContent.qml 2013-06-17 08:14:24 +0000
+++ tests/qmltests/Panel/tst_MenuContent.qml 2013-07-17 16:45:32 +0000
@@ -52,8 +52,8 @@
52 height: parent.height - 5052 height: parent.height - 50
53 }53 }
5454
55 Item {55 Rectangle {
56 id: click_me56 color: "#bbbbbb"
5757
58 height: 5058 height: 50
59 anchors {59 anchors {
@@ -62,50 +62,16 @@
62 right: parent.right62 right: parent.right
63 }63 }
6464
65 Rectangle {65 Text {
66 color: "#999999"66 text: "Next Indicator"
6767 anchors.fill: parent
68 anchors {68 horizontalAlignment: Text.AlignHCenter
69 top: parent.top69 verticalAlignment: Text.AlignVCenter
70 left: parent.left
71 right: parent.horizontalCenter
72 bottom: parent.bottom
73 }
74
75 Text {
76 text: "Devices"
77 anchors.fill: parent
78 horizontalAlignment: Text.AlignHCenter
79 verticalAlignment: Text.AlignVCenter
80 }
81
82 MouseArea {
83 anchors.fill: parent
84 onClicked: menuContent.showOverview()
85 }
86 }70 }
8771
88 Rectangle {72 MouseArea {
89 color: "#bbbbbb"73 anchors.fill: parent
9074 onClicked: activate_next_content()
91 anchors {
92 top: parent.top
93 left: parent.horizontalCenter
94 right: parent.right
95 bottom: parent.bottom
96 }
97
98 Text {
99 text: "Next Indicator"
100 anchors.fill: parent
101 horizontalAlignment: Text.AlignHCenter
102 verticalAlignment: Text.AlignVCenter
103 }
104
105 MouseArea {
106 anchors.fill: parent
107 onClicked: activate_next_content()
108 }
109 }75 }
110 }76 }
11177
@@ -120,7 +86,6 @@
120 function activate_content(index)86 function activate_content(index)
121 {87 {
122 menuContent.currentIndex = index88 menuContent.currentIndex = index
123 menuContent.showMenu();
124 }89 }
12590
126 function get_test_menu_objecName(index) {91 function get_test_menu_objecName(index) {
@@ -151,7 +116,6 @@
151 when: windowShown116 when: windowShown
152117
153 function init() {118 function init() {
154 menuContent.hideAll();
155 if (menuContent.__contentActive)119 if (menuContent.__contentActive)
156 menuContent.releaseContent();120 menuContent.releaseContent();
157 tryCompare(menuContent, "__contentActive", false);121 tryCompare(menuContent, "__contentActive", false);
@@ -174,40 +138,6 @@
174 compare(menus.currentIndex, menu_index, "Current menu index does not match selected menu index");138 compare(menus.currentIndex, menu_index, "Current menu index does not match selected menu index");
175 tryCompareFunction(current_menu_equals_test_menu, true);139 tryCompareFunction(current_menu_equals_test_menu, true);
176 }140 }
177 // overview should not be visible.
178 tryCompare(findChild(menuContent, "overview"), "visible", false);
179 }
180
181 function test_show_overview() {
182 menuContent.showOverview();
183
184 var overview = findChild(menuContent, "overview");
185 tryCompare(overview, "visible", true);
186 tryCompare(overview, "enabled", true);
187 tryCompare(overview, "opacity", 1.0);
188
189 // menus should not be enabled.
190 tryCompare(findChild(menuContent, "menus"), "opacity", 0);
191 tryCompare(findChild(menuContent, "menus"), "enabled", false);
192 }
193
194 function test_overview_menuSelected_signal() {
195 menuContent.showOverview();
196
197 var overview = findChild(menuContent, "overview");
198 var menus = menu_content_test.findChild(menuContent, "menus")
199
200 var menu_count = indicatorsModel.count;
201 verify(menu_count > 0, "Menu count should be greater than zero");
202 for (var i = 0; i < menu_count; i++) {
203 // manually emit signal from overview.
204 // we dont want to go with mouse events here, otherwise we're testing the overview and not the signal.
205 overview.menuSelected(i);
206
207 test_menu_objectName = get_test_menu_objecName(i);
208 compare(menus.currentIndex, i, "Current menu index does not match selected menu index");
209 tryCompareFunction(current_menu_equals_test_menu, true);
210 }
211 }141 }
212142
213 // Calling activateContent should call start on all menus143 // Calling activateContent should call start on all menus
214144
=== removed file 'tests/qmltests/Panel/tst_Overview.qml'
--- tests/qmltests/Panel/tst_Overview.qml 2013-06-18 18:02:29 +0000
+++ tests/qmltests/Panel/tst_Overview.qml 1970-01-01 00:00:00 +0000
@@ -1,142 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18import QtTest 1.0
19import ".."
20import "../../../Panel/Menus"
21import "../../../Components"
22import Unity.Test 0.1 as UT
23import Unity.Indicators 0.1 as Indicators
24
25Rectangle {
26 id: shell
27 width: units.gu(40)
28 height: units.gu(80)
29 color: "black"
30
31 Overview {
32 id: overview
33 anchors.fill: parent
34 indicatorsModel: mockModel
35 shown: true
36 }
37
38 Item {
39 id: volumeControl
40 property int volume
41 function volumeUp() {
42 volume = Math.min(100, volume + 10);
43 }
44 function volumeDown() {
45 volume = Math.max(0, volume - 10);
46 }
47 }
48
49 ListModel {
50 id: mockModel
51 ListElement {title: "fake1"; widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget1.qml"; indicatorProperties: ""}
52 ListElement {title: "fake2"; widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget2.qml"; indicatorProperties: ""}
53 ListElement {title: "fake3"; widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget3.qml"; indicatorProperties: ""}
54 }
55
56 ListModel {
57 id: mockModel2
58 }
59
60 SignalSpy {
61 id: clickSpy
62 target: overview
63 signalName: "menuSelected"
64 }
65
66 UT.UnityTestCase {
67 name: "Overview"
68 when: windowShown
69
70 function initTestCase() {
71 // Spin the event loop once because the UI builds up delayed
72 wait(0);
73 }
74
75 function test_menuSelected() {
76 overview.indicatorsModel = mockModel;
77
78 for (var i = 0; i < mockModel.count; ++i) {
79 var button = findChild(overview, "overviewGridButton" + i);
80 clickSpy.clear();
81 mouseClick(button, button.width / 2, button.height / 2);
82 compare(clickSpy.count, 1, "Clicking on grid didn't work");
83 compare(clickSpy.signalArguments[0][0], i, "Clicking the grid returned a wrong index");
84 }
85 }
86
87 function test_dynamic_addition() {
88 var overviewGrid = findChild(overview, "overviewGrid");
89
90 for(var i = 0; i < mockModel.count; ++i) {
91 mockModel2.append(mockModel.get(i));
92 }
93 overview.indicatorsModel = mockModel2;
94 overviewGrid.forceLayout();
95 waitForRendering(overviewGrid);
96
97 var button = findChild(overview, "overviewGridButton2");
98 verify(button !== undefined, "button2 wasn't found");
99 button = findChild(overview, "overviewGridButton3");
100 compare(button, undefined, "There should only be 3 buttons... found at least 4...");
101
102 mockModel2.append({title: "humppa", widgetSource: "qrc:/tests/indciators/qml/fake_menu_widget4.qml", indicatorProperties: ""})
103 overviewGrid.forceLayout();
104 waitForRendering(overviewGrid);
105
106 button = findChild(overview, "overviewGridButton3");
107 verify(button !== undefined, "button3 wasn't found");
108 }
109
110 function test_volume_slider_data() {
111 return [
112 {tag: "0%", sliderPos:0},
113 {tag: "100%", sliderPos: 100},
114 {tag: "50%", sliderPos: 50}
115 ];
116 }
117
118 function test_volume_slider(data) {
119 var volumeSlider = findChild(overview, "volumeSlider");
120 var startX = volumeSlider.width * volumeSlider.value / 100;
121 var startY = volumeSlider.y + volumeSlider.height / 2;
122 var stopX = (volumeSlider.width - units.gu(5)) * data.sliderPos / 100;
123 var stopY = volumeSlider.y + volumeSlider.height / 2;
124 mouseFlick(volumeSlider, startX, startY, stopX, stopY, true, true, 0.1);
125 }
126
127 function test_volume_buttons(data) {
128 var volumeDownButton = findChild(overview, "minVolumeIcon");
129 var volumeUpButton = findChild(overview, "maxVolumeIcon");
130
131 for (var i = 0; i < 10; ++i) {
132 mouseClick(volumeDownButton, volumeDownButton.width / 2, volumeDownButton.height / 2);
133 wait(0)
134 }
135 tryCompare(volumeControl, "volume", 0);
136 for (var i = 0; i < 10; ++i) {
137 mouseClick(volumeUpButton, 1, 1);
138 wait(0)
139 }
140 }
141 }
142}
1430
=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
--- tests/qmltests/Panel/tst_Panel.qml 2013-07-03 16:33:58 +0000
+++ tests/qmltests/Panel/tst_Panel.qml 2013-07-17 16:45:32 +0000
@@ -62,14 +62,14 @@
6262
63 function get_indicator_item(index) {63 function get_indicator_item(index) {
64 var row_repeater = findChild(panel.indicators, "rowRepeater");64 var row_repeater = findChild(panel.indicators, "rowRepeater");
65 verify(row_repeater != undefined)65 verify(row_repeater != undefined);
66 return row_repeater.itemAt(index);66 return row_repeater.itemAt(index);
67 }67 }
6868
69 function get_indicator_item_position(index) {69 function get_indicator_item_position(index) {
7070
71 var indicator_row = findChild(panel.indicators, "indicatorRow");71 var indicator_row = findChild(panel.indicators, "indicatorRow");
72 verify(indicator_row != undefined)72 verify(indicator_row != undefined);
7373
74 var indicator_item = get_indicator_item(index);74 var indicator_item = get_indicator_item(index);
75 verify(indicator_item != undefined);75 verify(indicator_item != undefined);
@@ -83,11 +83,11 @@
83 panel.fullscreenMode = false;83 panel.fullscreenMode = false;
84 // Wait for the indicators to get into position.84 // Wait for the indicators to get into position.
85 // (switches between normal and fullscreen modes are animated)85 // (switches between normal and fullscreen modes are animated)
86 tryCompare(panel.indicators, "y", 0)86 tryCompare(panel.indicators, "y", 0);
8787
88 var indicator_item_coord = get_indicator_item_position(0);88 var indicator_item_coord = get_indicator_item_position(0);
8989
90 touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)90 touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
9191
92 // hint animation should be run, meaning that indicators will move downwards92 // hint animation should be run, meaning that indicators will move downwards
93 // by hintValue pixels without any drag taking place93 // by hintValue pixels without any drag taking place
@@ -96,7 +96,7 @@
96 tryCompare(panel.indicators, "partiallyOpened", true);96 tryCompare(panel.indicators, "partiallyOpened", true);
97 tryCompare(panel.indicators, "fullyOpened", false);97 tryCompare(panel.indicators, "fullyOpened", false);
9898
99 touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)99 touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
100 }100 }
101101
102 // Pressing on the top edge of the screen should have no effect if the panel102 // Pressing on the top edge of the screen should have no effect if the panel
@@ -105,31 +105,31 @@
105 panel.fullscreenMode = true;105 panel.fullscreenMode = true;
106 // Wait for the indicators to get into position.106 // Wait for the indicators to get into position.
107 // (switches between normal and fullscreen modes are animated)107 // (switches between normal and fullscreen modes are animated)
108 tryCompare(panel.indicators, "y", -panel.panelHeight)108 tryCompare(panel.indicators, "y", -panel.panelHeight);
109109
110 var indicator_item_coord = get_indicator_item_position(0);110 var indicator_item_coord = get_indicator_item_position(0);
111111
112 touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)112 touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
113113
114 // Give some time for a hint animation to change things, if any114 // Give some time for a hint animation to change things, if any
115 wait(500)115 wait(500);
116116
117 // no hint animation when fullscreen117 // no hint animation when fullscreen
118 compare(panel.indicators.y, -panel.panelHeight)118 compare(panel.indicators.y, -panel.panelHeight);
119 var indicatorRow = findChild(panel.indicators, "indicatorRow");119 var indicatorRow = findChild(panel.indicators, "indicatorRow");
120 verify(indicatorRow != undefined)120 verify(indicatorRow != undefined);
121 compare(indicatorRow.y, 0)121 compare(indicatorRow.y, 0);
122 compare(panel.indicators.height, panel.indicators.panelHeight)122 compare(panel.indicators.height, panel.indicators.panelHeight);
123 compare(panel.indicators.partiallyOpened, false,123 compare(panel.indicators.partiallyOpened, false,
124 "Indicator should not be partially opened when panel is pressed in" +124 "Indicator should not be partially opened when panel is pressed in" +
125 " fullscreenmode")125 " fullscreenmode");
126 compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +126 compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
127 " opened when panel is pressed in fullscreenmode")127 " opened when panel is pressed in fullscreenmode");
128128
129 touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)129 touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
130 }130 }
131131
132 function test_drag_show_data() { return get_window_data() }132 function test_drag_show_data() { return get_window_data(); }
133133
134 // Dragging from a indicator item in the panel will gradually expose the134 // Dragging from a indicator item in the panel will gradually expose the
135 // indicators, first by running the hint animation, then after dragging down will135 // indicators, first by running the hint animation, then after dragging down will
@@ -138,50 +138,50 @@
138 panel.fullscreenMode = data.fullscreenFlag;138 panel.fullscreenMode = data.fullscreenFlag;
139139
140 var indicator_row = findChild(panel.indicators, "indicatorRow");140 var indicator_row = findChild(panel.indicators, "indicatorRow");
141 verify(indicator_row != undefined)141 verify(indicator_row != undefined);
142142
143 var row_repeater = findChild(panel.indicators, "rowRepeater");143 var row_repeater = findChild(panel.indicators, "rowRepeater");
144 verify(indicator_row != undefined)144 verify(indicator_row != undefined);
145145
146 var menu_content = findChild(panel.indicators, "menuContent");146 var menu_content = findChild(panel.indicators, "menuContent");
147 verify(indicator_row != undefined)147 verify(indicator_row != undefined);
148148
149 // Wait for the indicators to get into position.149 // Wait for the indicators to get into position.
150 // (switches between normal and fullscreen modes are animated)150 // (switches between normal and fullscreen modes are animated)
151 if (data.fullscreenFlag) {151 if (data.fullscreenFlag) {
152 tryCompare(panel.indicators, "y", -panel.panelHeight)152 tryCompare(panel.indicators, "y", -panel.panelHeight);
153 } else {153 } else {
154 tryCompare(panel.indicators, "y", 0)154 tryCompare(panel.indicators, "y", 0);
155 }155 }
156156
157 // do this for each indicator item157 // do this for each indicator item
158 for (var i = 0; i < row_repeater.count; i++) {158 for (var i = 0; i < row_repeater.count; i++) {
159159
160 var indicator_item = get_indicator_item(i);160 var indicator_item = get_indicator_item(i);
161 verify(indicator_item != undefined)161 verify(indicator_item != undefined);
162162
163 var indicator_item_coord = get_indicator_item_position(i);163 var indicator_item_coord = get_indicator_item_position(i);
164164
165 touchPress(panel,165 touchPress(panel,
166 indicator_item_coord.x, panel.panelHeight / 2)166 indicator_item_coord.x, panel.panelHeight / 2);
167167
168 // 1) Drag the mouse down168 // 1) Drag the mouse down
169 touchFlick(panel,169 touchFlick(panel,
170 indicator_item_coord.x, panel.panelHeight / 2,170 indicator_item_coord.x, panel.panelHeight / 2,
171 indicator_item_coord.x, panel.height * 0.8,171 indicator_item_coord.x, panel.height * 0.8,
172 false /* beginTouch */, false /* endTouch */)172 false /* beginTouch */, false /* endTouch */);
173173
174 // Indicators height should follow the drag, and therefore increase accordingly.174 // Indicators height should follow the drag, and therefore increase accordingly.
175 // They should be at least half-way through the screen175 // They should be at least half-way through the screen
176 tryCompareFunction(176 tryCompareFunction(
177 function() {return panel.indicators.height >= panel.height * 0.5},177 function() {return panel.indicators.height >= panel.height * 0.5},
178 true)178 true);
179179
180 touchRelease(panel, indicator_item_coord.x, panel.height * 0.8)180 touchRelease(panel, indicator_item_coord.x, panel.height * 0.8);
181181
182 compare(indicator_row.currentItem, indicator_item,182 compare(indicator_row.currentItem, indicator_item,
183 "Incorrect item activated at position " + i)183 "Incorrect item activated at position " + i);
184 compare(menu_content.__shown, true, "Menu conetent should be enabled for item at position " + i);184 compare(menu_content.currentIndex, i, "Menu conetent should be enabled for item at position " + i);
185185
186 // init for next indicator_item186 // init for next indicator_item
187 init();187 init();
@@ -195,23 +195,23 @@
195 var search_indicator = findChild(panel, "search");195 var search_indicator = findChild(panel, "search");
196 verify(search_indicator != undefined);196 verify(search_indicator != undefined);
197197
198 tap(search_indicator, 1, 1)198 tap(search_indicator, 1, 1);
199199
200 compare(search_clicked, true,200 compare(search_clicked, true,
201 "Tapping search indicator while it was enabled did not emit searchClicked signal")201 "Tapping search indicator while it was enabled did not emit searchClicked signal");
202 }202 }
203203
204 function test_search_click_when_not_visible() {204 function test_search_click_when_not_visible() {
205 panel.fullscreenMode = false;205 panel.fullscreenMode = false;
206 panel.searchVisible = false206 panel.searchVisible = false;
207207
208 var search_indicator = findChild(panel, "search");208 var search_indicator = findChild(panel, "search");
209 verify(search_indicator != undefined);209 verify(search_indicator != undefined);
210210
211 tap(search_indicator, 1, 1)211 tap(search_indicator, 1, 1);
212212
213 compare(search_clicked, false,213 compare(search_clicked, false,
214 "Tapping search indicator while it was not visible emitted searchClicked signal")214 "Tapping search indicator while it was not visible emitted searchClicked signal");
215 }215 }
216 }216 }
217}217}

Subscribers

People subscribed via source and target branches