1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
/*
* SPDX-FileCopyrightText: 2019 Jonah BrĂ¼chert <jbb@kaidan.im>
*
* SPDX-License-Identifier: LGPL-2.0-only
*/
#include <QtTest/QTest>
#include <QSignalSpy>
#include <QUrl>
#include <QStandardPaths>
#include "browsermanager.h"
#include "urlutils.h"
#include "angelfishsettings.h"
class UserAgentTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase()
{
QCoreApplication::setOrganizationName(QStringLiteral("autotests"));
QCoreApplication::setApplicationName(QStringLiteral("angelfish_dbmanagertest"));
QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
dir.mkpath(QStringLiteral("."));
m_browserManager = BrowserManager::instance();
}
void cleanupTestCase()
{
delete m_browserManager;
}
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_GUILESS_MAIN(UserAgentTest);
#include "browsermanagertest.moc"
|