on xenial help sign in
Make tests not crash and pass :)
commit40e762b758125cc033020ae60c792e27621a59f2 authorAlbert Astals <albert.astals@canonical.com> dateWed 16 Jul 2014, 12:30 (12 years ago) parentcf658af
3 files changed+6−4
tests/mocks/Unity/fake_scopes.cpp+1 tests/qmltests/Dash/tst_Dash.qml+1−1 tests/qmltests/Dash/tst_DashContent.qml+4−3
tests/mocks/Unity/fake_scopes.cpp+1
@@ -72,6 +72,7 @@ void Scopes::clear()
7272 endRemoveRows();
7373 }
7474 delete m_scopesOverview;
75+ m_scopesOverview = nullptr;
7576
7677 if (m_loaded) {
7778 m_loaded = false;
tests/qmltests/Dash/tst_Dash.qml+1−1
@@ -86,7 +86,7 @@ Item {
8686 tryCompare(dashContentList, "count", 0);
8787 scopes.load();
8888 tryCompare(scopes, "loaded", true);
89− tryCompare(dashContentList, "count", 3);
89+ tryCompare(dashContentList, "count", 6);
9090
9191 verify(dashContentList != undefined);
9292 tryCompare(dashContentList, "currentIndex", data.visualIndex);
tests/qmltests/Dash/tst_DashContent.qml+4−3
@@ -68,7 +68,7 @@ Item {
6868 function loadScopes() {
6969 scopeLoadedSpy.clear();
7070 scopesModel.load();
71− tryCompare(scopeLoadedSpy, "count", 4);
71+ tryCompare(scopeLoadedSpy, "count", 10);
7272 }
7373
7474 function init() {
@@ -111,7 +111,8 @@ Item {
111111
112112 loadScopes();
113113
114− verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
114+ compare(dashContentList.count, 10);
115+ verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count);
115116 }
116117
117118 function test_show_header_on_list_movement() {
@@ -164,7 +165,7 @@ Item {
164165
165166 // test greater than scope count.
166167 var currentScopeIndex = dashContent.currentIndex;
167− dashContent.setCurrentScopeAtIndex(8, true, false);
168+ dashContent.setCurrentScopeAtIndex(18, true, false);
168169 compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
169170 }
170171