File: browsermanagertest.cpp

package info (click to toggle)
angelfish 25.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,780 kB
  • sloc: cpp: 2,751; xml: 907; javascript: 273; makefile: 16; sh: 11; sql: 7
file content (51 lines) | stat: -rw-r--r-- 1,195 bytes parent folder | download | duplicates (3)
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"