File: testaboutdialog.cpp

package info (click to toggle)
antimicro 3.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,532 kB
  • sloc: cpp: 50,526; makefile: 59; xml: 9
file content (90 lines) | stat: -rw-r--r-- 2,872 bytes parent folder | download | duplicates (2)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* antimicrox Gamepad to KB+M event mapper
 * Copyright (C) 2015 Travis Nickles <nickles.travis@gmail.com>
 * Copyright (C) 2020 Jagoda Górska <juliagoda.pl@protonmail>
 * Copyright (C) 2020 Paweł Kotiuk <kotiuk@zohomail.eu>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program 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 General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "aboutdialog.h"

#include <QtTest/QtTest>
#include <QLabel>
#include <QTextBrowser>
#include <QPlainTextEdit>

class TestAboutDialog: public QObject
{
    Q_OBJECT

public:
    TestAboutDialog(QObject* parent = 0);

private slots:
    void testVersion();
    void infoTextBrowserEmpty();
    void changelogPlainEmpty();
    void textBrowserDevsEmpty();
    void licenseInfoEmpty();
    void creditsInfoEmpty();

private:
    AboutDialog aboutDialog;
};

TestAboutDialog::TestAboutDialog(QObject* parent) :
    QObject(parent),
    aboutDialog()
{
    QTestEventLoop::instance().enterLoop(1);
}

void TestAboutDialog::infoTextBrowserEmpty()
{
    QTextBrowser* infoTextBrowser = aboutDialog.findChild<QTextBrowser*>("infoTextBrowser");
    QVERIFY2(!infoTextBrowser->toPlainText().isEmpty(), "infoTextBrowser is empty");
}

void TestAboutDialog::changelogPlainEmpty()
{
    QPlainTextEdit* changelogText = aboutDialog.findChild<QPlainTextEdit*>("changelogText");
    QVERIFY2(!changelogText->toPlainText().isEmpty(), "changelogText is empty");
}

void TestAboutDialog::textBrowserDevsEmpty()
{
    QPlainTextEdit* developersInfo = aboutDialog.findChild<QPlainTextEdit*>("plainTextEdit");
    QVERIFY2(!developersInfo->toPlainText().isEmpty(), "plainTextEdit for info about developers is empty");
}

void TestAboutDialog::licenseInfoEmpty()
{
    QTextBrowser* licenseInfo = aboutDialog.findChild<QTextBrowser*>("textBrowser_2");
    QVERIFY2(!licenseInfo->toPlainText().isEmpty(), "textBrowser_2 about license information is empty");
}

void TestAboutDialog::creditsInfoEmpty()
{
    QTextBrowser* creditsInfo = aboutDialog.findChild<QTextBrowser*>("textBrowser");
    QVERIFY2(!creditsInfo->toPlainText().isEmpty(), "textBrowser about credits is empty");
}

void TestAboutDialog::testVersion()
{
    QLabel* versionLabel = aboutDialog.findChild<QLabel*>("versionLabel");
    QCOMPARE(versionLabel->text(), QString("2.25"));
}

QTEST_MAIN(TestAboutDialog)
#include "testaboutdialog.moc"