@@ -288,7 +288,7 @@ Item {
288288 var dashNavigationButton = findChild(dashContentList.currentItem, "navigationButton");
289289 compare(dashNavigationButton.showList, false);
290290 waitForRendering(dashNavigationButton);
291− mouseClick(dashNavigationButton, dashNavigationButton.width / 2, dashNavigationButton.height / 2);
291+ mouseClick(dashNavigationButton);
292292 compare(dashNavigationButton.showList, true);
293293
294294 var navigationListView = findChild(dashNavigationButton, "navigationListView");
@@ -304,30 +304,30 @@ Item {
304304 compare(allButton.visible, false);
305305
306306 var navigation = findChild(dashNavigationButton, "navigation0child3");
307− mouseClick(navigation, 0, 0);
307+ mouseClick(navigation);
308308 compare(dashNavigationButton.showList, false);
309309 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle3");
310310 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
311311
312− mouseClick(dashNavigationButton, 0, 0);
312+ mouseClick(dashNavigationButton);
313313 compare(dashNavigationButton.showList, true);
314314 waitForRendering(navigationListView);
315315 waitForRendering(navigationListView.currentItem);
316316 compare(allButton.visible, true);
317317
318− mouseClick(allButton, 0, 0);
318+ mouseClick(allButton);
319319 compare(dashNavigationButton.showList, false);
320320 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "root");
321321 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
322322
323− mouseClick(dashNavigationButton, 0, 0);
323+ mouseClick(dashNavigationButton);
324324 compare(dashNavigationButton.showList, true);
325325 waitForRendering(navigationListView);
326326 waitForRendering(navigationListView.currentItem);
327327 compare(allButton.visible, false);
328328
329329 navigation = findChild(dashNavigationButton, "navigation0child2");
330− mouseClick(navigation, 0, 0);
330+ mouseClick(navigation);
331331 compare(dashNavigationButton.showList, true);
332332 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle2");
333333 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
@@ -340,12 +340,12 @@ Item {
340340
341341 tryCompare(navigationListView, "contentX", navigationList1.x);
342342 waitForRendering(navigationListView);
343− mouseClick(allButton, 0, 0);
343+ mouseClick(allButton);
344344 compare(dashNavigationButton.showList, false);
345345 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle2");
346346 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
347347
348− mouseClick(dashNavigationButton, 0, 0);
348+ mouseClick(dashNavigationButton);
349349 compare(dashNavigationButton.showList, true);
350350 waitForRendering(navigationListView);
351351 waitForRendering(navigationListView.currentItem);
@@ -354,47 +354,47 @@ Item {
354354
355355 tryCompare(navigationList1.navigation, "loaded", true);
356356 navigation = findChild(dashNavigationButton, "navigation1child2");
357− mouseClick(navigation, 0, 0);
357+ mouseClick(navigation);
358358 compare(dashNavigationButton.showList, false);
359359 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "childmiddle22");
360360 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
361361
362− mouseClick(dashNavigationButton, 0, 0);
362+ mouseClick(dashNavigationButton);
363363 compare(dashNavigationButton.showList, true);
364364 waitForRendering(navigationListView);
365365 waitForRendering(navigationListView.currentItem);
366366
367367 tryCompare(navigationList1.navigation, "loaded", true);
368368 navigation = findChild(dashNavigationButton, "navigation1child3");
369− mouseClick(navigation, 0, 0);
369+ mouseClick(navigation);
370370 compare(dashNavigationButton.showList, false);
371371 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "childmiddle23");
372372 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
373373
374− mouseClick(dashNavigationButton, 0, 0);
374+ mouseClick(dashNavigationButton);
375375 compare(dashNavigationButton.showList, true);
376376 waitForRendering(navigationListView);
377377 waitForRendering(navigationListView.currentItem);
378− mouseClick(backButton, 0, 0);
378+ mouseClick(backButton);
379379
380380 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "root");
381381 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
382382 compare(dashNavigationButton.showList, true);
383− mouseClick(dashNavigationButton, 0, 0);
383+ mouseClick(dashNavigationButton);
384384 compare(dashNavigationButton.showList, false);
385385
386− mouseClick(dashNavigationButton, 0, 0);
386+ mouseClick(dashNavigationButton);
387387 compare(dashNavigationButton.showList, true);
388388 tryCompare(navigationListView.currentItem.navigation, "loaded", true);
389389 navigation = findChild(dashNavigationButton, "navigation0child2");
390− mouseClick(navigation, 0, 0);
390+ mouseClick(navigation);
391391 compare(dashNavigationButton.showList, true);
392392 navigationList1 = findChild(dashNavigationButton, "navigation1");
393393 compare(navigationList1.navigation.loaded, false);
394394 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle2");
395395 allButton = findChild(navigationList1, "allButton");
396396 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle2");
397− mouseClick(allButton, 0, 0);
397+ mouseClick(allButton);
398398 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle2");
399399 }
400400
@@ -408,7 +408,7 @@ Item {
408408
409409 compare(dashNavigationButton.showList, false);
410410 waitForRendering(dashNavigationButton);
411− mouseClick(dashNavigationButton, 0, 0);
411+ mouseClick(dashNavigationButton);
412412 compare(dashNavigationButton.showList, true);
413413
414414 var navigationListView = findChild(dashNavigationButton, "navigationListView");
@@ -429,24 +429,24 @@ Item {
429429 compare(backButton.visible, false);
430430
431431 var navigation = findChild(dashNavigationButton, "navigation0child3");
432− mouseClick(navigation, 0, 0);
432+ mouseClick(navigation);
433433 compare(dashNavigationButton.showList, false);
434434 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "altrootChild3");
435435 tryCompare(navigationListView.currentItem.navigation, "navigationId", "altroot");
436436
437− mouseClick(dashNavigationButton, 0, 0);
437+ mouseClick(dashNavigationButton);
438438 compare(dashNavigationButton.showList, true);
439439 waitForRendering(navigationListView);
440440 waitForRendering(navigationListView.currentItem);
441441 compare(allButton.visible, false);
442442
443443 navigation = findChild(dashNavigationButton, "navigation0child2");
444− mouseClick(navigation, 0, 0);
444+ mouseClick(navigation);
445445 compare(dashNavigationButton.showList, false);
446446 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "altrootChild2");
447447 tryCompare(navigationListView.currentItem.navigation, "navigationId", "altroot");
448448
449− mouseClick(dashNavigationButton, 0, 0);
449+ mouseClick(dashNavigationButton);
450450 compare(dashNavigationButton.showList, true);
451451 waitForRendering(navigationListView);
452452 waitForRendering(navigationListView.currentItem);
@@ -454,7 +454,7 @@ Item {
454454
455455 compare(navigationListView.count, 1, "There should be no second-level navigation");
456456
457− mouseClick(dashNavigationButton, 0, 0);
457+ mouseClick(dashNavigationButton);
458458 compare(dashNavigationButton.showList, false);
459459 }
460460
@@ -474,7 +474,7 @@ Item {
474474 compare(dashNavigationButton.showList, false);
475475 compare(dashAltNavigationButton.showList, false);
476476
477− mouseClick(dashNavigation, 0, 0);
477+ mouseClick(dashAltNavigationButton);
478478 compare(dashNavigationButton.showList, false);
479479 compare(dashAltNavigationButton.showList, true);
480480
@@ -487,24 +487,45 @@ Item {
487487 var blackRect = findChild(dashNavigation, "blackRect");
488488 tryCompare(blackRect, "opacity", 0.5);
489489
490− mouseClick(dashNavigation, dashNavigationButton.x, 0);
490+ mouseClick(dashNavigationButton);
491491 compare(dashNavigationButton.showList, false);
492492 compare(dashAltNavigationButton.showList, false);
493493
494494 tryCompare(navigationListView, "visible", false);
495495
496− mouseClick(dashNavigation, dashNavigationButton.x, 0);
496+ mouseClick(dashNavigationButton);
497497 compare(dashNavigationButton.showList, true);
498498 compare(dashAltNavigationButton.showList, false);
499499
500500 navigationListView = findChild(dashNavigationButton, "navigationListView");
501501 tryCompare(navigationListView.currentItem.navigation, "loaded", true);
502502
503− mouseClick(dashNavigation, 0, 0);
503+ mouseClick(dashAltNavigationButton);
504504 compare(dashNavigationButton.showList, false);
505505 compare(dashAltNavigationButton.showList, false);
506506 }
507507
508+ function test_navigationsSwipeToNextScope() {
509+ var dashContentList = findChild(dashContent, "dashContentList");
510+ tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
511+ var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
512+ tryCompare(dashNavigation, "visible", true);
513+ var dashNavigationButton = findChild(dashContentList.currentItem, "altNavigationButton");
514+ verify(dashNavigationButton, "Can't find navigation button");
515+
516+ compare(dashNavigationButton.showList, false);
517+ waitForRendering(dashNavigationButton);
518+ mouseClick(dashNavigationButton, 0, 0);
519+ compare(dashNavigationButton.showList, true);
520+
521+ mouseFlick(dashNavigationButton, dashNavigationButton.width - units.gu(1), units.gu(1), units.gu(1), units.gu(1));
522+ compare(dashNavigationButton.showList, false);
523+
524+ var dashContentList = findChild(dashContent, "dashContentList");
525+ expectFail("", "should not change the parent list.");
526+ tryCompare(dashContentList, "currentIndex", 1);
527+ }
528+
508529 function test_searchHint() {
509530 var dashContentList = findChild(dashContent, "dashContentList");
510531 verify(dashContentList !== null);
@@ -516,5 +537,62 @@ Item {
516537
517538 compare(categoryListView.pageHeader.item.searchHint, "Search People");
518539 }
540+
541+ function compareArrays(a, b) {
542+ if (a.length != b.length) return false;
543+ for (var i in a) {
544+ if (a[i] != b[i]) return false;
545+ }
546+ return true;
547+ }
548+
549+ function getSettledButtons() {
550+ var buttons = findChildsByType(dashContent, "AbstractButton");
551+ wait(2500);
552+ var aux = findChildsByType(dashContent, "AbstractButton");
553+ while (!compareArrays(aux, buttons)) {
554+ buttons = aux;
555+ wait(2500);
556+ aux = findChildsByType(dashContent, "AbstractButton");
557+ }
558+ return buttons;
559+ }
560+
561+ function test_noDelegateCreationDestructionOnMove() {
562+ // Our cards are of type AbstractButton as defined in CardCreator.js
563+ // This gives also other things that are not cards but for our purpose it
564+ // does not matter
565+
566+ // Wait for the buttons to settle
567+ var buttons = getSettledButtons();
568+
569+ // Move the scopes so that the item on the right is the current one
570+ // without releasing the button
571+ mouseFlick(dashContent, dashContent.width - units.gu(1), units.gu(1), units.gu(1), units.gu(1), true, false);
572+
573+ // Make sure we have changed to a new scope
574+ compare(dashContent.currentIndex, 1);
575+
576+ // Wait for the buttons to settle
577+ var buttons2 = getSettledButtons();
578+
579+ // Verify we have exactly the same buttons as before starting to move
580+ verify(compareArrays(buttons2, buttons));
581+
582+ // Release the mouse
583+ mouseRelease(dashContent, units.gu(1), units.gu(1));
584+
585+ // Wait for the scopes list to stop moving
586+ var dashContentList = findChild(dashContent, "dashContentList");
587+ tryCompare(dashContentList, "moving", false);
588+ compare(dashContent.currentIndex, 1);
589+
590+ // Wait for the buttons to settle
591+ var buttons3 = getSettledButtons();
592+
593+ // Verify we have a different set of buttons now
594+ expectFail("", "There has to be new cards after releasing the list is not moving anymore");
595+ verify(compareArrays(buttons3, buttons));
596+ }
519597 }
520598}