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 "selectimapfolderdialogtest.h" 0008 #include "../selectimapfolderdialog.h" 0009 #include "../selectimapfolderwidget.h" 0010 #include <QAbstractButton> 0011 #include <QDialogButtonBox> 0012 #include <QStandardPaths> 0013 #include <QTest> 0014 0015 SelectImapFolderDialogTest::SelectImapFolderDialogTest(QObject *parent) 0016 : QObject(parent) 0017 { 0018 QStandardPaths::setTestModeEnabled(true); 0019 } 0020 0021 SelectImapFolderDialogTest::~SelectImapFolderDialogTest() = default; 0022 0023 void SelectImapFolderDialogTest::shouldHaveDefaultValue() 0024 { 0025 KSieveCore::SieveImapAccountSettings account; 0026 SelectImapFolderDialog w(account); 0027 0028 auto mSelectImapFolderWidget = w.findChild<SelectImapFolderWidget *>(QStringLiteral("selectimapfolderwidget")); 0029 QVERIFY(mSelectImapFolderWidget); 0030 0031 auto buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox")); 0032 QVERIFY(buttonBox); 0033 0034 const QList<QAbstractButton *> lst = buttonBox->buttons(); 0035 bool foundCreateFolderButton = false; 0036 for (QAbstractButton *b : lst) { 0037 if (b->objectName() == QLatin1StringView("createfolder")) { 0038 foundCreateFolderButton = true; 0039 QVERIFY(!b->isEnabled()); 0040 break; 0041 } 0042 } 0043 QVERIFY(foundCreateFolderButton); 0044 0045 QVERIFY(!w.windowTitle().isEmpty()); 0046 } 0047 0048 QTEST_MAIN(SelectImapFolderDialogTest) 0049 0050 #include "moc_selectimapfolderdialogtest.cpp"