File indexing completed on 2025-01-05 04:58:20
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 0006 */ 0007 0008 #include "blacklistbalooemailwarningtest.h" 0009 #include "../blacklistbalooemailwarning.h" 0010 #include <QAction> 0011 #include <QSignalSpy> 0012 #include <QTest> 0013 0014 BlackListBalooEmailWarningTest::BlackListBalooEmailWarningTest(QObject *parent) 0015 : QObject(parent) 0016 { 0017 } 0018 0019 BlackListBalooEmailWarningTest::~BlackListBalooEmailWarningTest() = default; 0020 0021 void BlackListBalooEmailWarningTest::shouldHaveDefaultValue() 0022 { 0023 PimCommon::BlackListBalooEmailWarning warning; 0024 QVERIFY(!warning.isVisible()); 0025 QVERIFY(!warning.isCloseButtonVisible()); 0026 QVERIFY(warning.wordWrap()); 0027 0028 auto save = warning.findChild<QAction *>(QStringLiteral("saveblacklist")); 0029 QVERIFY(save); 0030 0031 auto search = warning.findChild<QAction *>(QStringLiteral("search")); 0032 QVERIFY(search); 0033 0034 auto cancelAction = warning.findChild<QAction *>(QStringLiteral("cancel")); 0035 QVERIFY(cancelAction); 0036 } 0037 0038 void BlackListBalooEmailWarningTest::shouldEmitSaveChanges() 0039 { 0040 PimCommon::BlackListBalooEmailWarning warning; 0041 QSignalSpy spy1(&warning, &PimCommon::BlackListBalooEmailWarning::saveChanges); 0042 0043 auto save = warning.findChild<QAction *>(QStringLiteral("saveblacklist")); 0044 save->trigger(); 0045 QCOMPARE(spy1.count(), 1); 0046 } 0047 0048 void BlackListBalooEmailWarningTest::shouldEmitNewSearch() 0049 { 0050 PimCommon::BlackListBalooEmailWarning warning; 0051 QSignalSpy spy1(&warning, &PimCommon::BlackListBalooEmailWarning::newSearch); 0052 0053 auto search = warning.findChild<QAction *>(QStringLiteral("search")); 0054 search->trigger(); 0055 QCOMPARE(spy1.count(), 1); 0056 } 0057 0058 QTEST_MAIN(BlackListBalooEmailWarningTest) 0059 0060 #include "moc_blacklistbalooemailwarningtest.cpp"