File indexing completed on 2024-10-27 04:50:59

0001 /*
0002    SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "incorrectidentityfolderwarningtest.h"
0008 #include "../incorrectidentityfolderwarning.h"
0009 #include <QHBoxLayout>
0010 #include <QTest>
0011 QTEST_MAIN(IncorrectIdentityFolderWarningTest)
0012 
0013 IncorrectIdentityFolderWarningTest::IncorrectIdentityFolderWarningTest(QObject *parent)
0014     : QObject(parent)
0015 {
0016 }
0017 
0018 void IncorrectIdentityFolderWarningTest::shouldHaveDefaultValues()
0019 {
0020     auto wid = new QWidget;
0021     auto layout = new QHBoxLayout(wid);
0022     IncorrectIdentityFolderWarning w;
0023     layout->addWidget(&w);
0024     wid->show();
0025     QVERIFY(!w.isVisible());
0026     // QVERIFY(w.isCloseButtonVisible());
0027     QCOMPARE(w.messageType(), KMessageWidget::Warning);
0028     QVERIFY(w.wordWrap());
0029 }
0030 
0031 void IncorrectIdentityFolderWarningTest::shouldShowWarningInvalidIdentity()
0032 {
0033     auto wid = new QWidget;
0034     auto layout = new QHBoxLayout(wid);
0035     IncorrectIdentityFolderWarning w;
0036     layout->addWidget(&w);
0037     wid->show();
0038     QVERIFY(!w.isVisible());
0039     w.identityInvalid();
0040     QVERIFY(w.isVisible());
0041     QVERIFY(!w.text().isEmpty());
0042 }
0043 
0044 void IncorrectIdentityFolderWarningTest::shouldShowWarningInvalidMailTransport()
0045 {
0046     auto wid = new QWidget;
0047     auto layout = new QHBoxLayout(wid);
0048     IncorrectIdentityFolderWarning w;
0049     layout->addWidget(&w);
0050     wid->show();
0051     QVERIFY(!w.isVisible());
0052     w.mailTransportIsInvalid();
0053     QVERIFY(w.isVisible());
0054     QVERIFY(!w.text().isEmpty());
0055 }
0056 
0057 void IncorrectIdentityFolderWarningTest::shouldShowWarningInvalidFcc()
0058 {
0059     auto wid = new QWidget;
0060     auto layout = new QHBoxLayout(wid);
0061     IncorrectIdentityFolderWarning w;
0062     layout->addWidget(&w);
0063     wid->show();
0064     QVERIFY(!w.isVisible());
0065     w.fccIsInvalid();
0066     QVERIFY(w.isVisible());
0067     QVERIFY(!w.text().isEmpty());
0068 }
0069 
0070 #include "moc_incorrectidentityfolderwarningtest.cpp"