diff --git a/autotests/browsermanagertest.cpp b/autotests/browsermanagertest.cpp index 3567927..3e5a37e 100644 --- a/autotests/browsermanagertest.cpp +++ b/autotests/browsermanagertest.cpp @@ -1,73 +1,78 @@ /* * Copyright 2019 Jonah BrĂ¼chert * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License version 2 as published by the Free Software Foundation; * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include #include #include #include "browsermanager.h" #include "urlutils.h" class UserAgentTest : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase() { + QCoreApplication::setOrganizationName("autotests"); + QCoreApplication::setApplicationName("angelfish_dbmanagertest"); + QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); + dir.mkpath("."); + m_browserManager = BrowserManager::instance(); } void cleanupTestCase() { delete m_browserManager; } void homepage() { const QString newHomepage = QStringLiteral("https://kde.org"); m_browserManager->setHomepage(newHomepage); QCOMPARE(m_browserManager->homepage(), newHomepage); } void searchEngine() { const QString newSearchEngineUrl = QStringLiteral("https://search.angelfish.kde?q="); m_browserManager->setSearchBaseUrl(newSearchEngineUrl); QCOMPARE(m_browserManager->searchBaseUrl(), newSearchEngineUrl); } void urlFromUserInput() { const QString incompleteUrl = QStringLiteral("kde.org"); const QString completeUrl = QStringLiteral("http://kde.org"); QCOMPARE(UrlUtils::urlFromUserInput(incompleteUrl), completeUrl); } private: BrowserManager *m_browserManager; }; QTEST_MAIN(UserAgentTest); #include "browsermanagertest.moc"