File indexing completed on 2024-05-12 16:23:40

0001 /*
0002  *  SPDX-FileCopyrightText: 2019 Jonah BrĂ¼chert <jbb@kaidan.im>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  */
0006 
0007 #include <QtTest/QTest>
0008 
0009 #include <QSignalSpy>
0010 #include <QUrl>
0011 #include <QStandardPaths>
0012 
0013 #include "browsermanager.h"
0014 #include "urlutils.h"
0015 #include "angelfishsettings.h"
0016 
0017 class UserAgentTest : public QObject
0018 {
0019     Q_OBJECT
0020 
0021 private Q_SLOTS:
0022 
0023     void initTestCase()
0024     {
0025         QCoreApplication::setOrganizationName(QStringLiteral("autotests"));
0026         QCoreApplication::setApplicationName(QStringLiteral("angelfish_dbmanagertest"));
0027         QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
0028         dir.mkpath(QStringLiteral("."));
0029 
0030         m_browserManager = BrowserManager::instance();
0031     }
0032 
0033     void cleanupTestCase()
0034     {
0035         delete m_browserManager;
0036     }
0037 
0038     void urlFromUserInput()
0039     {
0040         const QString incompleteUrl = QStringLiteral("kde.org");
0041         const QString completeUrl = QStringLiteral("http://kde.org");
0042 
0043         QCOMPARE(UrlUtils::urlFromUserInput(incompleteUrl), completeUrl);
0044     }
0045 private:
0046     BrowserManager *m_browserManager;
0047 };
0048 
0049 QTEST_GUILESS_MAIN(UserAgentTest);
0050 
0051 #include "browsermanagertest.moc"