File indexing completed on 2024-12-22 05:00:49

0001 /*
0002    SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "archivemailrangewidgettest.h"
0008 #include "../archivemailrangewidget.h"
0009 #include "../widgets/hourcombobox.h"
0010 #include <QCheckBox>
0011 #include <QHBoxLayout>
0012 #include <QTest>
0013 QTEST_MAIN(ArchiveMailRangeWidgetTest)
0014 
0015 ArchiveMailRangeWidgetTest::ArchiveMailRangeWidgetTest(QObject *parent)
0016     : QObject{parent}
0017 {
0018 }
0019 
0020 void ArchiveMailRangeWidgetTest::shouldHaveDefaultValues()
0021 {
0022     ArchiveMailRangeWidget w;
0023 
0024     auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
0025     QVERIFY(mainLayout);
0026     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0027 
0028     auto mRangeEnabled = w.findChild<QCheckBox *>(QStringLiteral("mRangeEnabled"));
0029     QVERIFY(mRangeEnabled);
0030     QVERIFY(!mRangeEnabled->isChecked());
0031 
0032     auto mStartRange = w.findChild<HourComboBox *>(QStringLiteral("mStartRange"));
0033     QVERIFY(mStartRange);
0034 
0035     auto mEndRange = w.findChild<HourComboBox *>(QStringLiteral("mEndRange"));
0036     QVERIFY(mEndRange);
0037 
0038     QVERIFY(!w.isRangeEnabled());
0039 }
0040 
0041 #include "moc_archivemailrangewidgettest.cpp"