@@ -52,8 +52,11 @@ TestCase {
52 this.getCurrentTimeMs = function() {return this.currentTimeMs}
52 this.getCurrentTimeMs = function() {return this.currentTimeMs}
55− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
55+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
56 function mouseClick(item, x, y, button, modifiers, delay) {
56 function mouseClick(item, x, y, button, modifiers, delay) {
58+ qtest_fail("no item given", 1);
57 if (button === undefined)
60 if (button === undefined)
58 button = Qt.LeftButton;
61 button = Qt.LeftButton;
59 if (modifiers === undefined)
62 if (modifiers === undefined)
@@ -68,8 +71,11 @@ TestCase {
68 qtest_fail("window not shown", 2);
71 qtest_fail("window not shown", 2);
71− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
74+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
72 function mouseDoubleClick(item, x, y, button, modifiers, delay) {
75 function mouseDoubleClick(item, x, y, button, modifiers, delay) {
77+ qtest_fail("no item given", 1);
73 if (button === undefined)
79 if (button === undefined)
74 button = Qt.LeftButton;
80 button = Qt.LeftButton;
75 if (modifiers === undefined)
81 if (modifiers === undefined)
@@ -84,8 +90,11 @@ TestCase {
84 qtest_fail("window not shown", 2)
90 qtest_fail("window not shown", 2)
87− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
93+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
88 function mousePress(item, x, y, button, modifiers, delay) {
94 function mousePress(item, x, y, button, modifiers, delay) {
96+ qtest_fail("no item given", 1);
89 if (button === undefined)
98 if (button === undefined)
90 button = Qt.LeftButton;
99 button = Qt.LeftButton;
91 if (modifiers === undefined)
100 if (modifiers === undefined)
@@ -100,8 +109,11 @@ TestCase {
100 qtest_fail("window not shown", 2)
109 qtest_fail("window not shown", 2)
103− // TODO This function can be removed altogether once we use Qt 5.5 which has the same feature
112+ // TODO This function can be removed altogether once we use Qt 5.7 which has the same feature
104 function mouseRelease(item, x, y, button, modifiers, delay) {
113 function mouseRelease(item, x, y, button, modifiers, delay) {
115+ qtest_fail("no item given", 1);
105 if (button === undefined)
117 if (button === undefined)
106 button = Qt.LeftButton;
118 button = Qt.LeftButton;
107 if (modifiers === undefined)
119 if (modifiers === undefined)
@@ -123,6 +135,9 @@ TestCase {
123 // speed is in pixels/second
135 // speed is in pixels/second
124 function mouseFlick(item, x, y, toX, toY, pressMouse, releaseMouse,
136 function mouseFlick(item, x, y, toX, toY, pressMouse, releaseMouse,
125 speed, iterations) {
137 speed, iterations) {
139+ qtest_fail("no item given", 1);
126 pressMouse = ((pressMouse != null) ? pressMouse : true); // Default to true for pressMouse if not present
141 pressMouse = ((pressMouse != null) ? pressMouse : true); // Default to true for pressMouse if not present
127 releaseMouse = ((releaseMouse != null) ? releaseMouse : true); // Default to true for releaseMouse if not present
142 releaseMouse = ((releaseMouse != null) ? releaseMouse : true); // Default to true for releaseMouse if not present
@@ -161,6 +176,9 @@ TestCase {
162 // Find an object with the given name in the children tree of "obj"
177 // Find an object with the given name in the children tree of "obj"
163 function findChild(obj, objectName) {
178 function findChild(obj, objectName) {
180+ qtest_fail("no obj given", 1);
164 return findChildIn(obj, "children", objectName);
182 return findChildIn(obj, "children", objectName);
@@ -170,11 +188,17 @@ TestCase {
170 // as this tree is much bigger and might contain stuff that goes
188 // as this tree is much bigger and might contain stuff that goes
171 // away randomly.
189 // away randomly.
172 function findInvisibleChild(obj, objectName) {
190 function findInvisibleChild(obj, objectName) {
192+ qtest_fail("no obj given", 1);
173 return findChildIn(obj, "data", objectName);
194 return findChildIn(obj, "data", objectName);
176 // Find a child in the named property
197 // Find a child in the named property
177 function findChildIn(obj, prop, objectName) {
198 function findChildIn(obj, prop, objectName) {
200+ qtest_fail("no obj given", 1);
178 var childs = new Array(0);
202 var childs = new Array(0);
179 childs.push(obj)
203 childs.push(obj)
180 while (childs.length > 0) {
204 while (childs.length > 0) {
@@ -190,6 +214,9 @@ TestCase {
192 function findChildsByType(obj, typeName) {
216 function findChildsByType(obj, typeName) {
218+ qtest_fail("no obj given", 1);
193 var res = new Array(0);
220 var res = new Array(0);
194 for (var i in obj.children) {
221 for (var i in obj.children) {
195 var c = obj.children[i];
222 var c = obj.children[i];
@@ -237,6 +264,9 @@ TestCase {
239 function flickToYEnd(item) {
266 function flickToYEnd(item) {
268+ qtest_fail("no item given", 1);
240 var i = 0;
270 var i = 0;
241 var x = item.width / 2;
271 var x = item.width / 2;
242 var y = item.height - units.gu(1);
272 var y = item.height - units.gu(1);
@@ -256,6 +286,9 @@ TestCase {
257 // speed is in pixels/second
287 // speed is in pixels/second
258 function touchFlick(item, x, y, toX, toY, beginTouch, endTouch, speed, iterations) {
288 function touchFlick(item, x, y, toX, toY, beginTouch, endTouch, speed, iterations) {
290+ qtest_fail("no item given", 1);
259 // Make sure the item is rendered
292 // Make sure the item is rendered
260 waitForRendering(item);
293 waitForRendering(item);
@@ -315,10 +348,16 @@ TestCase {
315 // perform a drag in the given direction until the given condition is true
348 // perform a drag in the given direction until the given condition is true
316 // The condition is a function to be evaluated after every step
349 // The condition is a function to be evaluated after every step
317 function touchDragUntil(item, startX, startY, stepX, stepY, condition) {
350 function touchDragUntil(item, startX, startY, stepX, stepY, condition) {
352+ qtest_fail("no item given", 1);
318 multiTouchDragUntil([0], item, startX, startY, stepX, stepY, condition);
354 multiTouchDragUntil([0], item, startX, startY, stepX, stepY, condition);
321 function multiTouchDragUntil(touchIds, item, startX, startY, stepX, stepY, condition) {
357 function multiTouchDragUntil(touchIds, item, startX, startY, stepX, stepY, condition) {
359+ qtest_fail("no item given", 1);
322 var root = fetchRootItem(item);
361 var root = fetchRootItem(item);
323 var pos = item.mapToItem(root, startX, startY);
362 var pos = item.mapToItem(root, startX, startY);
@@ -363,9 +402,17 @@ TestCase {
363 event.commit()
402 event.commit()
366− function touchMove(item, tox, toy) { multiTouchMove(0, item, tox, toy); }
405+ function touchMove(item, tox, toy) {
407+ qtest_fail("no item given", 1);
409+ multiTouchMove(0, item, tox, toy);
368 function multiTouchMove(touchId, item, tox, toy) {
412 function multiTouchMove(touchId, item, tox, toy) {
414+ qtest_fail("no item given", 1);
369 if (typeof touchId !== "number") touchId = 0;
416 if (typeof touchId !== "number") touchId = 0;
370 var root = fetchRootItem(item)
417 var root = fetchRootItem(item)
371 var rootPoint = item.mapToItem(root, tox, toy)
418 var rootPoint = item.mapToItem(root, tox, toy)
@@ -376,6 +423,9 @@ TestCase {
378 function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {
425 function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {
427+ qtest_fail("no item given", 1);
379 // Make sure the item is rendered
429 // Make sure the item is rendered
380 waitForRendering(item);
430 waitForRendering(item);
@@ -402,13 +452,21 @@ TestCase {
404 function fetchRootItem(item) {
454 function fetchRootItem(item) {
456+ qtest_fail("no item given", 1);
405 if (item.parent)
458 if (item.parent)
406 return fetchRootItem(item.parent)
459 return fetchRootItem(item.parent)
408 return item
461 return item
411− function touchPress(item, x, y) { multiTouchPress(0, item, x, y, []); }
464+ function touchPress(item, x, y) {
466+ qtest_fail("no item given", 1);
468+ multiTouchPress(0, item, x, y, []);
413 /*! \brief Release a touch point
471 /*! \brief Release a touch point
@@ -419,6 +477,9 @@ TestCase {
419 \param stationaryPoints An array of touchIds which are "already touched"
477 \param stationaryPoints An array of touchIds which are "already touched"
421 function multiTouchPress(touchId, item, x, y, stationaryPoints) {
479 function multiTouchPress(touchId, item, x, y, stationaryPoints) {
481+ qtest_fail("no item given", 1);
422 if (typeof touchId !== "number") touchId = 0;
483 if (typeof touchId !== "number") touchId = 0;
423 if (typeof x !== "number") x = item.width / 2;
484 if (typeof x !== "number") x = item.width / 2;
424 if (typeof y !== "number") y = item.height / 2;
485 if (typeof y !== "number") y = item.height / 2;
@@ -434,7 +495,12 @@ TestCase {
434 event.commit()
495 event.commit()
437− function touchRelease(item, x, y) { multiTouchRelease(0, item, x, y, []); }
498+ function touchRelease(item, x, y) {
500+ qtest_fail("no item given", 1);
502+ multiTouchRelease(0, item, x, y, []);
439 /*! \brief Release a touch point
505 /*! \brief Release a touch point
@@ -445,6 +511,9 @@ TestCase {
445 \param stationaryPoints An array of touchIds which are "still touched"
511 \param stationaryPoints An array of touchIds which are "still touched"
447 function multiTouchRelease(touchId, item, x, y, stationaryPoints) {
513 function multiTouchRelease(touchId, item, x, y, stationaryPoints) {
515+ qtest_fail("no item given", 1);
448 if (typeof touchId !== "number") touchId = 0;
517 if (typeof touchId !== "number") touchId = 0;
449 if (typeof x !== "number") x = item.width / 2;
518 if (typeof x !== "number") x = item.width / 2;
450 if (typeof y !== "number") y = item.height / 2;
519 if (typeof y !== "number") y = item.height / 2;
@@ -467,10 +536,16 @@ TestCase {
467 \param y The y coordinate of the tap, defaults to vertical center
536 \param y The y coordinate of the tap, defaults to vertical center
469 function tap(item, x, y) {
538 function tap(item, x, y) {
540+ qtest_fail("no item given", 1);
470 multiTouchTap([0], item, x, y);
542 multiTouchTap([0], item, x, y);
473 function multiTouchTap(touchIds, item, x, y) {
545 function multiTouchTap(touchIds, item, x, y) {
547+ qtest_fail("no item given", 1);
474 if (typeof touchIds !== "object") touchIds = [0];
549 if (typeof touchIds !== "object") touchIds = [0];
475 if (typeof x !== "number") x = item.width / 2;
550 if (typeof x !== "number") x = item.width / 2;
476 if (typeof y !== "number") y = item.height / 2;
551 if (typeof y !== "number") y = item.height / 2;
@@ -510,6 +585,8 @@ TestCase {
510 This effectively makes DirectionalDragAreas easier to fool.
585 This effectively makes DirectionalDragAreas easier to fool.
512 function removeTimeConstraintsFromDirectionalDragAreas(item) {
587 function removeTimeConstraintsFromDirectionalDragAreas(item) {
589+ qtest_fail("no item given", 1);
514 // use duck-typing to identify a DirectionalDragArea
591 // use duck-typing to identify a DirectionalDragArea
515 if (item.removeTimeConstraints != undefined) {
592 if (item.removeTimeConstraints != undefined) {