@@ -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
@@ -96,6 +64,7 @@ Item {
98 UT.UnityTestCase {
66 UT.UnityTestCase {
99 name: "DashContent"
68 name: "DashContent"
100 when: scopesModel.loaded
69 when: scopesModel.loaded
@@ -108,7 +77,6 @@ Item {
109 function cleanup() {
78 function cleanup() {
110 movementStartedSpy.clear();
79 movementStartedSpy.clear();
111− clear_scope_status();
112 dashContent.visible = true;
80 dashContent.visible = true;
114 var dashContentList = findChild(dashContent, "dashContentList");
82 var dashContentList = findChild(dashContent, "dashContentList");
@@ -149,29 +117,38 @@ Item {
149 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
117 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
152− function test_movement_started_signal() {
120+ function test_show_header_on_list_movement() {
153− dashContent.setCurrentScopeAtIndex(3, true, false);
155 var dashContentList = findChild(dashContent, "dashContentList");
121 var dashContentList = findChild(dashContent, "dashContentList");
156 verify(dashContentList != undefined)
122 verify(dashContentList != undefined)
123+ var categoryListView = findChild(dashContentList, "categoryListView");
124+ verify(categoryListView != undefined)
126+ waitForRendering(categoryListView);
158− dashContentList.movementStarted();
128+ categoryListView.contentY = units.gu(11);
129+ console.log("contentY", categoryListView.contentY);
160− compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
131+ var startX = dashContentList.width/2;
161− compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
132+ var startY = dashContentList.height/2;
162− compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
133+ 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.");
134+ 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() {
137+ function test_set_current_scope_reset() {
138+ var dashContentList = findChild(dashContent, "dashContentList");
139+ verify(dashContentList != undefined)
140+ var categoryListView = findChild(dashContentList, "categoryListView");
141+ verify(categoryListView != undefined)
143+ categoryListView.contentY = units.gu(10);
145+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
146+ compare(categoryListView.contentY, units.gu(10))
168− dashContent.setCurrentScopeAtIndex(3, true, false);
148+ dashContent.setCurrentScopeAtIndex(0, false, true);
170− dashContent.positionedAtBeginning();
150+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
171− compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
151+ 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
154 // This tests that setting the current scope index will end up at the correct index even if