on xenial help sign in
Make sure that unfavoriting a scope gives us the next one

This is currently broken due to a regression in the Qt Quick ListView

commit2c20ff6365643a202d66cbf838c98a01c5ee34be authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 11 Nov 2015, 09:53 (11 years ago) parent86d0a35c2d2c2f
2 files changed+17
tests/mocks/Unity/fake_scopes.cpp+3 tests/qmltests/Dash/tst_DashContent.qml+14
tests/mocks/Unity/fake_scopes.cpp+3
@@ -260,6 +260,9 @@ void Scopes::addScope(Scope* scope)
260260 beginInsertRows(QModelIndex(), index, index);
261261 m_scopes.append(scope);
262262 endInsertRows();
263+ connect(scope, &Scope::favoriteChanged, [this, scope]{
264+ setFavorite(scope->id(), scope->favorite());
265+ });
263266 }
264267 m_allScopes.append(scope);
265268}
tests/qmltests/Dash/tst_DashContent.qml+14
@@ -599,5 +599,19 @@ Item {
599599 expectFail("", "There has to be new cards after releasing the list is not moving anymore");
600600 verify(compareArrays(buttons3, buttons));
601601 }
602+
603+ function test_unfavoriteScope()
604+ {
605+ var dashContentList = findChild(dashContent, "dashContentList");
606+ var header = findChild(dashContentList.currentItem, "scopePageHeader")
607+ var favoriteAction = findChild(header, "favorite_action_button");
608+ compare(dashContentList.currentIndex, 0);
609+ compare(dashContentList.indexAt(dashContentList.width * 1.5, 0), 1);
610+ var nextScopeId = dashContentList.itemAt(dashContentList.width * 1.5, 0).item.scope.id;
611+ mouseClick(favoriteAction);
612+ expectFail("", "QTBUG-49330 makes this fail.");
613+ tryCompareFunction(function() { return dashContentList.currentItem.item.scope.id == nextScopeId; }, true);
614+ compare(dashContentList.currentIndex, 0);
615+ }
602616 }
603617}