File indexing completed on 2024-11-24 04:43:06

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "confirmbeforedeletingcreaterulewidgettest.h"
0008 #include "confirmbeforedeletingcreaterulewidget.h"
0009 #include <QComboBox>
0010 #include <QHBoxLayout>
0011 #include <QLabel>
0012 #include <QLineEdit>
0013 #include <QTest>
0014 QTEST_MAIN(ConfirmBeforeDeletingCreateRuleWidgetTest)
0015 ConfirmBeforeDeletingCreateRuleWidgetTest::ConfirmBeforeDeletingCreateRuleWidgetTest(QObject *parent)
0016     : QObject(parent)
0017 {
0018 }
0019 
0020 void ConfirmBeforeDeletingCreateRuleWidgetTest::shouldHaveDefaultValues()
0021 {
0022     ConfirmBeforeDeletingCreateRuleWidget w;
0023     auto mainLayout = w.findChild<QHBoxLayout *>(QStringLiteral("mainLayout"));
0024     QVERIFY(mainLayout);
0025     QCOMPARE(mainLayout->contentsMargins(), QMargins{});
0026 
0027     auto mPatternLineEdit = w.findChild<QLineEdit *>(QStringLiteral("mPatternLineEdit"));
0028     QVERIFY(mPatternLineEdit);
0029     QVERIFY(mPatternLineEdit->text().isEmpty());
0030 
0031     auto mRuleTypeComboBox = w.findChild<QComboBox *>(QStringLiteral("mRuleTypeComboBox"));
0032     QVERIFY(mRuleTypeComboBox);
0033     QVERIFY(mRuleTypeComboBox->count() > 0);
0034 
0035     auto label = w.findChild<QLabel *>(QStringLiteral("typeLabel"));
0036     QVERIFY(!label->text().isEmpty());
0037 
0038     label = w.findChild<QLabel *>(QStringLiteral("containsLabel"));
0039     QVERIFY(!label->text().isEmpty());
0040 }
0041 
0042 #include "moc_confirmbeforedeletingcreaterulewidgettest.cpp"