on xenial help sign in
Clean up tests. Following Albert's suggestion.
2a111a1Daniel d'Andrada
tests/qmltests/Components/tst_Stage.qml−5
@@ -24,7 +24,6 @@ import Unity.Test 0.1 as UT
24import "tst_Stage"
24import "tst_Stage"
25
25
26Rectangle {
26Rectangle {
27− id: root
28 width: units.gu(70)
27 width: units.gu(70)
29 height: stageRect.height
28 height: stageRect.height
30
29
@@ -206,10 +205,6 @@ Rectangle {
206 && oldAppScreenshot.visible
205 && oldAppScreenshot.visible
207 }
206 }
208
207
209− function initTestCase() {
210− removeTimeConstraintsFromDirectionalDragAreas(root);
211− }
212−
213 function init() {
208 function init() {
214 redControl.checked = false;
209 redControl.checked = false;
215 greenControl.checked = false;
210 greenControl.checked = false;
tests/qmltests/Panel/tst_Indicators.qml−4
@@ -82,10 +82,6 @@ Item {
82 name: "Indicators"
82 name: "Indicators"
83 when: windowShown
83 when: windowShown
84
84
85− function initTestCase() {
86− removeTimeConstraintsFromDirectionalDragAreas(shell);
87− }
88−
89 function init() {
85 function init() {
90 indicators.hide();
86 indicators.hide();
91 tryCompare(indicators.hideAnimation, "running", false);
87 tryCompare(indicators.hideAnimation, "running", false);
tests/qmltests/Panel/tst_Panel.qml−4
@@ -52,10 +52,6 @@ Item {
52 {tag: "fullscreen", fullscreenFlag: true }
52 {tag: "fullscreen", fullscreenFlag: true }
53 ]}
53 ]}
54
54
55− function initTestCase() {
56− removeTimeConstraintsFromDirectionalDragAreas(shell);
57− }
58−
59 function init() {
55 function init() {
60 searchClicked = false;
56 searchClicked = false;
61 panel.indicators.hide();
57 panel.indicators.hide();
tests/qmltests/tst_Shell.qml−1
@@ -67,7 +67,6 @@ Item {
67 // The code above just didn't solve it.
67 // The code above just didn't solve it.
68 wait(2000);
68 wait(2000);
69
69
70− removeTimeConstraintsFromDirectionalDragAreas(shell);
71 swipeAwayGreeter();
70 swipeAwayGreeter();
72 }
71 }
73
72
tests/utils/modules/Unity/Test/UnityTestCase.qml+9
@@ -14,6 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17+import QtQuick 2.0
17import QtTest 1.0
18import QtTest 1.0
18import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
19import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
@@ -298,6 +299,14 @@ TestCase {
298 event.commit()
299 event.commit()
299 }
300 }
300
301
302+ Component.onCompleted: {
303+ var rootItem = parent;
304+ while (rootItem.parent != undefined) {
305+ rootItem = rootItem.parent;
306+ }
307+ removeTimeConstraintsFromDirectionalDragAreas(rootItem);
308+ }
309+
301 /*
310 /*
302 In qmltests, sequences of touch events are sent all at once, unlike in "real life".
311 In qmltests, sequences of touch events are sent all at once, unlike in "real life".
303 Also qmltests might run really slowly, e.g. when run from inside virtual machines.
312 Also qmltests might run really slowly, e.g. when run from inside virtual machines.