@@ -50,8 +50,11 @@ TestCase {
50 this.getCurrentTimeMs = function() {return this.currentTimeMs}
50 this.getCurrentTimeMs = function() {return this.currentTimeMs}
53− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
53+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
54 function mouseClick(item, x, y, button, modifiers, delay) {
54 function mouseClick(item, x, y, button, modifiers, delay) {
56+ qtest_fail("no item given", 1);
55 if (button === undefined)
58 if (button === undefined)
56 button = Qt.LeftButton;
59 button = Qt.LeftButton;
57 if (modifiers === undefined)
60 if (modifiers === undefined)
@@ -66,8 +69,11 @@ TestCase {
66 qtest_fail("window not shown", 2);
69 qtest_fail("window not shown", 2);
69− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
72+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
70 function mouseDoubleClick(item, x, y, button, modifiers, delay) {
73 function mouseDoubleClick(item, x, y, button, modifiers, delay) {
75+ qtest_fail("no item given", 1);
71 if (button === undefined)
77 if (button === undefined)
72 button = Qt.LeftButton;
78 button = Qt.LeftButton;
73 if (modifiers === undefined)
79 if (modifiers === undefined)
@@ -82,8 +88,11 @@ TestCase {
82 qtest_fail("window not shown", 2)
88 qtest_fail("window not shown", 2)
85− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
91+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
86 function mousePress(item, x, y, button, modifiers, delay) {
92 function mousePress(item, x, y, button, modifiers, delay) {
94+ qtest_fail("no item given", 1);
87 if (button === undefined)
96 if (button === undefined)
88 button = Qt.LeftButton;
97 button = Qt.LeftButton;
89 if (modifiers === undefined)
98 if (modifiers === undefined)
@@ -98,8 +107,11 @@ TestCase {
98 qtest_fail("window not shown", 2)
107 qtest_fail("window not shown", 2)
101− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
110+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
102 function mouseRelease(item, x, y, button, modifiers, delay) {
111 function mouseRelease(item, x, y, button, modifiers, delay) {
113+ qtest_fail("no item given", 1);
103 if (button === undefined)
115 if (button === undefined)
104 button = Qt.LeftButton;
116 button = Qt.LeftButton;
105 if (modifiers === undefined)
117 if (modifiers === undefined)
@@ -121,6 +133,9 @@ TestCase {
121 // speed is in pixels/second
133 // speed is in pixels/second
122 function mouseFlick(item, x, y, toX, toY, pressMouse, releaseMouse,
134 function mouseFlick(item, x, y, toX, toY, pressMouse, releaseMouse,
123 speed, iterations) {
135 speed, iterations) {
137+ qtest_fail("no item given", 1);
124 pressMouse = ((pressMouse != null) ? pressMouse : true); // Default to true for pressMouse if not present
139 pressMouse = ((pressMouse != null) ? pressMouse : true); // Default to true for pressMouse if not present
125 releaseMouse = ((releaseMouse != null) ? releaseMouse : true); // Default to true for releaseMouse if not present
140 releaseMouse = ((releaseMouse != null) ? releaseMouse : true); // Default to true for releaseMouse if not present
@@ -159,6 +174,9 @@ TestCase {
160 // Find an object with the given name in the children tree of "obj"
175 // Find an object with the given name in the children tree of "obj"
161 function findChild(obj, objectName) {
176 function findChild(obj, objectName) {
178+ qtest_fail("no obj given", 1);
162 return findChildIn(obj, "children", objectName);
180 return findChildIn(obj, "children", objectName);
@@ -168,11 +186,17 @@ TestCase {
168 // as this tree is much bigger and might contain stuff that goes
186 // as this tree is much bigger and might contain stuff that goes
169 // away randomly.
187 // away randomly.
170 function findInvisibleChild(obj, objectName) {
188 function findInvisibleChild(obj, objectName) {
190+ qtest_fail("no obj given", 1);
171 return findChildIn(obj, "data", objectName);
192 return findChildIn(obj, "data", objectName);
174 // Find a child in the named property
195 // Find a child in the named property
175 function findChildIn(obj, prop, objectName) {
196 function findChildIn(obj, prop, objectName) {
198+ qtest_fail("no obj given", 1);
176 var childs = new Array(0);
200 var childs = new Array(0);
177 childs.push(obj)
201 childs.push(obj)
178 while (childs.length > 0) {
202 while (childs.length > 0) {
@@ -188,6 +212,9 @@ TestCase {
190 function findChildsByType(obj, typeName) {
214 function findChildsByType(obj, typeName) {
216+ qtest_fail("no obj given", 1);
191 var res = new Array(0);
218 var res = new Array(0);
192 for (var i in obj.children) {
219 for (var i in obj.children) {
193 var c = obj.children[i];
220 var c = obj.children[i];
@@ -235,6 +262,9 @@ TestCase {
237 function flickToYEnd(item) {
264 function flickToYEnd(item) {
266+ qtest_fail("no item given", 1);
238 var i = 0;
268 var i = 0;
239 var x = item.width / 2;
269 var x = item.width / 2;
240 var y = item.height - units.gu(1);
270 var y = item.height - units.gu(1);
@@ -254,6 +284,9 @@ TestCase {
255 // speed is in pixels/second
285 // speed is in pixels/second
256 function touchFlick(item, x, y, toX, toY, beginTouch, endTouch, speed, iterations) {
286 function touchFlick(item, x, y, toX, toY, beginTouch, endTouch, speed, iterations) {
288+ qtest_fail("no item given", 1);
257 // Make sure the item is rendered
290 // Make sure the item is rendered
258 waitForRendering(item);
291 waitForRendering(item);
@@ -313,10 +346,16 @@ TestCase {
313 // perform a drag in the given direction until the given condition is true
346 // perform a drag in the given direction until the given condition is true
314 // The condition is a function to be evaluated after every step
347 // The condition is a function to be evaluated after every step
315 function touchDragUntil(item, startX, startY, stepX, stepY, condition) {
348 function touchDragUntil(item, startX, startY, stepX, stepY, condition) {
350+ qtest_fail("no item given", 1);
316 multiTouchDragUntil([0], item, startX, startY, stepX, stepY, condition);
352 multiTouchDragUntil([0], item, startX, startY, stepX, stepY, condition);
319 function multiTouchDragUntil(touchIds, item, startX, startY, stepX, stepY, condition) {
355 function multiTouchDragUntil(touchIds, item, startX, startY, stepX, stepY, condition) {
357+ qtest_fail("no item given", 1);
320 var root = fetchRootItem(item);
359 var root = fetchRootItem(item);
321 var pos = item.mapToItem(root, startX, startY);
360 var pos = item.mapToItem(root, startX, startY);
@@ -361,9 +400,17 @@ TestCase {
361 event.commit()
400 event.commit()
364− function touchMove(item, tox, toy) { multiTouchMove(0, item, tox, toy); }
403+ function touchMove(item, tox, toy) {
405+ qtest_fail("no item given", 1);
407+ multiTouchMove(0, item, tox, toy);
366 function multiTouchMove(touchId, item, tox, toy) {
410 function multiTouchMove(touchId, item, tox, toy) {
412+ qtest_fail("no item given", 1);
367 if (typeof touchId !== "number") touchId = 0;
414 if (typeof touchId !== "number") touchId = 0;
368 var root = fetchRootItem(item)
415 var root = fetchRootItem(item)
369 var rootPoint = item.mapToItem(root, tox, toy)
416 var rootPoint = item.mapToItem(root, tox, toy)
@@ -374,6 +421,9 @@ TestCase {
376 function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {
423 function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {
425+ qtest_fail("no item given", 1);
377 // Make sure the item is rendered
427 // Make sure the item is rendered
378 waitForRendering(item);
428 waitForRendering(item);
@@ -400,13 +450,21 @@ TestCase {
402 function fetchRootItem(item) {
452 function fetchRootItem(item) {
454+ qtest_fail("no item given", 1);
403 if (item.parent)
456 if (item.parent)
404 return fetchRootItem(item.parent)
457 return fetchRootItem(item.parent)
406 return item
459 return item
409− function touchPress(item, x, y) { multiTouchPress(0, item, x, y, []); }
462+ function touchPress(item, x, y) {
464+ qtest_fail("no item given", 1);
466+ multiTouchPress(0, item, x, y, []);
411 /*! \brief Release a touch point
469 /*! \brief Release a touch point
@@ -417,6 +475,9 @@ TestCase {
417 \param stationaryPoints An array of touchIds which are "already touched"
475 \param stationaryPoints An array of touchIds which are "already touched"
419 function multiTouchPress(touchId, item, x, y, stationaryPoints) {
477 function multiTouchPress(touchId, item, x, y, stationaryPoints) {
479+ qtest_fail("no item given", 1);
420 if (typeof touchId !== "number") touchId = 0;
481 if (typeof touchId !== "number") touchId = 0;
421 if (typeof x !== "number") x = item.width / 2;
482 if (typeof x !== "number") x = item.width / 2;
422 if (typeof y !== "number") y = item.height / 2;
483 if (typeof y !== "number") y = item.height / 2;
@@ -432,7 +493,12 @@ TestCase {
432 event.commit()
493 event.commit()
435− function touchRelease(item, x, y) { multiTouchRelease(0, item, x, y, []); }
496+ function touchRelease(item, x, y) {
498+ qtest_fail("no item given", 1);
500+ multiTouchRelease(0, item, x, y, []);
437 /*! \brief Release a touch point
503 /*! \brief Release a touch point
@@ -443,6 +509,9 @@ TestCase {
443 \param stationaryPoints An array of touchIds which are "still touched"
509 \param stationaryPoints An array of touchIds which are "still touched"
445 function multiTouchRelease(touchId, item, x, y, stationaryPoints) {
511 function multiTouchRelease(touchId, item, x, y, stationaryPoints) {
513+ qtest_fail("no item given", 1);
446 if (typeof touchId !== "number") touchId = 0;
515 if (typeof touchId !== "number") touchId = 0;
447 if (typeof x !== "number") x = item.width / 2;
516 if (typeof x !== "number") x = item.width / 2;
448 if (typeof y !== "number") y = item.height / 2;
517 if (typeof y !== "number") y = item.height / 2;
@@ -465,10 +534,16 @@ TestCase {
465 \param y The y coordinate of the tap, defaults to vertical center
534 \param y The y coordinate of the tap, defaults to vertical center
467 function tap(item, x, y) {
536 function tap(item, x, y) {
538+ qtest_fail("no item given", 1);
468 multiTouchTap([0], item, x, y);
540 multiTouchTap([0], item, x, y);
471 function multiTouchTap(touchIds, item, x, y) {
543 function multiTouchTap(touchIds, item, x, y) {
545+ qtest_fail("no item given", 1);
472 if (typeof touchIds !== "object") touchIds = [0];
547 if (typeof touchIds !== "object") touchIds = [0];
473 if (typeof x !== "number") x = item.width / 2;
548 if (typeof x !== "number") x = item.width / 2;
474 if (typeof y !== "number") y = item.height / 2;
549 if (typeof y !== "number") y = item.height / 2;
@@ -508,6 +583,8 @@ TestCase {
508 This effectively makes DirectionalDragAreas easier to fool.
583 This effectively makes DirectionalDragAreas easier to fool.
510 function removeTimeConstraintsFromDirectionalDragAreas(item) {
585 function removeTimeConstraintsFromDirectionalDragAreas(item) {
587+ qtest_fail("no item given", 1);
512 // use duck-typing to identify a DirectionalDragArea
589 // use duck-typing to identify a DirectionalDragArea
513 if (item.removeTimeConstraints != undefined) {
590 if (item.removeTimeConstraints != undefined) {