on xenial help sign in
Add test
commit7b82497405a72822f1d1b741a542260825fd44ce authorAlbert Astals <albert.astals@canonical.com> dateWed 10 Dec 2014, 10:07 (12 years ago) parentb8e2605
3 files changed+42
tests/mocks/Unity/fake_scopes.cpp+12 tests/mocks/Unity/fake_scopes.h+1 tests/qmltests/Dash/tst_Dash.qml+29
tests/mocks/Unity/fake_scopes.cpp+12
@@ -88,6 +88,18 @@ void Scopes::clear()
8888 }
8989}
9090
91+void Scopes::clearFavorites()
92+{
93+ if (m_scopes.size() > 0) {
94+ beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
95+ Q_FOREACH(Scope *scope, m_scopes) {
96+ m_scopesOverview->setFavorite(scope, false);
97+ }
98+ m_scopes.clear();
99+ endRemoveRows();
100+ }
101+}
102+
91103void Scopes::load()
92104{
93105 timer.start();
tests/mocks/Unity/fake_scopes.h+1
@@ -46,6 +46,7 @@ public:
4646 Q_INVOKABLE void addScope(Scope* scope);
4747
4848 Q_INVOKABLE void clear();
49+ Q_INVOKABLE void clearFavorites();
4950 Q_INVOKABLE void load();
5051
5152 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
tests/qmltests/Dash/tst_Dash.qml+29
@@ -38,6 +38,10 @@ Item {
3838 anchors.fill: parent
3939 }
4040
41+ SignalSpy {
42+ id: spy
43+ }
44+
4145 UT.UnityTestCase {
4246 name: "Dash"
4347 when: windowShown
@@ -262,5 +266,30 @@ Item {
262266 currentScope.setSearchInProgress(false);
263267 tryCompare(processingIndicator, "visible", false);
264268 }
269+
270+ function test_manage_dash_store_no_favorites() {
271+ // Show the manage dash
272+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
273+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
274+ tryCompare(bottomEdgeController, "progress", 1);
275+
276+ // clear the favorite scopes
277+ scopes.clearFavorites();
278+ var dashContentList = findChild(dash, "dashContentList");
279+ tryCompare(dashContentList, "count", 0);
280+
281+ var scopesList = findChild(dash, "scopesList");
282+ spy.target = scopesList.scope;
283+ spy.signalName = "performQuery";
284+
285+ // Do a search
286+ var scopesListPageHeader = findChild(scopesList, "pageHeader");
287+ var searchButton = findChild(scopesListPageHeader, "store_header_button");
288+ mouseClick(searchButton, 0, 0);
289+
290+ spy.wait();
291+ compare(spy.signalArguments[0][0], "scope://com.canonical.scopes.clickstore");
292+ tryCompare(bottomEdgeController, "progress", 0);
293+ }
265294 }
266295}