@@ -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.Telephony 0.1 as Telephony
20import ".."
21import ".."
21import "../../../qml/Panel"
22import "../../../qml/Panel"
@@ -40,26 +41,23 @@ Item {
42 anchors.fill: parent
43 anchors.fill: parent
43− fullscreenMode: true
44+ fullscreenMode: false
45 indicators {
46 indicators {
46 profile: "test1"
47 profile: "test1"
48+ panelHeight: units.gu(5)
52+ Telephony.CallEntry {
54+ phoneNumber: "+447812221111"
50 UT.UnityTestCase {
57 UT.UnityTestCase {
51 name: "Panel"
58 name: "Panel"
52 when: windowShown
59 when: windowShown
54− function get_window_data() {
56− {tag: "pinned", fullscreenFlag: false, alreadyOpen: false },
57− {tag: "fullscreen", fullscreenFlag: true, alreadyOpen: false },
58− {tag: "pinned-alreadyOpen", fullscreenFlag: false, alreadyOpen: true },
59− {tag: "fullscreen-alreadyOpen", fullscreenFlag: true, alreadyOpen: true }
63 function init() {
61 function init() {
64 panel.indicators.initialise();
62 panel.indicators.initialise();
@@ -67,6 +65,7 @@ Item {
67 panel.indicators.hide();
65 panel.indicators.hide();
68 tryCompare(panel.indicators.hideAnimation, "running", false);
66 tryCompare(panel.indicators.hideAnimation, "running", false);
69 tryCompare(panel.indicators, "state", "initial");
67 tryCompare(panel.indicators, "state", "initial");
68+ callManager.foregroundCall = null;
72 function get_indicator_item(index) {
71 function get_indicator_item(index) {
@@ -114,7 +113,8 @@ Item {
114 panel.fullscreenMode = true;
113 panel.fullscreenMode = true;
115 // Wait for the indicators to get into position.
114 // Wait for the indicators to get into position.
116 // (switches between normal and fullscreen modes are animated)
115 // (switches between normal and fullscreen modes are animated)
116+ var indicatorArea = findChild(panel, "indicatorArea");
117− tryCompare(panel.indicators, "y", -panel.panelHeight);
117+ tryCompare(indicatorArea, "y", -panel.panelHeight);
119 var indicatorItemCoord = get_indicator_item_position(0);
119 var indicatorItemCoord = get_indicator_item_position(0);
@@ -124,7 +124,7 @@ Item {
124 wait(500);
124 wait(500);
126 // no hint animation when fullscreen
126 // no hint animation when fullscreen
127− compare(panel.indicators.y, -panel.panelHeight);
127+ compare(indicatorArea.y, -panel.panelHeight);
128 var indicatorRow = findChild(panel.indicators, "indicatorRow");
128 var indicatorRow = findChild(panel.indicators, "indicatorRow");
129 verify(indicatorRow !== null);
129 verify(indicatorRow !== null);
130 compare(indicatorRow.y, 0);
130 compare(indicatorRow.y, 0);
@@ -138,34 +138,48 @@ Item {
138 touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
138 touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
141− function test_drag_show_data() { return get_window_data(); }
141+ function test_drag_show_data() {
143+ { tag: "pinned", fullscreenFlag: false, alreadyOpen: false, call: null,
144+ indicatorY: function() { return 0 } },
145+ { tag: "fullscreen", fullscreenFlag: true, alreadyOpen: false, call: null,
146+ indicatorY: function() {return -panel.panelHeight } },
147+ { tag: "pinned-alreadyOpen", fullscreenFlag: false, alreadyOpen: true, call: null,
148+ indicatorY: function() { return 0 } },
149+ { tag: "fullscreen-alreadyOpen", fullscreenFlag: true, alreadyOpen: true, call: null,
150+ indicatorY: function() {return -panel.panelHeight } },
151+ { tag: "pinned-callActive", fullscreenFlag: false, alreadyOpen: false, call: phoneCall,
152+ indicatorY: function() { return units.gu(3) } },
153+ { tag: "fullscreen-callActive", fullscreenFlag: true, alreadyOpen: false, call: phoneCall,
154+ indicatorY: function() {return units.gu(3) - (panel.panelHeight - units.gu(3)) } }
143 // Dragging from a indicator item in the panel will gradually expose the
158 // Dragging from a indicator item in the panel will gradually expose the
144 // indicators, first by running the hint animation, then after dragging down will
159 // indicators, first by running the hint animation, then after dragging down will
145 // expose more of the panel, binding it to the selected indicator and opening it's menu.
160 // expose more of the panel, binding it to the selected indicator and opening it's menu.
146 function test_drag_show(data) {
161 function test_drag_show(data) {
147 panel.fullscreenMode = data.fullscreenFlag;
162 panel.fullscreenMode = data.fullscreenFlag;
164+ callManager.foregroundCall = data.call;
148 if (data.alreadyOpen) {
166 if (data.alreadyOpen) {
149 panel.indicators.show();
167 panel.indicators.show();
150 tryCompare(panel.indicators, "fullyOpened", true);
168 tryCompare(panel.indicators, "fullyOpened", true);
153− var indicatorRow = findChild(panel.indicators, "indicatorRow");
171+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
154 verify(indicatorRow !== null);
172 verify(indicatorRow !== null);
156 var menuContent = findChild(panel.indicators, "menuContent");
174 var menuContent = findChild(panel.indicators, "menuContent");
157− verify(indicatorRow !== null);
175+ verify(menuContent !== null);
159− var menuContent = findChild(panel.indicators, "menuContent");
177+ var indicatorArea = findChild(panel, "indicatorArea");
160− verify(indicatorRow !== null);
178+ verify(indicatorArea !== null);
162 // Wait for the indicators to get into position.
180 // Wait for the indicators to get into position.
163 // (switches between normal and fullscreen modes are animated)
181 // (switches between normal and fullscreen modes are animated)
164− if (data.fullscreenFlag) {
182+ tryCompare(indicatorArea, "y", data.indicatorY());
165− tryCompare(panel.indicators, "y", -panel.panelHeight);
167− tryCompare(panel.indicators, "y", 0);
170 // do this for each indicator item
184 // do this for each indicator item
171 for (var i = 0; i < indicatorRow.row.count; i++) {
185 for (var i = 0; i < indicatorRow.row.count; i++) {
@@ -184,7 +198,7 @@ Item {
184 // 1) Drag the mouse down
198 // 1) Drag the mouse down
185 touchFlick(panel,
199 touchFlick(panel,
186 indicatorItemCoord.x, panel.panelHeight / 2,
200 indicatorItemCoord.x, panel.panelHeight / 2,
187− indicatorItemCoord.x, panel.height * 0.8,
201+ indicatorItemCoord.x, panel.height,
188 false /* beginTouch */, false /* endTouch */);
202 false /* beginTouch */, false /* endTouch */);
190 // Indicators height should follow the drag, and therefore increase accordingly.
204 // Indicators height should follow the drag, and therefore increase accordingly.
@@ -193,7 +207,7 @@ Item {
193 function() {return panel.indicators.height >= panel.height * 0.5},
207 function() {return panel.indicators.height >= panel.height * 0.5},
196− touchRelease(panel, indicatorItemCoord.x, panel.height * 0.8);
210+ touchRelease(panel, indicatorItemCoord.x, panel.height);
198 compare(indicatorRow.currentItem, indicatorItem,
212 compare(indicatorRow.currentItem, indicatorItem,
199 "Incorrect item activated at position " + i);
213 "Incorrect item activated at position " + i);
@@ -201,7 +215,9 @@ Item {
202 // init for next indicatorItem
216 // init for next indicatorItem
203 if (!data.alreadyOpen) {
217 if (!data.alreadyOpen) {
204− init();
218+ panel.indicators.hide();
219+ tryCompare(panel.indicators.hideAnimation, "running", false);
220+ tryCompare(panel.indicators, "state", "initial");