~mzanetti/unity8/fix-1648251

« back to all changes in this revision

Viewing changes to tests/qmltests/Dash/tst_Dash.qml

  • Committer: Michael Zanetti
  • Date: 2016-10-13 11:02:11 UTC
  • mfrom: (2525.1.132 unity8)
  • Revision ID: michael.zanetti@canonical.com-20161013110211-tj2gly2dxaqj5t2e
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
            var genericScopeView = dashContentList.currentItem;
77
77
            var categoryListView = findChild(genericScopeView, "categoryListView");
78
78
            tryCompareFunction(function() {
79
 
                var category = findChild(genericScopeView, categoryName);
 
79
                var category = findChild(genericScopeView, categoryName, 0 /* timeout */);
80
80
                if (category && category.y > 0 && category.y < genericScopeView.height) return true;
81
81
                touchFlick(genericScopeView, genericScopeView.width/2, units.gu(20),
82
82
                            genericScopeView.width/2, genericScopeView.y)
84
84
                return false;
85
85
            }, true);
86
86
 
87
 
            tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true);
 
87
            tryCompareFunction(function() { return findChild(genericScopeView, "delegate0", 0 /* timeout */) !== null; }, true);
88
88
            return findChild(genericScopeView, categoryName);
89
89
        }
90
90
 
94
94
            if (category === undefined) category = 0;
95
95
            if (delegate === undefined) delegate = 0;
96
96
            tryCompareFunction(function() {
97
 
                                    var cardGrid = findChild(genericScopeView, "dashCategory"+category);
 
97
                                    var cardGrid = findChild(genericScopeView, "dashCategory"+category, 0 /* timeout */);
98
98
                                    if (cardGrid != null) {
99
 
                                        var tile = findChild(cardGrid, "delegate"+delegate);
 
99
                                        var tile = findChild(cardGrid, "delegate"+delegate, 0 /* timeout */);
100
100
                                        return tile != null;
101
101
                                    }
102
102
                                    return false;
215
215
 
216
216
            // Click in first item
217
217
            var favScopesListCategoryList = findChild(findChild(dash, "scopesListCategoryfavorites"), "scopesListCategoryInnerList");
 
218
            tryCompareFunction(function() { return favScopesListCategoryList.currentItem !== null }, true);
 
219
            waitForRendering(favScopesListCategoryList.currentItem);
218
220
            mouseClick(favScopesListCategoryList.currentItem);
219
221
 
220
222
            // Make sure animation went back
409
411
            compare(dashContentList.currentItem.scopeId, "clickscope");
410
412
 
411
413
            // Move to second scope
412
 
            touchFlick(dash, dash.width / 2, units.gu(2), dash.width / 5, units.gu(2));
 
414
            mouseFlick(dash, dash.width / 2, units.gu(2), dash.width / 5, units.gu(2));
413
415
            tryCompare(dashContentList, "currentIndex", 1);
414
416
            compare(dashContentList.currentItem.scopeId, "MockScope1");
415
417
        }
473
475
            compare(dashContentList.currentItem.scopeId, "MockScope1");
474
476
 
475
477
            tryCompareFunction(function() {
476
 
                var cardGrid = findChild(dashContentList, "dashCategory0");
 
478
                var cardGrid = findChild(dashContentList, "dashCategory0", 0 /* timeout */);
477
479
                if (cardGrid != null) {
478
 
                    var tile = findChild(cardGrid, "delegate0");
 
480
                    var tile = findChild(cardGrid, "delegate0", 0 /* timeout */);
479
481
                    return tile != null;
480
482
                }
481
483
                return false;
520
522
            var categoryListView = findChild(dashTempScopeItem, "categoryListView");
521
523
            categoryListView.positionAtBeginning();
522
524
            tryCompareFunction(function() {
523
 
                                    var cardGrid = findChild(dashTempScopeItem, "dashCategory0");
 
525
                                    var cardGrid = findChild(dashTempScopeItem, "dashCategory0", 0 /* timeout */);
524
526
                                    if (cardGrid != null) {
525
 
                                        var tile = findChild(cardGrid, "delegate0");
 
527
                                        var tile = findChild(cardGrid, "delegate0", 0 /* timeout */);
526
528
                                        return tile != null;
527
529
                                    }
528
530
                                    return false;
631
633
            tryCompare(dashContent.currentScope, "id", "clickscope");
632
634
 
633
635
            scrollToCategory("dashCategorypredefined");
634
 
            var tile = getCategoryDelegate("predefined", 2);
635
 
            var proportionalShape = findChildsByType(tile, "UCProportionalShape");
636
 
            compare(proportionalShape.length, 1);
 
636
            tryCompareFunction(function() {
 
637
                    var tile = getCategoryDelegate("predefined", 2);
 
638
                    var proportionalShape = findChildsByType(tile, "UCProportionalShape");
 
639
                    return proportionalShape.length === 1;
 
640
                },
 
641
                true
 
642
            );
637
643
 
638
644
            dash.setCurrentScope("libertine-scope.ubuntu_libertine-scope");
639
645
            var dashContent = findChild(dash, "dashContent");
640
646
            tryCompare(dashContent.currentScope, "id", "libertine-scope.ubuntu_libertine-scope");
641
647
 
642
648
            scrollToCategory("dashCategory2");
643
 
            tile = getCategoryDelegate("2", 2);
644
 
            proportionalShape = findChildsByType(tile, "UCProportionalShape");
645
 
            compare(proportionalShape.length, 1);
 
649
            tryCompareFunction(function() {
 
650
                    var tile = getCategoryDelegate("2", 2);
 
651
                    var proportionalShape = findChildsByType(tile, "UCProportionalShape");
 
652
                    return proportionalShape.length === 1;
 
653
                },
 
654
                true
 
655
            );
646
656
        }
647
657
 
648
658
        function test_tempScopeItemXOnResize()