@@ -35,13 +35,6 @@ Item {
3535 property var panel: null
3636 // BEGIN To reduce warnings
3737
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 }
43− }
44−
4538 Scopes {
4639 id: scopesModel
4740 }
@@ -55,34 +48,9 @@ Item {
5548 }
5649 scopes : scopesModel
5750
58− scopeMapper : scopeDelegateMapper
5951 searchHistory: SearchHistoryModel {}
6052 }
6153
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"),
68− }
69− genericScope: Qt.resolvedUrl("qml/fake_generic_scopeView.qml")
70− }
71−
72− function clear_scope_status() {
73− scopeStatus["MockScope1"].movementStarted = 0;
74− scopeStatus["MockScope1"].positionedAtBeginning = 0;
75−
76− scopeStatus["MockScope2"].movementStarted = 0;
77− scopeStatus["MockScope2"].positionedAtBeginning = 0;
78−
79− scopeStatus["clickscope"].movementStarted = 0;
80− scopeStatus["clickscope"].positionedAtBeginning = 0;
81−
82− scopeStatus["MockScope5"].movementStarted = 0;
83− scopeStatus["MockScope5"].positionedAtBeginning = 0;
84− }
85−
8654 SignalSpy {
8755 id: scopeLoadedSpy
8856 target: dashContent
@@ -96,6 +64,7 @@ Item {
9664 }
9765
9866 UT.UnityTestCase {
67+ id: testCase
9968 name: "DashContent"
10069 when: scopesModel.loaded
10170
@@ -108,7 +77,6 @@ Item {
10877
10978 function cleanup() {
11079 movementStartedSpy.clear();
111− clear_scope_status();
11280 dashContent.visible = true;
11381
11482 var dashContentList = findChild(dashContent, "dashContentList");
@@ -149,29 +117,38 @@ Item {
149117 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
150118 }
151119
152− function test_movement_started_signal() {
153− dashContent.setCurrentScopeAtIndex(3, true, false);
154−
120+ function test_show_header_on_list_movement() {
155121 var dashContentList = findChild(dashContent, "dashContentList");
156122 verify(dashContentList != undefined)
123+ var categoryListView = findChild(dashContentList, "categoryListView");
124+ verify(categoryListView != undefined)
125+
126+ waitForRendering(categoryListView);
157127
158− dashContentList.movementStarted();
128+ categoryListView.contentY = units.gu(11);
129+ console.log("contentY", categoryListView.contentY);
159130
160− compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
161− compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
162− compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
163− compare(scopeStatus["clickscope"].movementStarted, 1, "clickscope should have emitted movementStarted signal when content list did.");
164− compare(scopeStatus["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
131+ var startX = dashContentList.width/2;
132+ var startY = dashContentList.height/2;
133+ touchFlick(dashContentList, startX - units.gu(2), startY, startX, startY);
134+ tryCompare(categoryListView, "contentY", units.gu(11) - categoryListView.pageHeader.height)
165135 }
166136
167− function test_positioned_at_beginning_signal() {
168− dashContent.setCurrentScopeAtIndex(3, true, false);
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)
142+
143+ categoryListView.contentY = units.gu(10);
144+
145+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
146+ compare(categoryListView.contentY, units.gu(10))
147+
148+ dashContent.setCurrentScopeAtIndex(0, false, true);
169149
170− dashContent.positionedAtBeginning();
171− compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
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.");
150+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
151+ compare(categoryListView.contentY, 0)
175152 }
176153
177154 // This tests that setting the current scope index will end up at the correct index even if