Warning, file /pim/mailcommon/src/snippets/autotests/snippetwidgettest.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "snippetwidgettest.h" 0008 #include "snippets/snippetwidget.h" 0009 #include <QTest> 0010 QTEST_MAIN(SnippetWidgetTest) 0011 0012 SnippetWidgetTest::SnippetWidgetTest(QObject *parent) 0013 : QObject(parent) 0014 { 0015 } 0016 0017 void SnippetWidgetTest::shouldHaveDefaultValues() 0018 { 0019 MailCommon::SnippetWidget w; 0020 QVERIFY(w.name().isEmpty()); 0021 QVERIFY(w.text().isEmpty()); 0022 QVERIFY(w.keySequence().isEmpty()); 0023 QVERIFY(w.subject().isEmpty()); 0024 QVERIFY(w.keyword().isEmpty()); 0025 QVERIFY(w.to().isEmpty()); 0026 QVERIFY(w.cc().isEmpty()); 0027 QVERIFY(w.bcc().isEmpty()); 0028 QVERIFY(!w.snippetIsValid()); 0029 QVERIFY(!w.isGroupSelected()); 0030 QVERIFY(!w.wasChanged()); 0031 } 0032 0033 void SnippetWidgetTest::shouldClearWidget() 0034 { 0035 MailCommon::SnippetWidget w; 0036 w.setName(QStringLiteral("bla")); 0037 w.setText(QStringLiteral("bli")); 0038 w.setSubject(QStringLiteral("zz")); 0039 w.setKeyword(QStringLiteral("zzsss")); 0040 w.setTo(QStringLiteral("to")); 0041 w.setCc(QStringLiteral("tos")); 0042 w.setBcc(QStringLiteral("bcc")); 0043 QVERIFY(!w.name().isEmpty()); 0044 QVERIFY(!w.text().isEmpty()); 0045 QVERIFY(!w.subject().isEmpty()); 0046 QVERIFY(!w.keyword().isEmpty()); 0047 QVERIFY(!w.to().isEmpty()); 0048 QVERIFY(!w.cc().isEmpty()); 0049 QVERIFY(!w.bcc().isEmpty()); 0050 w.clear(); 0051 0052 QVERIFY(w.name().isEmpty()); 0053 QVERIFY(w.text().isEmpty()); 0054 QVERIFY(w.keySequence().isEmpty()); 0055 QVERIFY(w.subject().isEmpty()); 0056 QVERIFY(w.keyword().isEmpty()); 0057 QVERIFY(w.to().isEmpty()); 0058 QVERIFY(w.cc().isEmpty()); 0059 QVERIFY(w.bcc().isEmpty()); 0060 QVERIFY(!w.snippetIsValid()); 0061 QVERIFY(!w.isGroupSelected()); 0062 QVERIFY(w.wasChanged()); 0063 } 0064 0065 #include "moc_snippetwidgettest.cpp"