Commit de9588fc authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Better organize bookmarks runner tests

parent a8ec9541
......@@ -62,5 +62,5 @@ install(TARGETS krunner_bookmarksrunner DESTINATION "${KDE_INSTALL_PLUGINDIR}/kf
# Currently tests include only chrome, so no need to get include them if json is not found
if(BUILD_TESTING)
add_subdirectory(tests)
add_subdirectory(autotests)
endif()
include(ECMAddTests)
ecm_add_test(testchromebookmarks.cpp TEST_NAME testChromeBookmarks
ecm_add_test(chrome/testchromebookmarks.cpp TEST_NAME testChromeBookmarks
LINK_LIBRARIES Qt::Test krunner_bookmarks_test
)
file(COPY chrome-config-home DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY chrome/chrome-config-home DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/chrome/)
......@@ -29,14 +29,15 @@ using namespace Plasma;
void TestChromeBookmarks::initTestCase()
{
m_configHome = QFINDTESTDATA("chrome-config-home");
m_findBookmarksInCurrentDirectory.reset(
new FakeFindProfile(QList<Profile>({Profile("chrome-config-home/Chrome-Bookmarks-Sample.json", "Sample", new FallbackFavicon())})));
new FakeFindProfile(QList<Profile>({Profile(m_configHome + "/Chrome-Bookmarks-Sample.json", "Sample", new FallbackFavicon())})));
}
void TestChromeBookmarks::bookmarkFinderShouldFindEachProfileDirectory()
{
FindChromeProfile findChrome("chromium", "./chrome-config-home");
QString profileTemplate = QStringLiteral("./chrome-config-home/.config/%1/%2/Bookmarks");
FindChromeProfile findChrome("chromium", m_configHome);
QString profileTemplate = m_configHome + "/.config/%1/%2/Bookmarks";
QList<Profile> profiles = findChrome.find();
QCOMPARE(profiles.size(), 2);
......@@ -107,8 +108,8 @@ void TestChromeBookmarks::itShouldClearResultAfterCallingTeardown()
void TestChromeBookmarks::itShouldFindBookmarksFromAllProfiles()
{
FakeFindProfile findBookmarksFromAllProfiles(
QList<Profile>() << Profile("chrome-config-home/Chrome-Bookmarks-Sample.json", "Sample", new FallbackFavicon(this))
<< Profile("chrome-config-home/Chrome-Bookmarks-SecondProfile.json", "SecondProfile", new FallbackFavicon(this)));
QList<Profile>() << Profile(m_configHome + "/Chrome-Bookmarks-Sample.json", "Sample", new FallbackFavicon(this))
<< Profile(m_configHome + "/Chrome-Bookmarks-SecondProfile.json", "SecondProfile", new FallbackFavicon(this)));
Chrome *chrome = new Chrome(&findBookmarksFromAllProfiles, this);
chrome->prepare();
QList<BookmarkMatch> matches = chrome->match("any", true);
......
......@@ -61,6 +61,7 @@ private Q_SLOTS:
private:
QScopedPointer<FakeFindProfile> m_findBookmarksInCurrentDirectory;
QString m_configHome;
};
#endif // TESTCHROMEBOOKMARKS_H
Supports Markdown
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