File indexing completed on 2024-11-24 04:43:02
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "mergecontactselectinformationscrollareatest.h" 0008 #include "../widgets/mergecontactinfowidget.h" 0009 #include "../widgets/mergecontactselectinformationscrollarea.h" 0010 #include "../widgets/mergecontactselectinformationwidget.h" 0011 #include <QPushButton> 0012 #include <QScrollArea> 0013 #include <QStackedWidget> 0014 #include <QTest> 0015 0016 MergeContactSelectInformationScrollAreaTest::MergeContactSelectInformationScrollAreaTest(QObject *parent) 0017 : QObject(parent) 0018 { 0019 } 0020 0021 MergeContactSelectInformationScrollAreaTest::~MergeContactSelectInformationScrollAreaTest() = default; 0022 0023 void MergeContactSelectInformationScrollAreaTest::shouldHaveDefaultValue() 0024 { 0025 KABMergeContacts::MergeContactSelectInformationScrollArea w; 0026 auto area = w.findChild<QScrollArea *>(QStringLiteral("scrollarea")); 0027 QVERIFY(area); 0028 auto mergeButton = w.findChild<QPushButton *>(QStringLiteral("merge")); 0029 QVERIFY(mergeButton); 0030 0031 auto stackedwidget = w.findChild<QStackedWidget *>(QStringLiteral("stackwidget")); 0032 QVERIFY(stackedwidget); 0033 0034 auto widget = w.findChild<KABMergeContacts::MergeContactSelectInformationWidget *>(QStringLiteral("selectinformationwidget")); 0035 QVERIFY(widget); 0036 0037 for (int i = 0; i < stackedwidget->count(); ++i) { 0038 QWidget *widget2 = stackedwidget->widget(i); 0039 const QString objName = widget2->objectName(); 0040 bool hasCorrectName = (objName == QLatin1StringView("mergedcontactwidget")) || (objName == QLatin1StringView("selectwidget")); 0041 QVERIFY(hasCorrectName); 0042 } 0043 QCOMPARE(stackedwidget->currentWidget()->objectName(), QStringLiteral("selectwidget")); 0044 } 0045 0046 QTEST_MAIN(MergeContactSelectInformationScrollAreaTest) 0047 0048 #include "moc_mergecontactselectinformationscrollareatest.cpp"