@@ -35,13 +35,6 @@ Item {
35 property var panel: null
35 property var panel: null
36 // BEGIN To reduce warnings
36 // BEGIN To reduce warnings
38− property var scopeStatus: {
39− 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
40− 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
41− 'clickscope': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
42− 'MockScope5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
46 id: scopesModel
39 id: scopesModel
@@ -55,34 +48,9 @@ Item {
56 scopes : scopesModel
49 scopes : scopesModel
58− scopeMapper : scopeDelegateMapper
59 searchHistory: SearchHistoryModel {}
51 searchHistory: SearchHistoryModel {}
62− ScopeDelegateMapper {
63− id: scopeDelegateMapper
64− scopeDelegateMapping: {
65− "MockScope1": Qt.resolvedUrl("qml/fake_scopeView1.qml"),
66− "MockScope2": Qt.resolvedUrl("qml/fake_scopeView2.qml"),
67− "clickscope": Qt.resolvedUrl("qml/fake_scopeView3.qml"),
69− genericScope: Qt.resolvedUrl("qml/fake_generic_scopeView.qml")
72− function clear_scope_status() {
73− scopeStatus["MockScope1"].movementStarted = 0;
74− scopeStatus["MockScope1"].positionedAtBeginning = 0;
76− scopeStatus["MockScope2"].movementStarted = 0;
77− scopeStatus["MockScope2"].positionedAtBeginning = 0;
79− scopeStatus["clickscope"].movementStarted = 0;
80− scopeStatus["clickscope"].positionedAtBeginning = 0;
82− scopeStatus["MockScope5"].movementStarted = 0;
83− scopeStatus["MockScope5"].positionedAtBeginning = 0;
86 SignalSpy {
54 SignalSpy {
87 id: scopeLoadedSpy
55 id: scopeLoadedSpy
88 target: dashContent
56 target: dashContent
@@ -108,7 +76,6 @@ Item {
109 function cleanup() {
77 function cleanup() {
110 movementStartedSpy.clear();
78 movementStartedSpy.clear();
111− clear_scope_status();
112 dashContent.visible = true;
79 dashContent.visible = true;
114 var dashContentList = findChild(dashContent, "dashContentList");
81 var dashContentList = findChild(dashContent, "dashContentList");
@@ -149,29 +116,38 @@ Item {
149 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
116 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
152− function test_movement_started_signal() {
119+ function test_show_header_on_list_movement() {
153− dashContent.setCurrentScopeAtIndex(3, true, false);
155 var dashContentList = findChild(dashContent, "dashContentList");
120 var dashContentList = findChild(dashContent, "dashContentList");
156− verify(dashContentList != undefined)
121+ verify(dashContentList != undefined);
122+ var categoryListView = findChild(dashContentList, "categoryListView");
123+ verify(categoryListView != undefined);
125+ waitForRendering(categoryListView);
158− dashContentList.movementStarted();
127+ categoryListView.contentY = units.gu(11);
128+ console.log("contentY", categoryListView.contentY);
160− compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
130+ var startX = dashContentList.width/2;
161− compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
131+ var startY = dashContentList.height/2;
162− compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
132+ touchFlick(dashContentList, startX - units.gu(2), startY, startX, startY);
163− compare(scopeStatus["clickscope"].movementStarted, 1, "clickscope should have emitted movementStarted signal when content list did.");
133+ tryCompare(categoryListView, "contentY", units.gu(11) - categoryListView.pageHeader.height);
164− compare(scopeStatus["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
167− function test_positioned_at_beginning_signal() {
136+ function test_set_current_scope_reset() {
137+ var dashContentList = findChild(dashContent, "dashContentList");
138+ verify(dashContentList != undefined);
139+ var categoryListView = findChild(dashContentList, "categoryListView");
140+ verify(categoryListView != undefined);
142+ categoryListView.contentY = units.gu(10);
144+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
145+ compare(categoryListView.contentY, units.gu(10));
168− dashContent.setCurrentScopeAtIndex(3, true, false);
147+ dashContent.setCurrentScopeAtIndex(0, false, true);
170− dashContent.positionedAtBeginning();
149+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
171− compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
150+ compare(categoryListView.contentY, 0);
172− compare(scopeStatus["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
173− compare(scopeStatus["clickscope"].positionedAtBeginning, 1, "clickscope should have emitted positionedAtBeginning signal when DashContent did.");
174− compare(scopeStatus["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
177 // This tests that setting the current scope index will end up at the correct index even if
153 // This tests that setting the current scope index will end up at the correct index even if