File indexing completed on 2024-12-29 04:54:51
0001 /* 0002 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "moveimapfolderwidgettest.h" 0008 #include "../moveimapfolderwidget.h" 0009 #include <QHBoxLayout> 0010 #include <QLineEdit> 0011 #include <QTest> 0012 0013 MoveImapFolderWidgetTest::MoveImapFolderWidgetTest(QObject *parent) 0014 : QObject(parent) 0015 { 0016 } 0017 0018 MoveImapFolderWidgetTest::~MoveImapFolderWidgetTest() = default; 0019 0020 void MoveImapFolderWidgetTest::shouldHaveDefaultValue() 0021 { 0022 KSieveUi::MoveImapFolderWidget w; 0023 0024 auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainlayout")); 0025 QVERIFY(mainLayout); 0026 QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0)); 0027 auto mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("lineedit")); 0028 QVERIFY(mLineEdit); 0029 QVERIFY(mLineEdit->text().isEmpty()); 0030 QVERIFY(w.text().isEmpty()); 0031 QVERIFY(mLineEdit->isClearButtonEnabled()); 0032 } 0033 0034 void MoveImapFolderWidgetTest::shouldAssignValue() 0035 { 0036 KSieveUi::MoveImapFolderWidget w; 0037 auto mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("lineedit")); 0038 QString str = QStringLiteral("foo"); 0039 w.setText(str); 0040 QCOMPARE(mLineEdit->text(), str); 0041 QCOMPARE(w.text(), str); 0042 0043 w.setText(QString()); 0044 QVERIFY(mLineEdit->text().isEmpty()); 0045 QVERIFY(w.text().isEmpty()); 0046 } 0047 0048 QTEST_MAIN(MoveImapFolderWidgetTest) 0049 0050 #include "moc_moveimapfolderwidgettest.cpp"