File indexing completed on 2025-01-05 04:49:50

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "selectimapfolderwidgettest.h"
0008 #include "../selectimapfolderwidget.h"
0009 #include <QLineEdit>
0010 #include <QTest>
0011 #include <QToolButton>
0012 #include <QTreeView>
0013 #include <QVBoxLayout>
0014 
0015 SelectImapFolderWidgetTest::SelectImapFolderWidgetTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 SelectImapFolderWidgetTest::~SelectImapFolderWidgetTest() = default;
0021 
0022 void SelectImapFolderWidgetTest::shouldHaveDefaultValue()
0023 {
0024     KSieveCore::SieveImapAccountSettings account;
0025     SelectImapFolderWidget w(account);
0026     auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
0027     QVERIFY(mainLayout);
0028     QCOMPARE(mainLayout->contentsMargins(), QMargins());
0029 
0030     auto mTreeView = w.findChild<QTreeView *>(QStringLiteral("treeview"));
0031     QVERIFY(mTreeView);
0032 
0033     auto mSearchLineEdit = w.findChild<QLineEdit *>(QStringLiteral("searchline"));
0034     QVERIFY(mSearchLineEdit);
0035     QVERIFY(mSearchLineEdit->isClearButtonEnabled());
0036     QVERIFY(mSearchLineEdit->text().isEmpty());
0037 
0038     auto refreshImap = w.findChild<QToolButton *>(QStringLiteral("refreshimap"));
0039     QVERIFY(refreshImap);
0040     QVERIFY(!refreshImap->toolTip().isEmpty());
0041 }
0042 
0043 QTEST_MAIN(SelectImapFolderWidgetTest)
0044 
0045 #include "moc_selectimapfolderwidgettest.cpp"