File indexing completed on 2025-02-16 04:49:29
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 "checkattachmentdialogtest.h" 0008 #include "../sendattachments/checkattachmentdialog.h" 0009 #include <QDialogButtonBox> 0010 #include <QLabel> 0011 #include <QListWidget> 0012 #include <QStandardPaths> 0013 #include <QTest> 0014 0015 CheckAttachmentDialogTest::CheckAttachmentDialogTest(QObject *parent) 0016 : QObject(parent) 0017 { 0018 QStandardPaths::setTestModeEnabled(true); 0019 } 0020 0021 CheckAttachmentDialogTest::~CheckAttachmentDialogTest() = default; 0022 0023 void CheckAttachmentDialogTest::shouldHaveDefaultValue() 0024 { 0025 CheckAttachmentDialog w; 0026 auto buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox")); 0027 QVERIFY(buttonBox); 0028 0029 auto lab = w.findChild<QLabel *>(QStringLiteral("lab")); 0030 QVERIFY(lab); 0031 QVERIFY(!lab->text().isEmpty()); 0032 0033 auto mListWidget = w.findChild<QListWidget *>(QStringLiteral("listwidget")); 0034 QVERIFY(mListWidget); 0035 QCOMPARE(mListWidget->count(), 0); 0036 } 0037 0038 void CheckAttachmentDialogTest::shouldAddEmails() 0039 { 0040 CheckAttachmentDialog w; 0041 0042 auto mListWidget = w.findChild<QListWidget *>(QStringLiteral("listwidget")); 0043 w.setEmails(QStringList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("v")); 0044 QCOMPARE(mListWidget->count(), 3); 0045 } 0046 0047 QTEST_MAIN(CheckAttachmentDialogTest) 0048 0049 #include "moc_checkattachmentdialogtest.cpp"