177
178
// Find an object with the given name in the children tree of "obj"
178
function findChild(obj, objectName) {
179
function findChild(obj, objectName, timeout) {
180
181
qtest_fail("no obj given", 1);
182
return findChildIn(obj, "children", objectName);
183
return findChildInWithTimeout(obj, "children", objectName, timeout);
185
186
// Find an object with the given name in the children tree of "obj"
187
188
// Note: you should use findChild if you're not sure you need this
188
189
// as this tree is much bigger and might contain stuff that goes
189
190
// away randomly.
190
function findInvisibleChild(obj, objectName) {
192
qtest_fail("no obj given", 1);
194
return findChildIn(obj, "data", objectName);
191
function findInvisibleChild(obj, objectName, timeout) {
193
qtest_fail("no obj given", 1);
195
return findChildInWithTimeout(obj, "data", objectName, timeout);
198
// Find a child in the named property with timeout
199
function findChildInWithTimeout(obj, prop, objectName, timeout) {
201
qtest_fail("no obj given", 1);
204
if (timeout === undefined)
207
var child = findChildIn(obj, prop, objectName);
209
while (timeSpent < timeout && !child) {
212
child = findChildIn(obj, prop, objectName);
197
217
// Find a child in the named property
572
592
while (rootItem.parent != undefined) {
573
593
rootItem = rootItem.parent;
575
removeTimeConstraintsFromDirectionalDragAreas(rootItem);
595
removeTimeConstraintsFromSwipeAreas(rootItem);
579
599
In qmltests, sequences of touch events are sent all at once, unlike in "real life".
580
600
Also qmltests might run really slowly, e.g. when run from inside virtual machines.
581
601
Thus to remove a variable that qmltests cannot really control, namely time, this
582
function removes all constraints from DirectionalDragAreas that are sensible to
602
function removes all constraints from SwipeAreas that are sensible to
585
This effectively makes DirectionalDragAreas easier to fool.
605
This effectively makes SwipeAreas easier to fool.
587
function removeTimeConstraintsFromDirectionalDragAreas(item) {
607
function removeTimeConstraintsFromSwipeAreas(item) {
589
609
qtest_fail("no item given", 1);
591
// use duck-typing to identify a DirectionalDragArea
592
if (item.removeTimeConstraints != undefined) {
593
item.removeTimeConstraints();
611
if (UT.Util.isInstanceOf(item, "UCSwipeArea")) {
612
UbuntuTest.TestExtras.removeTimeConstraintsFromSwipeArea(item);
595
614
for (var i in item.children) {
596
removeTimeConstraintsFromDirectionalDragAreas(item.children[i]);
615
removeTimeConstraintsFromSwipeAreas(item.children[i]);