~mterry/unity8/power-button-on-lock

« back to all changes in this revision

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

  • Committer: Michael Terry
  • Date: 2014-11-24 15:25:42 UTC
  • mfrom: (1368.1.82 unity8)
  • Revision ID: michael.terry@canonical.com-20141124152542-5cysva8ds3qfula6
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    Dash {
37
37
        id: dash
38
38
        anchors.fill: parent
39
 
        showScopeOnLoaded: "MockScope2"
40
39
    }
41
40
 
42
41
    UT.UnityTestCase {
57
56
            tryCompare(dashContentList, "count", 6);
58
57
            tryCompare(scopes, "loaded", true);
59
58
            tryCompareFunction(function() {
60
 
                var mockScope1Loader = findChild(dash, "MockScope1 loader");
 
59
                var mockScope1Loader = findChild(dash, "scopeLoader0");
61
60
                return mockScope1Loader && mockScope1Loader.item != null; },
62
61
                true, 15000);
63
62
            tryCompareFunction(function() {
64
 
                var mockScope1Loader = findChild(dash, "MockScope1 loader");
 
63
                var mockScope1Loader = findChild(dash, "scopeLoader0");
65
64
                return mockScope1Loader && mockScope1Loader.status === Loader.Ready; },
66
65
                true, 15000);
67
 
            waitForRendering(findChild(dash, "MockScope1 loader").item);
 
66
            waitForRendering(findChild(dash, "scopeLoader0").item);
68
67
        }
69
68
 
70
69
        function get_scope_data() {
80
79
            return get_scope_data()
81
80
        }
82
81
 
83
 
        function test_show_scope_on_load(data) {
84
 
            var dashContentList = findChild(dash, "dashContentList");
85
 
 
86
 
            dash.showScopeOnLoaded = data.tag
87
 
            scopes.clear();
88
 
            tryCompare(dashContentList, "count", 0);
89
 
            scopes.load();
90
 
            tryCompare(scopes, "loaded", true);
91
 
            tryCompare(dashContentList, "count", 6);
92
 
 
93
 
            verify(dashContentList != undefined);
94
 
            if (data.visualIndex == -1) {
95
 
                tryCompare(dashContentList, "currentIndex", 0);
96
 
                expectFail(data.tag, "non favorite scopes should not be visble in the scopes model");
97
 
                compare(dashContentList.currentItem.scopeId, data.tag); // this should fail
98
 
            } else {
99
 
                tryCompare(dashContentList, "currentIndex", data.visualIndex);
100
 
                compare(dashContentList.currentItem.scopeId, data.tag);
101
 
            }
102
 
        }
103
 
 
104
82
        function test_dash_overview_show_select_same_favorite() {
105
83
            // Show the overview
106
84
            touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, dash.height - units.gu(18));
314
292
            mouseFlick(dash, startX, startY, stopX, stopY);
315
293
            compare(dashContentList.currentIndex, 2, "Could not flick to scope id 2");
316
294
            var dashCommunicatorService = findInvisibleChild(dash, "dashCommunicatorService");
317
 
            dashCommunicatorService.mockSetCurrentScope("clickscope", true, false);
 
295
            dashCommunicatorService.mockSetCurrentScope(0, true, false);
 
296
            tryCompare(dashContentList, "currentIndex", 0)
 
297
            dashCommunicatorService.mockSetCurrentScope(1, true, false);
318
298
            tryCompare(dashContentList, "currentIndex", 1)
319
299
        }
320
300