Commit 3aec97bb authored by stef lep's avatar stef lep

fix open now playing

BUG: 425601
parent 35ffe0f6
......@@ -845,6 +845,61 @@ private Q_SLOTS:
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 0);
}
void openNowPlayingViewTest()
{
ViewManager viewManager;
ViewsListData viewsData;
viewManager.setViewsData(&viewsData);
QSignalSpy openGridViewSpy(&viewManager, &ViewManager::openGridView);
QSignalSpy openListViewSpy(&viewManager, &ViewManager::openListView);
QSignalSpy switchFilesBrowserViewSpy(&viewManager, &ViewManager::switchFilesBrowserView);
QSignalSpy switchContextViewSpy(&viewManager, &ViewManager::switchContextView);
QSignalSpy popOneViewSpy(&viewManager, &ViewManager::popOneView);
viewManager.openChildView({{DataTypes::TitleRole, QStringLiteral("album1")},
{DataTypes::ArtistRole, QStringLiteral("artist1")},
{DataTypes::DatabaseIdRole, 12},
{DataTypes::ElementTypeRole, ElisaUtils::Album}});
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(switchContextViewSpy.count(), 0);
QCOMPARE(openListViewSpy.count(), 0);
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 0);
QCOMPARE(openGridViewSpy.at(0).count(), 1);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewConfigurationData*>()->filterType(), ElisaUtils::NoFilter);
QCOMPARE(openGridViewSpy.at(0).at(0).value<ViewConfigurationData*>()->dataType(), ElisaUtils::Album);
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
QCOMPARE(switchContextViewSpy.count(), 0);
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 0);
QCOMPARE(openListViewSpy.at(0).count(), 1);
QCOMPARE(openListViewSpy.at(0).at(0).value<ViewConfigurationData*>()->dataFilter()[DataTypes::TitleRole].toString(), QStringLiteral("album1"));
QCOMPARE(openListViewSpy.at(0).at(0).value<ViewConfigurationData*>()->dataFilter()[DataTypes::ArtistRole].toString(), QStringLiteral("artist1"));
viewManager.viewIsLoaded();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
QCOMPARE(switchContextViewSpy.count(), 0);
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 0);
viewManager.openNowPlaying();
QCOMPARE(openGridViewSpy.count(), 1);
QCOMPARE(openListViewSpy.count(), 1);
QCOMPARE(switchContextViewSpy.count(), 1);
QCOMPARE(switchFilesBrowserViewSpy.count(), 0);
QCOMPARE(popOneViewSpy.count(), 0);
}
};
QTEST_GUILESS_MAIN(ViewManagerTests)
......
......@@ -33,7 +33,7 @@ RowLayout {
}
function openNowPlaying() {
viewManager.closeAllViews();
viewManager.openNowPlaying();
}
ViewManager {
......
......@@ -227,6 +227,11 @@ void ViewManager::openArtistView(const QString &artist)
}
}
void ViewManager::openNowPlaying()
{
openView(0);
}
void ViewManager::viewIsLoaded()
{
qCDebug(orgKdeElisaViews()) << "ViewManager::viewIsLoaded" << d->mViewParametersStack.size()
......
......@@ -128,6 +128,8 @@ public Q_SLOTS:
void openArtistView(const QString &artist);
void openNowPlaying();
void viewIsLoaded();
void goBack();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment