on xenial help sign in
Make sure that unfavoriting a scope gives us the next one
2c20ff6Albert Astals Cid
tests/mocks/Unity/fake_scopes.cpp+3
@@ -260,6 +260,9 @@ void Scopes::addScope(Scope* scope)
260 beginInsertRows(QModelIndex(), index, index);
260 beginInsertRows(QModelIndex(), index, index);
261 m_scopes.append(scope);
261 m_scopes.append(scope);
262 endInsertRows();
262 endInsertRows();
263+ connect(scope, &Scope::favoriteChanged, [this, scope]{
264+ setFavorite(scope->id(), scope->favorite());
265+ });
263 }
266 }
264 m_allScopes.append(scope);
267 m_allScopes.append(scope);
265}
268}
tests/qmltests/Dash/tst_DashContent.qml+14
@@ -599,5 +599,19 @@ Item {
599 expectFail("", "There has to be new cards after releasing the list is not moving anymore");
599 expectFail("", "There has to be new cards after releasing the list is not moving anymore");
600 verify(compareArrays(buttons3, buttons));
600 verify(compareArrays(buttons3, buttons));
601 }
601 }
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+ }
602 }
616 }
603}
617}