File indexing completed on 2024-11-10 04:50:00

0001 /*
0002   SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #include "filteractionplaysoundtest.h"
0008 #include "../filteractions/filteractionplaysound.h"
0009 #include "filter/soundtestwidget.h"
0010 #include <QTest>
0011 
0012 FilterActionPlaySoundTest::FilterActionPlaySoundTest(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 FilterActionPlaySoundTest::~FilterActionPlaySoundTest() = default;
0018 
0019 void FilterActionPlaySoundTest::shouldBeValid()
0020 {
0021     MailCommon::FilterActionPlaySound filter;
0022     QVERIFY(filter.isEmpty());
0023     filter.argsFromString(QStringLiteral("foo"));
0024     QVERIFY(!filter.isEmpty());
0025 }
0026 
0027 void FilterActionPlaySoundTest::shouldHaveDefaultValue()
0028 {
0029     MailCommon::FilterActionPlaySound filter;
0030     QWidget *w = filter.createParamWidget(nullptr);
0031     QVERIFY(w);
0032     QCOMPARE(w->objectName(), QStringLiteral("soundwidget"));
0033     auto soundTest = dynamic_cast<MailCommon::SoundTestWidget *>(w);
0034     QVERIFY(soundTest);
0035     QVERIFY(soundTest->url().isEmpty());
0036 }
0037 
0038 void FilterActionPlaySoundTest::shouldHaveRequiredPart()
0039 {
0040     MailCommon::FilterActionPlaySound filter;
0041     QCOMPARE(filter.requiredPart(), MailCommon::SearchRule::Envelope);
0042 }
0043 
0044 void FilterActionPlaySoundTest::shouldSieveRequres()
0045 {
0046     MailCommon::FilterActionPlaySound w;
0047     QCOMPARE(w.sieveRequires(), QStringList());
0048 }
0049 
0050 QTEST_MAIN(FilterActionPlaySoundTest)
0051 
0052 #include "moc_filteractionplaysoundtest.cpp"