File indexing completed on 2024-12-22 04:45:47

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #include "removeaccountwidgettest.h"
0007 #include "configuredialog/removeaccountwidget.h"
0008 #include <QCheckBox>
0009 #include <QLabel>
0010 #include <QTest>
0011 #include <QVBoxLayout>
0012 QTEST_MAIN(RemoveAccountWidgetTest)
0013 RemoveAccountWidgetTest::RemoveAccountWidgetTest(QObject *parent)
0014     : QObject{parent}
0015 {
0016 }
0017 
0018 void RemoveAccountWidgetTest::shouldHaveDefaultValues()
0019 {
0020     RemoveAccountWidget w;
0021     auto mRemoveLogs = w.findChild<QCheckBox *>(QStringLiteral("mRemoveLogs"));
0022     QVERIFY(mRemoveLogs);
0023     QVERIFY(!mRemoveLogs->text().isEmpty());
0024     QVERIFY(!mRemoveLogs->isChecked());
0025 
0026     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
0027     QVERIFY(mainLayout);
0028     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0029 
0030     QVERIFY(!w.removeLogs());
0031 
0032     auto mInfo = w.findChild<QLabel *>(QStringLiteral("mInfo"));
0033     QVERIFY(mInfo);
0034     QVERIFY(mInfo->text().isEmpty());
0035 }
0036 
0037 #include "moc_removeaccountwidgettest.cpp"