on xenial help sign in
moved new -> current
commit61c6e38bebff948db74439cedb7efa5746ff1734 authorNick Dedekind <nick.dedekind@canonical.com> dateTue 30 Sep 2014, 15:54 (12 years ago) parent2328094
11 files changed+5−396
tests/qmltests/CMakeLists.txt+5−9 tests/qmltests/Panel/New/IndicatorTest.qml → tests/qmltests/Panel/IndicatorTest.qml tests/qmltests/Panel/New/tst_NewIndicatorItem.qml → tests/qmltests/Panel/Old/tst_IndicatorItem.qml tests/qmltests/Panel/tst_IndicatorRow.qml → tests/qmltests/Panel/Old/tst_IndicatorRow.qml tests/qmltests/Panel/tst_Indicators.qml → tests/qmltests/Panel/Old/tst_Indicators.qml tests/qmltests/Panel/New/tst_NewPanel.qml → tests/qmltests/Panel/Old/tst_Panel.qml tests/qmltests/Panel/tst_IndicatorItem.qml−50 tests/qmltests/Panel/New/tst_NewIndicatorItemRow.qml → tests/qmltests/Panel/tst_IndicatorItemRow.qml tests/qmltests/Panel/New/tst_NewIndicatorsBar.qml → tests/qmltests/Panel/tst_IndicatorsBar.qml tests/qmltests/Panel/New/tst_NewIndicatorsMenu.qml → tests/qmltests/Panel/tst_IndicatorsMenu.qml tests/qmltests/Panel/tst_Panel.qml−337
tests/qmltests/CMakeLists.txt+5−9
@@ -12,7 +12,6 @@ set(qmltest_DEFAULT_IMPORT_PATHS
1212set(qmltest_DEFAULT_TARGETS qmlunittests)
1313set(qmltest_DEFAULT_NO_ADD_TEST FALSE)
1414set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
15−add_qml_test(Panel IndicatorItem)
1615add_qml_test(utils/Unity/Test UnityTest)
1716
1817set(qmltest_DEFAULT_TARGETS qmluitests)
@@ -70,14 +69,11 @@ add_qml_test(Hud Result)
7069add_qml_test(Launcher Launcher)
7170add_qml_test(Notifications Notifications)
7271add_qml_test(Notifications VisualSnapDecisionsQueue)
73−add_qml_test(Panel ActiveCallHint)
74−add_qml_test(Panel MenuContent)
75−add_qml_test(Panel SearchIndicator)
76−add_qml_test(Panel/New NewIndicatorItem)
77−add_qml_test(Panel/New NewIndicatorItemRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
78−add_qml_test(Panel/New NewIndicatorsBar ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
79−add_qml_test(Panel/New NewIndicatorsMenu ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
80−add_qml_test(Panel/New NewPanel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
72+add_qml_test(Panel IndicatorItem)
73+add_qml_test(Panel IndicatorItemRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
74+add_qml_test(Panel IndicatorsBar ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
75+add_qml_test(Panel IndicatorsMenu ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
76+add_qml_test(Panel Panel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
8177add_qml_test(Panel/Indicators DefaultIndicatorWidget ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
8278add_qml_test(Panel/Indicators DefaultIndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel")
8379# These MenuItemFactory tests need the test/mocks/ to come before plugins/
tests/qmltests/Panel/New/IndicatorTest.qml → tests/qmltests/Panel/IndicatorTest.qmlrenamed

The content is the same.

tests/qmltests/Panel/New/tst_NewIndicatorItem.qml → tests/qmltests/Panel/Old/tst_IndicatorItem.qmlrenamed

The content is the same.

tests/qmltests/Panel/tst_IndicatorRow.qml → tests/qmltests/Panel/Old/tst_IndicatorRow.qmlrenamed

The content is the same.

tests/qmltests/Panel/tst_Indicators.qml → tests/qmltests/Panel/Old/tst_Indicators.qmlrenamed

The content is the same.

tests/qmltests/Panel/New/tst_NewPanel.qml → tests/qmltests/Panel/Old/tst_Panel.qmlrenamed

The content is the same.

tests/qmltests/Panel/tst_IndicatorItem.qmldeleted−50
@@ -1,50 +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−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import ".."
20−import "../../../qml/Panel"
21−import Ubuntu.Components 0.1
22−import Unity.Test 0.1 as UT
23−
24−Rectangle {
25− width: units.gu(10)
26− height: units.gu(5)
27− color: "black"
28−
29− IndicatorItem {
30− id: indicatorItem
31− anchors.fill: parent
32− }
33−
34− UT.UnityTestCase {
35− name: "IndicatorItem"
36−
37− function test_dimmed() {
38− indicatorItem.dimmed = false;
39− tryCompareFunction(function(){return indicatorItem.opacity}, 1.0);
40− indicatorItem.dimmed = true;
41− tryCompareFunction(function(){return indicatorItem.opacity < 1.0}, true);
42− }
43−
44− function test_empty() {
45− compare(indicatorItem.indicatorVisible, false, "IndicatorItem should not be visible.");
46− indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml";
47− tryCompare(indicatorItem, "indicatorVisible", true);
48− }
49− }
50−}
tests/qmltests/Panel/New/tst_NewIndicatorItemRow.qml → tests/qmltests/Panel/tst_IndicatorItemRow.qmlrenamed

The content is the same.

tests/qmltests/Panel/New/tst_NewIndicatorsBar.qml → tests/qmltests/Panel/tst_IndicatorsBar.qmlrenamed

The content is the same.

tests/qmltests/Panel/New/tst_NewIndicatorsMenu.qml → tests/qmltests/Panel/tst_IndicatorsMenu.qmlrenamed

The content is the same.

tests/qmltests/Panel/tst_Panel.qmldeleted−337
@@ -1,337 +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−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import Unity.Test 0.1 as UT
20−import Ubuntu.Components 0.1 as UC
21−import Ubuntu.Telephony 0.1 as Telephony
22−import ".."
23−import "../../../qml/Panel"
24−
25−/*
26− This tests the Panel component using a fake model to stage data in the indicators
27− A view will show with indicators at the top, as does in the shell. This can be controlled
28− as in the shell.
29−*/
30−Item {
31− id: shell
32− width: units.gu(40)
33− height: units.gu(80)
34−
35− Panel {
36− id: panel
37− anchors {
38− left: parent.left
39− right: parent.right
40− }
41− height: parent.height - row.height
42− fullscreenMode: false
43−
44− indicators {
45− profile: "test1"
46− panelHeight: units.gu(5)
47− }
48− callHint {
49− height: units.gu(4)
50− }
51−
52− property real panelAndSeparatorHeight: panel.indicators.panelHeight + units.dp(2)
53− }
54−
55−
56− Row {
57− id: row
58− anchors {
59− bottom: shell.bottom
60− left: parent.left
61− right: parent.right
62− }
63− height: 50
64−
65− UC.Button {
66− text: panel.indicators.shown ? "Hide" : "Show"
67− anchors {
68− top: parent.top
69− bottom: parent.bottom
70− }
71− width: parent.width/3
72−
73− onClicked: {
74− if (panel.indicators.shown) {
75− panel.indicators.hide();
76− } else {
77− panel.indicators.show();
78− }
79− }
80− }
81−
82− UC.Button {
83− text: panel.fullscreenMode ? "Maximize" : "FullScreen"
84− anchors {
85− top: parent.top
86− bottom: parent.bottom
87− }
88− width: parent.width/3
89−
90− onClicked: panel.fullscreenMode = !panel.fullscreenMode
91− }
92−
93− UC.Button {
94− text: callManager.hasCalls ? "Called" : "No Calls"
95− anchors {
96− top: parent.top
97− bottom: parent.bottom
98− }
99− width: parent.width/3
100−
101− onClicked: {
102− if (callManager.foregroundCall) {
103− callManager.foregroundCall = null;
104− } else {
105− callManager.foregroundCall = phoneCall;
106− }
107− }
108− }
109− }
110−
111− Telephony.CallEntry {
112− id: phoneCall
113− phoneNumber: "+447812221111"
114− }
115−
116− UT.UnityTestCase {
117− name: "Panel"
118− when: windowShown
119−
120− function init() {
121− panel.indicators.initialise();
122− panel.fullscreenMode = false;
123−
124− panel.indicators.hide();
125− // Wait for animation to complete
126− tryCompare(panel.indicators.hideAnimation, "running", false);
127− callManager.foregroundCall = null;
128−
129− // Wait for the indicators to get into position.
130− // (switches between normal and fullscreen modes are animated)
131− var indicatorArea = findChild(panel, "indicatorArea");
132− tryCompare(indicatorArea, "y", 0);
133− }
134−
135− function get_indicator_item(index) {
136− var indicatorRow = findChild(panel.indicators, "indicatorRow");
137− verify(indicatorRow !== null);
138−
139− return findChild(indicatorRow.row, "item" + index);
140− }
141−
142− function get_indicator_item_position(index) {
143− var indicatorRow = findChild(panel.indicators, "indicatorRow");
144− verify(indicatorRow !== null);
145−
146− var indicatorItem = get_indicator_item(index);
147− verify(indicatorItem !== null);
148−
149− return panel.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
150− }
151−
152− // Pressing on the indicator panel should activate the indicator hints
153− // and expose a portion of the conent.
154− function test_hint() {
155− var indicatorItemCoord = get_indicator_item_position(0);
156−
157− touchPress(panel, indicatorItemCoord.x, panel.indicators.panelHeight / 2);
158−
159− // hint animation should be run, meaning that indicators will move downwards
160− // by hintValue pixels without any drag taking place
161− tryCompareFunction(function() { return panel.indicators.height },
162− panel.indicators.panelHeight + panel.indicators.hintValue);
163− tryCompare(panel.indicators, "partiallyOpened", true);
164− tryCompare(panel.indicators, "fullyOpened", false);
165−
166− touchRelease(panel, indicatorItemCoord.x, panel.indicators.panelHeight/2);
167− }
168−
169− // Pressing on the top edge of the screen should have no effect if the panel
170− // is hidden (fullscreen), which is the case when a fullscreen app is being shown
171− function test_noHintOnFullscreenMode() {
172− panel.fullscreenMode = true;
173− // Wait for the indicators to get into position.
174− // (switches between normal and fullscreen modes are animated)
175− var indicatorArea = findChild(panel, "indicatorArea");
176− tryCompare(indicatorArea, "y", -panel.panelHeight);
177−
178− var indicatorItemCoord = get_indicator_item_position(0);
179−
180− touchPress(panel, indicatorItemCoord.x, panel.indicators.panelHeight / 2);
181−
182− // Give some time for a hint animation to change things, if any
183− wait(500);
184−
185− // no hint animation when fullscreen
186− compare(panel.indicators.partiallyOpened, false,
187− "Indicator should not be partially opened when panel is pressed in" +
188− " fullscreenmode");
189− compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
190− " opened when panel is pressed in fullscreenmode");
191−
192− touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
193− }
194−
195− // Pressing on the top edge of the indicator should have no effect if the panel
196− // has an active call
197− function test_noHintOnActiveCall() {
198− callManager.foregroundCall = phoneCall;
199−
200− var indicatorItemCoord = get_indicator_item_position(0);
201−
202− touchPress(panel, indicatorItemCoord.x, panel.callHint.height + panel.indicators.panelHeight / 2);
203−
204− // Give some time for a hint animation to change things, if any
205− wait(500);
206−
207− // no hint animation when fullscreen
208− compare(panel.indicators.partiallyOpened, false,
209− "Indicator should not be partially opened when panel is pressed in" +
210− " fullscreenmode");
211− compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
212− " opened when panel is pressed in fullscreenmode");
213−
214− touchRelease(panel, indicatorItemCoord.x, panel.panelHeight/2);
215− }
216−
217− function test_drag_show_data() {
218− return [
219− { tag: "pinned", fullscreenFlag: false, alreadyOpen: false, call: null,
220− indicatorY: 0 },
221− { tag: "fullscreen", fullscreenFlag: true, alreadyOpen: false, call: null,
222− indicatorY: -panel.panelAndSeparatorHeight },
223− { tag: "pinned-alreadyOpen", fullscreenFlag: false, alreadyOpen: true, call: null,
224− indicatorY: 0 },
225− { tag: "fullscreen-alreadyOpen", fullscreenFlag: true, alreadyOpen: true, call: null,
226− indicatorY: 0 },
227− { tag: "pinned-callActive", fullscreenFlag: false, alreadyOpen: false, call: phoneCall,
228− indicatorY: 0},
229− { tag: "fullscreen-callActive", fullscreenFlag: true, alreadyOpen: false, call: phoneCall,
230− indicatorY: -panel.panelAndSeparatorHeight }
231− ];
232− }
233−
234− // Dragging from a indicator item in the panel will gradually expose the
235− // indicators, first by running the hint animation, then after dragging down will
236− // expose more of the panel, binding it to the selected indicator and opening it's menu.
237− function test_drag_show(data) {
238− panel.fullscreenMode = data.fullscreenFlag;
239− callManager.foregroundCall = data.call;
240−
241− if (data.alreadyOpen) {
242− panel.indicators.show();
243− tryCompare(panel.indicators, "fullyOpened", true);
244− }
245−
246− var indicatorRow = findChild(panel.indicators, "indicatorRow");
247− verify(indicatorRow !== null);
248−
249− var menuContent = findChild(panel.indicators, "menuContent");
250− verify(menuContent !== null);
251−
252− var indicatorArea = findChild(panel, "indicatorArea");
253− verify(indicatorArea !== null);
254−
255− // Wait for the indicators to get into position.
256− // (switches between normal and fullscreen modes are animated)
257− tryCompareFunction(function() { return indicatorArea.y }, data.indicatorY);
258−
259− // do this for each indicator item
260− for (var i = 0; i < indicatorRow.row.count; i++) {
261−
262− var indicatorItem = get_indicator_item(i);
263− verify(indicatorItem !== null);
264−
265− if (!indicatorItem.visible)
266− continue;
267−
268− var indicatorItemCoord = get_indicator_item_position(i);
269−
270− touchPress(panel,
271− indicatorItemCoord.x, panel.indicators.panelHeight / 2);
272−
273− // 1) Drag the mouse down
274− touchFlick(panel,
275− indicatorItemCoord.x, panel.indicators.panelHeight / 2,
276− indicatorItemCoord.x, panel.height,
277− false /* beginTouch */, false /* endTouch */);
278−
279− // Indicators height should follow the drag, and therefore increase accordingly.
280− // They should be at least half-way through the screen
281− tryCompareFunction(
282− function() {return panel.indicators.height >= panel.height * 0.5},
283− true);
284−
285− touchRelease(panel, indicatorItemCoord.x, panel.height);
286−
287− compare(indicatorRow.currentItem, indicatorItem,
288− "Incorrect item activated at position " + i);
289− compare(menuContent.currentMenuIndex, i, "Menu conetent should be enabled for item at position " + i);
290−
291− // init for next indicatorItem
292− if (!data.alreadyOpen) {
293− panel.indicators.hide();
294− tryCompare(panel.indicators.hideAnimation, "running", false);
295− tryCompare(panel.indicators, "state", "initial");
296− }
297− }
298− }
299−
300− // Test the vertical velocity check when flicking the indicators open at an angle.
301− // If the vertical velocity is above a specific point, we shouldnt change active indicators
302− // if the x position changes
303− function test_vertical_velocity_detector() {
304− panel.fullscreenMode = false;
305−
306− var indicatorRow = findChild(panel.indicators, "indicatorRow");
307− verify(indicatorRow !== null);
308−
309− // Get the first indicator
310− var indicatorItemFirst = get_indicator_item(0);
311− verify(indicatorItemFirst !== null);
312−
313− var indicatorItemCoordFirst = get_indicator_item_position(0);
314− var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.row.count - 1);
315−
316− touchPress(panel,
317− indicatorItemCoordFirst.x, panel.indicators.panelHeight / 2);
318−
319− // 1) Drag the mouse down to hint a bit
320− touchFlick(panel,
321− indicatorItemCoordFirst.x, panel.indicators.panelHeight / 2,
322− indicatorItemCoordFirst.x, panel.indicators.panelHeight * 2,
323− false /* beginTouch */, false /* endTouch */);
324−
325− tryCompare(indicatorRow, "currentItem", indicatorItemFirst)
326−
327− // 1) Flick mouse down to bottom
328− touchFlick(panel,
329− indicatorItemCoordFirst.x, panel.indicators.panelHeight * 2,
330− indicatorItemCoordNext.x, panel.height,
331− false /* beginTouch */, true /* endTouch */,
332− units.gu(10) /* speed */, 30 /* iterations */); // more samples needed for accurate velocity
333−
334− compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
335− }
336− }
337−}