~saviq/unity8/build-arm64

« back to all changes in this revision

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

  • Committer: Michał Sawicz
  • Date: 2016-07-15 09:51:02 UTC
  • mfrom: (2400.1.142 unity8)
  • Revision ID: michal.sawicz@canonical.com-20160715095102-hf5ac4iqnfn1itpw
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
        function loadScopes() {
71
71
            scopeLoadedSpy.clear();
72
72
            scopesModel.load();
73
 
            tryCompare(scopeLoadedSpy, "count", 6, 15000);
 
73
            tryCompare(scopeLoadedSpy, "count", 8, 15000);
74
74
            tryCompare(scopesModel, "loaded", true);
75
75
            tryCompareFunction(function() {
76
76
                var mockScope1Loader = findChild(shell, "scopeLoader0");
124
124
 
125
125
            loadScopes();
126
126
 
127
 
            compare(dashContentList.count, 6);
 
127
            compare(dashContentList.count, 8);
128
128
            verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count);
129
129
        }
130
130
 
215
215
            verify(pageHeader, "Could not find the scope page header.");
216
216
            var innerHeader = findChild(pageHeader, "innerPageHeader");
217
217
            verify(innerHeader, "Could not find the scope page header.");
218
 
            compare(innerHeader.config.title, scopesModel.getScope(data.index).name);
 
218
            compare(innerHeader.title, scopesModel.getScope(data.index).name);
219
219
        }
220
220
 
221
221
        function test_is_active_data() {
515
515
        }
516
516
 
517
517
        function test_navigationShowFilterPopup() {
518
 
            goToSecondLevel();
519
 
 
520
518
            var dashContentList = findChild(dashContent, "dashContentList");
 
519
            var pageHeader = findChild(dashContentList.currentItem, "scopePageHeader")
521
520
            var settingsButton = findChild(dashContentList.currentItem, "settingsButton");
 
521
            var searchButton = findChild(dashContentList.currentItem, "search_button");
 
522
            var cancelButton = findChild(dashContentList.currentItem, "cancelButton");
 
523
            var searchTextField = findChild(pageHeader, "searchTextField");
 
524
            var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel");
 
525
            var headerContainer = findChild(pageHeader, "headerContainer");
 
526
 
 
527
            // test that closing the filters popover without a search unfocuses and removes the navigation
 
528
            mouseClick(searchButton);
 
529
            tryCompare(peExtraPanel, "visible", true);
522
530
 
523
531
            var filtersPopover = findChild(shell, "filtersPopover")
524
532
            verify(!filtersPopover);
526
534
            mouseClick(settingsButton);
527
535
 
528
536
            filtersPopover = findChild(shell, "filtersPopover")
529
 
 
530
 
            verify(filtersPopover);
 
537
            verify(filtersPopover);
 
538
 
 
539
            mouseClick(shell, shell.width - 1, shell.height - 1);
 
540
 
 
541
            tryCompare(pageHeader.extraPanel, "visible", false);
 
542
            tryCompare(headerContainer, "showSearch", true);
 
543
            tryCompare(searchTextField, "focus", false);
 
544
 
 
545
            mouseClick(cancelButton);
 
546
            tryCompare(headerContainer, "showSearch", false);
 
547
            tryCompare(headerContainer, "contentY", headerContainer.height);
 
548
 
 
549
            // test within a navigation
 
550
            goToSecondLevel();
 
551
 
 
552
            filtersPopover = findChild(shell, "filtersPopover")
 
553
            verify(!filtersPopover);
 
554
 
 
555
            mouseClick(settingsButton);
 
556
 
 
557
            filtersPopover = findChild(shell, "filtersPopover")
 
558
            verify(filtersPopover);
 
559
 
 
560
            mouseClick(shell, shell.width - 1, shell.height - 1);
 
561
 
 
562
            tryCompare(pageHeader.extraPanel, "visible", false);
 
563
            tryCompare(headerContainer, "showSearch", true);
531
564
        }
532
565
 
533
566
        function test_primaryFilter() {
577
610
        }
578
611
 
579
612
        function test_noDelegateCreationDestructionOnMove() {
 
613
            // Go to scope 1 and back so that items are created
 
614
            // and so this test makes sense
 
615
            dashContent.setCurrentScopeAtIndex(1);
 
616
            waitForRendering(dashContent);
 
617
            dashContent.setCurrentScopeAtIndex(0);
 
618
 
580
619
            // Our cards are of type AbstractButton as defined in CardCreator.js
581
620
            // This gives also other things that are not cards but for our purpose it
582
621
            // does not matter
625
664
            tryCompareFunction(function() { return dashContentList.currentItem.item.scope.id == nextScopeId; }, true);
626
665
            compare(dashContentList.currentIndex, 0);
627
666
        }
 
667
 
 
668
        function test_extraPanel() {
 
669
            var dashContentList = findChild(dashContent, "dashContentList");
 
670
            var pageHeader = findChild(dashContentList.currentItem, "scopePageHeader")
 
671
            pageHeader.searchEntryEnabled = true;
 
672
            pageHeader.searchHistory.clear();
 
673
 
 
674
            pageHeader.searchHistory.addQuery("Search1");
 
675
            pageHeader.searchHistory.addQuery("Search2");
 
676
 
 
677
            pageHeader.triggerSearch();
 
678
            tryCompare(pageHeader.extraPanel, "visible", true);
 
679
 
 
680
            var searchTextField = findChild(pageHeader, "searchTextField");
 
681
            compare(searchTextField.focus, true);
 
682
 
 
683
            var recentSearches = findChild(pageHeader.extraPanel, "recentSearchesRepeater");
 
684
            verify(recentSearches, "Could not find recent searches");
 
685
 
 
686
            waitForRendering(recentSearches);
 
687
 
 
688
            mouseClick(recentSearches.itemAt(0));
 
689
            compare(pageHeader.searchQuery, "Search2");
 
690
            tryCompare(pageHeader.extraPanel, "visible", false);
 
691
            compare(searchTextField.focus, false);
 
692
        }
628
693
    }
629
694
}