@@ -17,6 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20+import Ubuntu.Components 0.1 as UC
20import Ubuntu.Telephony 0.1 as Telephony
21import Ubuntu.Telephony 0.1 as Telephony
21import ".."
22import ".."
22import "../../../qml/Panel"
23import "../../../qml/Panel"
@@ -40,13 +41,81 @@ Item {
43− anchors.fill: parent
44+ anchors {
48+ height: parent.height - row.height
44 fullscreenMode: false
49 fullscreenMode: false
46 indicators {
51 indicators {
47 profile: "test1"
52 profile: "test1"
48 panelHeight: units.gu(5)
53 panelHeight: units.gu(5)
59+ onSearchClicked: console.log("Search Clicked")
61+ property real panelAndSeparatorHeight: panel.indicators.panelHeight + units.dp(2)
75+ text: panel.indicators.shown ? "Hide" : "Show"
78+ bottom: parent.bottom
80+ width: parent.width/3
83+ if (panel.indicators.shown) {
84+ panel.indicators.hide();
86+ panel.indicators.show();
92+ text: panel.fullscreenMode ? "Maximize" : "FullScreen"
95+ bottom: parent.bottom
97+ width: parent.width/3
99+ onClicked: panel.fullscreenMode = !panel.fullscreenMode
103+ text: callManager.hasCalls ? "Called" : "No Calls"
106+ bottom: parent.bottom
108+ width: parent.width/3
111+ if (callManager.hasCalls) {
112+ callManager.foregroundCall = null;
113+ callManager.backgroundCall = null;
115+ callManager.foregroundCall = phoneCall;
52 Telephony.CallEntry {
121 Telephony.CallEntry {
@@ -60,12 +129,18 @@ Item {
61 function init() {
130 function init() {
62 panel.indicators.initialise();
131 panel.indicators.initialise();
132+ panel.fullscreenMode = false;
64 searchClicked = false;
134 searchClicked = false;
65 panel.indicators.hide();
135 panel.indicators.hide();
136+ // Wait for animation to complete
66 tryCompare(panel.indicators.hideAnimation, "running", false);
137 tryCompare(panel.indicators.hideAnimation, "running", false);
67− tryCompare(panel.indicators, "state", "initial");
68 callManager.foregroundCall = null;
138 callManager.foregroundCall = null;
140+ // Wait for the indicators to get into position.
141+ // (switches between normal and fullscreen modes are animated)
142+ var indicatorArea = findChild(panel, "indicatorArea");
143+ tryCompare(indicatorArea, "y", 0);
71 function get_indicator_item(index) {
146 function get_indicator_item(index) {
@@ -88,27 +163,22 @@ Item {
88 // Pressing on the indicator panel should activate the indicator hints
163 // Pressing on the indicator panel should activate the indicator hints
89 // and expose a portion of the conent.
164 // and expose a portion of the conent.
90 function test_hint() {
165 function test_hint() {
91− panel.fullscreenMode = false;
92− // Wait for the indicators to get into position.
93− // (switches between normal and fullscreen modes are animated)
94− tryCompare(panel.indicators, "y", 0);
96 var indicatorItemCoord = get_indicator_item_position(0);
166 var indicatorItemCoord = get_indicator_item_position(0);
98− touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
168+ touchPress(panel, indicatorItemCoord.x, panel.indicators.panelHeight / 2);
100 // hint animation should be run, meaning that indicators will move downwards
170 // hint animation should be run, meaning that indicators will move downwards
101 // by hintValue pixels without any drag taking place
171 // by hintValue pixels without any drag taking place
102− tryCompare(panel.indicators, "height",
172+ tryCompareFunction2(function() { return panel.indicators.height },
103− panel.indicators.panelHeight + panel.indicators.hintValue);
173+ function() { return panel.indicators.panelHeight + panel.indicators.hintValue });
104 tryCompare(panel.indicators, "partiallyOpened", true);
174 tryCompare(panel.indicators, "partiallyOpened", true);
105 tryCompare(panel.indicators, "fullyOpened", false);
175 tryCompare(panel.indicators, "fullyOpened", false);
107− touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
177+ touchRelease(panel, indicatorItemCoord.x, panel.indicators.panelHeight/2);
110 // Pressing on the top edge of the screen should have no effect if the panel
180 // Pressing on the top edge of the screen should have no effect if the panel
111− // is hidden (!pinned), which is the case when a fullscreen app is being shown
181+ // is hidden (fullscreen), which is the case when a fullscreen app is being shown
112 function test_noHintOnFullscreenMode() {
182 function test_noHintOnFullscreenMode() {
113 panel.fullscreenMode = true;
183 panel.fullscreenMode = true;
114 // Wait for the indicators to get into position.
184 // Wait for the indicators to get into position.
@@ -118,17 +188,38 @@ Item {
119 var indicatorItemCoord = get_indicator_item_position(0);
189 var indicatorItemCoord = get_indicator_item_position(0);
121− touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
191+ touchPress(panel, indicatorItemCoord.x, panel.indicators.panelHeight / 2);
193+ // Give some time for a hint animation to change things, if any
196+ // no hint animation when fullscreen
197+ compare(panel.indicators.partiallyOpened, false,
198+ "Indicator should not be partially opened when panel is pressed in" +
200+ compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
201+ " opened when panel is pressed in fullscreenmode");
203+ touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
206+ // Pressing on the top edge of the indicator should have no effect if the panel
207+ // has an active call
208+ function test_noHintOnActiveCall() {
209+ callManager.foregroundCall = phoneCall;
210+ // Wait for the indicators to get into position.
211+ // (switches between normal and fullscreen modes are animated)
212+ var indicatorArea = findChild(panel, "indicatorArea");
213+ tryCompare(indicatorArea, "y", panel.callHint.height);
215+ var indicatorItemCoord = get_indicator_item_position(0);
217+ touchPress(panel, indicatorItemCoord.x, panel.callHint.height + panel.indicators.panelHeight / 2);
123 // Give some time for a hint animation to change things, if any
219 // Give some time for a hint animation to change things, if any
124 wait(500);
220 wait(500);
126 // no hint animation when fullscreen
222 // no hint animation when fullscreen
127− compare(indicatorArea.y, -panel.panelHeight);
128− var indicatorRow = findChild(panel.indicators, "indicatorRow");
129− verify(indicatorRow !== null);
130− compare(indicatorRow.y, 0);
131− compare(panel.indicators.height, panel.indicators.panelHeight);
132 compare(panel.indicators.partiallyOpened, false,
223 compare(panel.indicators.partiallyOpened, false,
133 "Indicator should not be partially opened when panel is pressed in" +
224 "Indicator should not be partially opened when panel is pressed in" +
134 " fullscreenmode");
225 " fullscreenmode");
@@ -143,15 +234,15 @@ Item {
143 { tag: "pinned", fullscreenFlag: false, alreadyOpen: false, call: null,
234 { tag: "pinned", fullscreenFlag: false, alreadyOpen: false, call: null,
144 indicatorY: function() { return 0 } },
235 indicatorY: function() { return 0 } },
145 { tag: "fullscreen", fullscreenFlag: true, alreadyOpen: false, call: null,
236 { tag: "fullscreen", fullscreenFlag: true, alreadyOpen: false, call: null,
146− indicatorY: function() {return -panel.panelHeight } },
237+ indicatorY: function() {return -panel.panelAndSeparatorHeight } },
147 { tag: "pinned-alreadyOpen", fullscreenFlag: false, alreadyOpen: true, call: null,
238 { tag: "pinned-alreadyOpen", fullscreenFlag: false, alreadyOpen: true, call: null,
148 indicatorY: function() { return 0 } },
239 indicatorY: function() { return 0 } },
149 { tag: "fullscreen-alreadyOpen", fullscreenFlag: true, alreadyOpen: true, call: null,
240 { tag: "fullscreen-alreadyOpen", fullscreenFlag: true, alreadyOpen: true, call: null,
150− indicatorY: function() {return -panel.panelHeight } },
241+ indicatorY: function() {return -panel.panelAndSeparatorHeight } },
151 { tag: "pinned-callActive", fullscreenFlag: false, alreadyOpen: false, call: phoneCall,
242 { tag: "pinned-callActive", fullscreenFlag: false, alreadyOpen: false, call: phoneCall,
152− indicatorY: function() { return units.gu(3) } },
243+ indicatorY: function() { return panel.callHint.height } },
153 { tag: "fullscreen-callActive", fullscreenFlag: true, alreadyOpen: false, call: phoneCall,
244 { tag: "fullscreen-callActive", fullscreenFlag: true, alreadyOpen: false, call: phoneCall,
154− indicatorY: function() {return units.gu(3) - (panel.panelHeight - units.gu(3)) } }
245+ indicatorY: function() { return panel.callHint.height - panel.panelAndSeparatorHeight } }
@@ -160,7 +251,6 @@ Item {
160 // expose more of the panel, binding it to the selected indicator and opening it's menu.
251 // expose more of the panel, binding it to the selected indicator and opening it's menu.
161 function test_drag_show(data) {
252 function test_drag_show(data) {
162 panel.fullscreenMode = data.fullscreenFlag;
253 panel.fullscreenMode = data.fullscreenFlag;
164 callManager.foregroundCall = data.call;
254 callManager.foregroundCall = data.call;
166 if (data.alreadyOpen) {
256 if (data.alreadyOpen) {
@@ -179,7 +269,7 @@ Item {
180 // Wait for the indicators to get into position.
270 // Wait for the indicators to get into position.
181 // (switches between normal and fullscreen modes are animated)
271 // (switches between normal and fullscreen modes are animated)
182− tryCompare(indicatorArea, "y", data.indicatorY());
272+ tryCompareFunction2(function() { return indicatorArea.y } , data.indicatorY);
184 // do this for each indicator item
274 // do this for each indicator item
185 for (var i = 0; i < indicatorRow.row.count; i++) {
275 for (var i = 0; i < indicatorRow.row.count; i++) {
@@ -193,11 +283,11 @@ Item {
193 var indicatorItemCoord = get_indicator_item_position(i);
283 var indicatorItemCoord = get_indicator_item_position(i);
195 touchPress(panel,
285 touchPress(panel,
196− indicatorItemCoord.x, panel.panelHeight / 2);
286+ indicatorItemCoord.x, panel.indicators.panelHeight / 2);
198 // 1) Drag the mouse down
288 // 1) Drag the mouse down
199 touchFlick(panel,
289 touchFlick(panel,
200− indicatorItemCoord.x, panel.panelHeight / 2,
290+ indicatorItemCoord.x, panel.indicators.panelHeight / 2,
201 indicatorItemCoord.x, panel.height,
291 indicatorItemCoord.x, panel.height,
202 false /* beginTouch */, false /* endTouch */);
292 false /* beginTouch */, false /* endTouch */);
@@ -266,19 +356,19 @@ Item {
266 var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.row.count - 1);
356 var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.row.count - 1);
268 touchPress(panel,
358 touchPress(panel,
269− indicatorItemCoordFirst.x, panel.panelHeight / 2);
359+ indicatorItemCoordFirst.x, panel.indicators.panelHeight / 2);
271 // 1) Drag the mouse down to hint a bit
361 // 1) Drag the mouse down to hint a bit
272 touchFlick(panel,
362 touchFlick(panel,
273− indicatorItemCoordFirst.x, panel.panelHeight / 2,
363+ indicatorItemCoordFirst.x, panel.indicators.panelHeight / 2,
274− indicatorItemCoordFirst.x, panel.panelHeight * 2,
364+ indicatorItemCoordFirst.x, panel.indicators.panelHeight * 2,
275 false /* beginTouch */, false /* endTouch */);
365 false /* beginTouch */, false /* endTouch */);
277 tryCompare(indicatorRow, "currentItem", indicatorItemFirst)
367 tryCompare(indicatorRow, "currentItem", indicatorItemFirst)
279 // 1) Flick mouse down to bottom
369 // 1) Flick mouse down to bottom
280 touchFlick(panel,
370 touchFlick(panel,
281− indicatorItemCoordFirst.x, panel.panelHeight * 2,
371+ indicatorItemCoordFirst.x, panel.indicators.panelHeight * 2,
282 indicatorItemCoordNext.x, panel.height,
372 indicatorItemCoordNext.x, panel.height,
283 false /* beginTouch */, true /* endTouch */,
373 false /* beginTouch */, true /* endTouch */,
284 units.gu(10) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity
374 units.gu(10) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity