@@ -17,6 +17,7 @@
1717import QtQuick 2.0
1818import QtTest 1.0
1919import Unity.Test 0.1 as UT
20+import Ubuntu.Components 0.1 as UC
2021import Ubuntu.Telephony 0.1 as Telephony
2122import ".."
2223import "../../../qml/Panel"
@@ -40,13 +41,81 @@ Item {
4041
4142 Panel {
4243 id: panel
43− anchors.fill: parent
44+ anchors {
45+ left: parent.left
46+ right: parent.right
47+ }
48+ height: parent.height - row.height
4449 fullscreenMode: false
4550
4651 indicators {
4752 profile: "test1"
4853 panelHeight: units.gu(5)
4954 }
55+ callHint {
56+ height: units.gu(4)
57+ }
58+
59+ onSearchClicked: console.log("Search Clicked")
60+
61+ property real panelAndSeparatorHeight: panel.indicators.panelHeight + units.dp(2)
62+ }
63+
64+
65+ Row {
66+ id: row
67+ anchors {
68+ bottom: shell.bottom
69+ left: parent.left
70+ right: parent.right
71+ }
72+ height: 50
73+
74+ UC.Button {
75+ text: panel.indicators.shown ? "Hide" : "Show"
76+ anchors {
77+ top: parent.top
78+ bottom: parent.bottom
79+ }
80+ width: parent.width/3
81+
82+ onClicked: {
83+ if (panel.indicators.shown) {
84+ panel.indicators.hide();
85+ } else {
86+ panel.indicators.show();
87+ }
88+ }
89+ }
90+
91+ UC.Button {
92+ text: panel.fullscreenMode ? "Maximize" : "FullScreen"
93+ anchors {
94+ top: parent.top
95+ bottom: parent.bottom
96+ }
97+ width: parent.width/3
98+
99+ onClicked: panel.fullscreenMode = !panel.fullscreenMode
100+ }
101+
102+ UC.Button {
103+ text: callManager.hasCalls ? "Called" : "No Calls"
104+ anchors {
105+ top: parent.top
106+ bottom: parent.bottom
107+ }
108+ width: parent.width/3
109+
110+ onClicked: {
111+ if (callManager.hasCalls) {
112+ callManager.foregroundCall = null;
113+ callManager.backgroundCall = null;
114+ } else {
115+ callManager.foregroundCall = phoneCall;
116+ }
117+ }
118+ }
50119 }
51120
52121 Telephony.CallEntry {
@@ -60,12 +129,18 @@ Item {
60129
61130 function init() {
62131 panel.indicators.initialise();
132+ panel.fullscreenMode = false;
63133
64134 searchClicked = false;
65135 panel.indicators.hide();
136+ // Wait for animation to complete
66137 tryCompare(panel.indicators.hideAnimation, "running", false);
67− tryCompare(panel.indicators, "state", "initial");
68138 callManager.foregroundCall = null;
139+
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);
69144 }
70145
71146 function get_indicator_item(index) {
@@ -88,27 +163,22 @@ Item {
88163 // Pressing on the indicator panel should activate the indicator hints
89164 // and expose a portion of the conent.
90165 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);
95−
96166 var indicatorItemCoord = get_indicator_item_position(0);
97167
98− touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
168+ touchPress(panel, indicatorItemCoord.x, panel.indicators.panelHeight / 2);
99169
100170 // hint animation should be run, meaning that indicators will move downwards
101171 // by hintValue pixels without any drag taking place
102− tryCompare(panel.indicators, "height",
103− panel.indicators.panelHeight + panel.indicators.hintValue);
172+ tryCompareFunction2(function() { return panel.indicators.height },
173+ function() { return panel.indicators.panelHeight + panel.indicators.hintValue });
104174 tryCompare(panel.indicators, "partiallyOpened", true);
105175 tryCompare(panel.indicators, "fullyOpened", false);
106176
107− touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
177+ touchRelease(panel, indicatorItemCoord.x, panel.indicators.panelHeight/2);
108178 }
109179
110180 // 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
112182 function test_noHintOnFullscreenMode() {
113183 panel.fullscreenMode = true;
114184 // Wait for the indicators to get into position.
@@ -118,17 +188,38 @@ Item {
118188
119189 var indicatorItemCoord = get_indicator_item_position(0);
120190
121− touchPress(panel, indicatorItemCoord.x, panel.panelHeight / 2);
191+ touchPress(panel, indicatorItemCoord.x, panel.indicators.panelHeight / 2);
192+
193+ // Give some time for a hint animation to change things, if any
194+ wait(500);
195+
196+ // no hint animation when fullscreen
197+ compare(panel.indicators.partiallyOpened, false,
198+ "Indicator should not be partially opened when panel is pressed in" +
199+ " fullscreenmode");
200+ compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
201+ " opened when panel is pressed in fullscreenmode");
202+
203+ touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
204+ }
205+
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);
214+
215+ var indicatorItemCoord = get_indicator_item_position(0);
216+
217+ touchPress(panel, indicatorItemCoord.x, panel.callHint.height + panel.indicators.panelHeight / 2);
122218
123219 // Give some time for a hint animation to change things, if any
124220 wait(500);
125221
126222 // 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);
132223 compare(panel.indicators.partiallyOpened, false,
133224 "Indicator should not be partially opened when panel is pressed in" +
134225 " fullscreenmode");
@@ -143,15 +234,15 @@ Item {
143234 { tag: "pinned", fullscreenFlag: false, alreadyOpen: false, call: null,
144235 indicatorY: function() { return 0 } },
145236 { tag: "fullscreen", fullscreenFlag: true, alreadyOpen: false, call: null,
146− indicatorY: function() {return -panel.panelHeight } },
237+ indicatorY: function() {return -panel.panelAndSeparatorHeight } },
147238 { tag: "pinned-alreadyOpen", fullscreenFlag: false, alreadyOpen: true, call: null,
148239 indicatorY: function() { return 0 } },
149240 { tag: "fullscreen-alreadyOpen", fullscreenFlag: true, alreadyOpen: true, call: null,
150− indicatorY: function() {return -panel.panelHeight } },
241+ indicatorY: function() {return -panel.panelAndSeparatorHeight } },
151242 { tag: "pinned-callActive", fullscreenFlag: false, alreadyOpen: false, call: phoneCall,
152− indicatorY: function() { return units.gu(3) } },
243+ indicatorY: function() { return panel.callHint.height } },
153244 { 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 } }
155246 ];
156247 }
157248
@@ -160,7 +251,6 @@ Item {
160251 // expose more of the panel, binding it to the selected indicator and opening it's menu.
161252 function test_drag_show(data) {
162253 panel.fullscreenMode = data.fullscreenFlag;
163−
164254 callManager.foregroundCall = data.call;
165255
166256 if (data.alreadyOpen) {
@@ -179,7 +269,7 @@ Item {
179269
180270 // Wait for the indicators to get into position.
181271 // (switches between normal and fullscreen modes are animated)
182− tryCompare(indicatorArea, "y", data.indicatorY());
272+ tryCompareFunction2(function() { return indicatorArea.y } , data.indicatorY);
183273
184274 // do this for each indicator item
185275 for (var i = 0; i < indicatorRow.row.count; i++) {
@@ -193,11 +283,11 @@ Item {
193283 var indicatorItemCoord = get_indicator_item_position(i);
194284
195285 touchPress(panel,
196− indicatorItemCoord.x, panel.panelHeight / 2);
286+ indicatorItemCoord.x, panel.indicators.panelHeight / 2);
197287
198288 // 1) Drag the mouse down
199289 touchFlick(panel,
200− indicatorItemCoord.x, panel.panelHeight / 2,
290+ indicatorItemCoord.x, panel.indicators.panelHeight / 2,
201291 indicatorItemCoord.x, panel.height,
202292 false /* beginTouch */, false /* endTouch */);
203293
@@ -266,19 +356,19 @@ Item {
266356 var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.row.count - 1);
267357
268358 touchPress(panel,
269− indicatorItemCoordFirst.x, panel.panelHeight / 2);
359+ indicatorItemCoordFirst.x, panel.indicators.panelHeight / 2);
270360
271361 // 1) Drag the mouse down to hint a bit
272362 touchFlick(panel,
273− indicatorItemCoordFirst.x, panel.panelHeight / 2,
274− indicatorItemCoordFirst.x, panel.panelHeight * 2,
363+ indicatorItemCoordFirst.x, panel.indicators.panelHeight / 2,
364+ indicatorItemCoordFirst.x, panel.indicators.panelHeight * 2,
275365 false /* beginTouch */, false /* endTouch */);
276366
277367 tryCompare(indicatorRow, "currentItem", indicatorItemFirst)
278368
279369 // 1) Flick mouse down to bottom
280370 touchFlick(panel,
281− indicatorItemCoordFirst.x, panel.panelHeight * 2,
371+ indicatorItemCoordFirst.x, panel.indicators.panelHeight * 2,
282372 indicatorItemCoordNext.x, panel.height,
283373 false /* beginTouch */, true /* endTouch */,
284374 units.gu(10) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity