diff --git a/src/ksieveui/autocreatescripts/autotests/CMakeLists.txt b/src/ksieveui/autocreatescripts/autotests/CMakeLists.txt index 0fca65b..9090683 100644 --- a/src/ksieveui/autocreatescripts/autotests/CMakeLists.txt +++ b/src/ksieveui/autocreatescripts/autotests/CMakeLists.txt @@ -1,25 +1,25 @@ include_directories(${libksieve_SOURCE_DIR} ${libksieve_SOURCE_DIR}/src/ksieveui/ ) add_definitions( -DKSIEVEUI_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data" ) ecm_qt_declare_logging_category(ksieveui_sieveeditor_autocreatescripts_LIB_SRCS HEADER libksieve_debug.h IDENTIFIER LIBKSIEVE_LOG CATEGORY_NAME org.kde.pim.libksieve) macro(add_sieveeditor_autocreatescripts _source _extrasource) set(_test ${_source} ${_extrasource}) get_filename_component(_name ${_source} NAME_WE) ecm_add_test(${_test} TEST_NAME ${_name} NAME_PREFIX "sieveeditor-autocreatescripts-" LINK_LIBRARIES Qt5::Test Qt5::Widgets KF5::I18n KF5::Completion KF5::ConfigCore KF5::KSieveUi KF5::MailTransport ) endmacro() add_sieveeditor_autocreatescripts(selectheadertypecomboboxtest.cpp "../sieveconditions/widgets/selectheadertypecombobox.cpp;../autocreatescriptutil.cpp") add_sieveeditor_autocreatescripts(selectheadersdialogtest.cpp "../sieveconditions/widgets/selectheadertypecombobox.cpp;../autocreatescriptutil.cpp") -add_sieveeditor_autocreatescripts(sieveeditorgraphicalmodewidgettest.cpp "${ksieveui_sieveeditor_autocreatescripts_LIB_SRCS}") +add_sieveeditor_autocreatescripts(sieveeditorgraphicalmodewidgettest.cpp "${ksieveui_sieveeditor_autocreatescripts_LIB_SRCS};../../tests/capability.cpp") add_sieveeditor_autocreatescripts(sievedatespinboxtest.cpp "") add_sieveeditor_autocreatescripts(regexpeditorlineedittest.cpp "") diff --git a/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp b/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp index 404b60c..03499f6 100644 --- a/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp +++ b/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp @@ -1,242 +1,241 @@ /* Copyright (C) 2017-2018 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sieveeditorgraphicalmodewidgettest.h" #include "../sieveeditorgraphicalmodewidget.h" #include "scriptsparsing/parsingutil.h" -#include +#include "tests/capability.h" #include #include #include #ifndef Q_OS_WIN void initLocale() { setenv("LC_ALL", "en_US.utf-8", 1); } Q_CONSTRUCTOR_FUNCTION(initLocale) #endif SieveEditorGraphicalModeWidgetTest::SieveEditorGraphicalModeWidgetTest(QObject *parent) : QObject(parent) { QStandardPaths::setTestModeEnabled(true); } QString readSieveFile(const QString &sieveFile) { QFile file(sieveFile); bool result = file.open(QIODevice::ReadOnly); Q_ASSERT(result); Q_ASSERT(file.isOpen()); const QString data = QString::fromUtf8(file.readAll()); return data; } void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts() { QFETCH(QString, input); QFETCH(bool, hasError); QFETCH(bool, success); KSieveUi::SieveEditorGraphicalModeWidget w; - PimCommon::SieveSyntaxHighlighterUtil sieveHighlighterutil; - const QStringList capabilities = sieveHighlighterutil.fullCapabilities(); + const QStringList capabilities = KSieveUi::Test::fullCapabilitiesList(); w.setSieveCapabilities(capabilities); const QString originalFile = QLatin1String(KSIEVEUI_DATA_DIR) + QLatin1Char('/') + input + QStringLiteral(".siv"); const QString refFile = QLatin1String(KSIEVEUI_DATA_DIR) + QLatin1Char('/') + input + QStringLiteral("-ref.siv"); const QString generatedFile = QLatin1String(KSIEVEUI_DATA_DIR) + QLatin1Char('/') + input + QStringLiteral("-generated.siv"); QString script = readSieveFile(originalFile); //First parsing bool result = false; QString doc = KSieveUi::ParsingUtil::parseScript(script, result); QCOMPARE(success, result); if (success) { QString error; w.loadScript(doc, error); QCOMPARE(hasError, !error.isEmpty()); QString generatedScript = w.currentscript(); doc = KSieveUi::ParsingUtil::parseScript(generatedScript, result); QCOMPARE(success, result); //second parsing w.loadScript(doc, error); QCOMPARE(hasError, !error.isEmpty()); generatedScript = w.currentscript(); //Create generated file QFile f(generatedFile); QVERIFY(f.open(QIODevice::WriteOnly | QIODevice::Truncate)); f.write(generatedScript.toUtf8()); f.close(); //qDebug() << " generatedScript" << generatedScript; // compare to reference file QStringList args = QStringList() << QStringLiteral("-u") << refFile << generatedFile; QProcess proc; proc.setProcessChannelMode(QProcess::ForwardedChannels); proc.start(QStringLiteral("diff"), args); QVERIFY(proc.waitForFinished()); QEXPECT_FAIL("regexp", "Expected failure on regexp file. Problem with header + comparator", Continue); QEXPECT_FAIL("test-current-date", "Expected failure on current-date file. We depend against current date", Continue); QEXPECT_FAIL("delete-headers-with-index", "Expected failure on delete-headers-with-index file. We depend against \"index\" feature", Continue); QEXPECT_FAIL("foreverypart", "Expected failure on foreverypart file. A lot of parsing errors.", Continue); QEXPECT_FAIL("failed-1", "Expected failure on failed-1 file. anyof + allof.", Continue); QEXPECT_FAIL("failed-if-in-if", "Expected failure on failed-if-in-if file. Problem with if in another if.", Continue); QEXPECT_FAIL("test-comment2", "Expected failure on test-comment2 file. Problem with # and /* .", Continue); QEXPECT_FAIL("test-comment7", "Expected failure on test-comment7 file. Problem comment after an action .", Continue); QEXPECT_FAIL("test-date1", "Expected failure on test-date1 file. Problem with * in date.", Continue); QEXPECT_FAIL("wierd-script", "Missing ';' at the end of requires => invalid script", Continue); QCOMPARE(proc.exitCode(), 0); } } void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data() { QTest::addColumn("input"); QTest::addColumn("hasError"); QTest::addColumn("success"); QTest::newRow("test-vacation") << QStringLiteral("test-vacation") << false << true; QTest::newRow("test-foreach") << QStringLiteral("test-foreach") << false << true; QTest::newRow("not-condition") << QStringLiteral("not-condition") << false << true; QTest::newRow("test-envelop-without-part") << QStringLiteral("test-envelop-without-part") << false << true; QTest::newRow("include") << QStringLiteral("include") << false << true; QTest::newRow("notify") << QStringLiteral("notify") << false << true; QTest::newRow("test-exists") << QStringLiteral("test-exists") << false << true; QTest::newRow("vacation") << QStringLiteral("vacation") << false << true; QTest::newRow("test-metadataexists") << QStringLiteral("test-metadataexists") << false << true; QTest::newRow("test-date") << QStringLiteral("test-date") << false << true; QTest::newRow("redirect") << QStringLiteral("redirect") << false << true; QTest::newRow("test-forwarding") << QStringLiteral("test-forwarding") << false << true; QTest::newRow("test-elseif") << QStringLiteral("test-elseif") << false << true; QTest::newRow("test-address-order") << QStringLiteral("test-address-order") << false << true; QTest::newRow("test-regexp") << QStringLiteral("test-regexp") << false << true; QTest::newRow("emptyscript") << QStringLiteral("empty") << false << true; QTest::newRow("simplescript") << QStringLiteral("simple") << false << true; QTest::newRow("bodywithlist") << QStringLiteral("body") << false << true; QTest::newRow("add-flags") << QStringLiteral("add-flags") << false << true; QTest::newRow("test-virus") << QStringLiteral("test-virus") << false << true; QTest::newRow("replace") << QStringLiteral("replace") << false << true; QTest::newRow("test-envelop") << QStringLiteral("test-envelop") << false << true; QTest::newRow("test-servermetadataexists") << QStringLiteral("test-servermetadataexists") << false << true; QTest::newRow("test-vacation") << QStringLiteral("test-vacation") << false << true; QTest::newRow("test-forwarding") << QStringLiteral("test-forwarding") << false << true; QTest::newRow("test-elseif") << QStringLiteral("test-elseif") << false << true; QTest::newRow("test-address-order") << QStringLiteral("test-address-order") << false << true; QTest::newRow("test-regexp") << QStringLiteral("test-regexp") << false << true; QTest::newRow("test-envelop-without-part") << QStringLiteral("test-envelop-without-part") << false << true; QTest::newRow("test-anti-slash") << QStringLiteral("test-anti-slash") << false << true; QTest::newRow("test-current-date") << QStringLiteral("test-current-date") << false << true; QTest::newRow("delete-headers") << QStringLiteral("delete-headers") << false << true; QTest::newRow("mailboxexist") << QStringLiteral("mailboxexist") << false << true; QTest::newRow("extract-text") << QStringLiteral("extract-text") << false << true; QTest::newRow("enclose") << QStringLiteral("enclose") << false << true; QTest::newRow("add-single-flag") << QStringLiteral("add-single-flag") << false << true; QTest::newRow("fileinfo") << QStringLiteral("fileinfo") << false << true; QTest::newRow("variable-lower") << QStringLiteral("variable-lower") << false << true; QTest::newRow("test-environnement") << QStringLiteral("test-environnement") << false << true; QTest::newRow("test-has-flags") << QStringLiteral("test-has-flags") << false << true; QTest::newRow("test-spam-plus") << QStringLiteral("test-spam-plus") << false << true; QTest::newRow("remove-flags") << QStringLiteral("remove-flags") << false << true; QTest::newRow("variable") << QStringLiteral("variable") << false << true; QTest::newRow("break") << QStringLiteral("break") << false << true; QTest::newRow("test-exists") << QStringLiteral("test-exists") << false << true; QTest::newRow("vacation") << QStringLiteral("vacation") << false << true; QTest::newRow("test-metadataexists") << QStringLiteral("test-metadataexists") << false << true; QTest::newRow("test-date") << QStringLiteral("test-date") << false << true; QTest::newRow("redirect") << QStringLiteral("redirect") << false << true; QTest::newRow("convert-action") << QStringLiteral("convert-action") << false << true; QTest::newRow("address-with-default-all-parameter") << QStringLiteral("address-with-default-all-parameter") << false << true; QTest::newRow("not-condition2") << QStringLiteral("not-condition2") << false << true; QTest::newRow("address-with-default-is-parameter") << QStringLiteral("address-with-default-is-parameter") << false << true; QTest::newRow("test-spam") << QStringLiteral("test-spam") << false << true; QTest::newRow("reject") << QStringLiteral("reject") << false << true; QTest::newRow("keep") << QStringLiteral("keep") << false << true; QTest::newRow("test-headers") << QStringLiteral("test-headers") << false << true; QTest::newRow("vacation-active-discard") << QStringLiteral("vacation-active-discard") << false << true; QTest::newRow("vacation-multiple") << QStringLiteral("vacation-multiple") << false << true; QTest::newRow("vacation-multiple-with-undefined-command") << QStringLiteral("vacation-multiple-with-undefined-command") << true << true; QTest::newRow("full-example1") << QStringLiteral("full-example1") << false << true; //We need to fix it. QTest::newRow("regexp") << QStringLiteral("regexp") << true << true; QTest::newRow("comparator") << QStringLiteral("comparator") << false << true; QTest::newRow("test-comment") << QStringLiteral("test-comment") << false << true; QTest::newRow("hasflag") << QStringLiteral("hasflag") << false << true; QTest::newRow("setflag") << QStringLiteral("setflag") << false << true; QTest::newRow("add-header") << QStringLiteral("add-header") << false << true; QTest::newRow("problem-with-inferior-char") << QStringLiteral("problem-with-inferior-char") << false << true; //We need to implement index support QTest::newRow("delete-headers-with-index") << QStringLiteral("delete-headers-with-index") << true << true; QTest::newRow("notify-2") << QStringLiteral("notify-2") << false << true; //Need to fix it QTest::newRow("foreverypart") << QStringLiteral("foreverypart") << true << true; QTest::newRow("test-foreverypart-complex") << QStringLiteral("test-foreverypart-complex") << false << true; QTest::newRow("test-envelop-subadress") << QStringLiteral("test-envelop-subadress") << false << true; QTest::newRow("test-current-date-custom") << QStringLiteral("test-current-date-custom") << false << true; //Failed QTest::newRow("failed-1") << QStringLiteral("failed-1") << true << true; QTest::newRow("failed-2") << QStringLiteral("failed-2") << false << true; QTest::newRow("failed-if-in-if") << QStringLiteral("failed-if-in-if") << true << true; QTest::newRow("test-comment2") << QStringLiteral("test-comment2") << false << true; QTest::newRow("test-comment3") << QStringLiteral("test-comment3") << false << true; QTest::newRow("test-comment4") << QStringLiteral("test-comment4") << false << true; QTest::newRow("test-value-as-list-quoted") << QStringLiteral("test-value-as-list-quoted") << false << true; QTest::newRow("test-header-value") << QStringLiteral("test-header-value") << false << true; QTest::newRow("test-comment5") << QStringLiteral("test-comment5") << false << true; QTest::newRow("test-comment6") << QStringLiteral("test-comment6") << false << true; QTest::newRow("test-comment7") << QStringLiteral("test-comment7") << false << true; QTest::newRow("test-comment8") << QStringLiteral("test-comment8") << false << true; QTest::newRow("test-comment9") << QStringLiteral("test-comment9") << false << true; QTest::newRow("test-date1") << QStringLiteral("test-date1") << false << true; QTest::newRow("test-header-multilist") << QStringLiteral("test-header-multilist") << false << true; QTest::newRow("test-header-multilist-comment") << QStringLiteral("test-header-multilist-comment") << false << true; QTest::newRow("wierd-script") << QStringLiteral("wierd-script") << false << true; QTest::newRow("test-text-with-backslash") << QStringLiteral("test-text-with-backslash") << false << true; //Bug 383756 QTest::newRow("body-without-bodytype") << QStringLiteral("body-without-bodytype") << false << true; } QTEST_MAIN(SieveEditorGraphicalModeWidgetTest) diff --git a/src/ksieveui/autocreatescripts/tests/CMakeLists.txt b/src/ksieveui/autocreatescripts/tests/CMakeLists.txt index 2b399c9..8a482b4 100644 --- a/src/ksieveui/autocreatescripts/tests/CMakeLists.txt +++ b/src/ksieveui/autocreatescripts/tests/CMakeLists.txt @@ -1,24 +1,24 @@ include_directories(${libksieve_SOURCE_DIR} ${libksieve_SOURCE_DIR}/src/ksieveui/scriptsparsing ) -set(autocreatescripts_gui_SRCS autocreatescripts_gui.cpp) +set(autocreatescripts_gui_SRCS autocreatescripts_gui.cpp ../../tests/capability.cpp) add_executable(autocreatescripts_gui ${autocreatescripts_gui_SRCS}) target_link_libraries(autocreatescripts_gui KF5::KSieveUi KF5::PimCommon KF5::I18n ) -set(parsingscript_gui_SRCS parsingscript_gui.cpp) +set(parsingscript_gui_SRCS parsingscript_gui.cpp ../../tests/capability.cpp) add_executable(parsingscript_gui ${parsingscript_gui_SRCS}) target_link_libraries(parsingscript_gui KF5::KIOCore KF5::KSieveUi KF5::KSieve KF5::PimCommon KF5::I18n ) diff --git a/src/ksieveui/autocreatescripts/tests/autocreatescripts_gui.cpp b/src/ksieveui/autocreatescripts/tests/autocreatescripts_gui.cpp index 522e6b1..e854f4c 100644 --- a/src/ksieveui/autocreatescripts/tests/autocreatescripts_gui.cpp +++ b/src/ksieveui/autocreatescripts/tests/autocreatescripts_gui.cpp @@ -1,47 +1,46 @@ /* Copyright (C) 2013-2018 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include #include #include "../autocreatescriptdialog.h" -#include +#include "tests/capability.h" int main(int argc, char **argv) { QApplication app(argc, argv); QStandardPaths::setTestModeEnabled(true); QCommandLineParser parser; parser.addVersionOption(); parser.addHelpOption(); parser.process(app); KSieveUi::AutoCreateScriptDialog *dialog = new KSieveUi::AutoCreateScriptDialog; - PimCommon::SieveSyntaxHighlighterUtil sieveHighlighterutil; - const QStringList capabilities = sieveHighlighterutil.fullCapabilities(); + const QStringList capabilities = KSieveUi::Test::fullCapabilitiesList(); //Add all capabilities for testing dialog->setSieveCapabilities(capabilities); if (dialog->exec()) { QString requires; const QString script = dialog->script(requires); qDebug() << " generated script :\n" << requires << "\n" << script; } delete dialog; return 0; } diff --git a/src/ksieveui/autocreatescripts/tests/parsingscript_gui.cpp b/src/ksieveui/autocreatescripts/tests/parsingscript_gui.cpp index b9108ba..2e8a2f8 100644 --- a/src/ksieveui/autocreatescripts/tests/parsingscript_gui.cpp +++ b/src/ksieveui/autocreatescripts/tests/parsingscript_gui.cpp @@ -1,98 +1,97 @@ /* Copyright (C) 2013-2018 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include #include "../src/ksieveui/scriptsparsing/xmlprintingscriptbuilder.h" #include "../src/ksieveui/scriptsparsing/parsingresultdialog.h" #include using KSieve::Parser; #include #include #include #include #include #include #include "../autocreatescriptdialog.h" #include "../sievescriptparsingerrordialog.h" -#include +#include "ksieveui/tests/capability.h" int main(int argc, char **argv) { QApplication app(argc, argv); QCommandLineParser parser; parser.addVersionOption(); parser.addHelpOption(); parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[url]"), QStringLiteral("URL of a sieve script to be opened"))); parser.process(app); QByteArray script; QString fileName; if (!parser.positionalArguments().isEmpty()) { fileName = parser.positionalArguments().at(0); } else { fileName = QFileDialog::getOpenFileName(nullptr, QString(), QString(), QStringLiteral("Sieve File (*.siv)")); } if (!fileName.isEmpty()) { QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { script = file.readAll(); } } else { return 0; } //qDebug() << "scriptUtf8 = \"" + script +"\""; KSieve::Parser sieveParser(script.constBegin(), script.constBegin() + script.length()); KSieveUi::XMLPrintingScriptBuilder psb(2); sieveParser.setScriptBuilder(&psb); if (sieveParser.parse()) { qDebug() << "ok"; } else { qDebug() << "bad"; } KSieveUi::ParsingResultDialog dlg; dlg.setResultParsing(psb.result()); dlg.show(); KSieveUi::AutoCreateScriptDialog *dialog = new KSieveUi::AutoCreateScriptDialog; - PimCommon::SieveSyntaxHighlighterUtil sieveHighlighterutil; - const QStringList capabilities = sieveHighlighterutil.fullCapabilities(); + const QStringList capabilities = KSieveUi::Test::fullCapabilitiesList(); //Add all capabilities for testing dialog->setSieveCapabilities(capabilities); QString error; dialog->loadScript(psb.result(), error); if (!error.isEmpty()) { QPointer dlg = new KSieveUi::SieveScriptParsingErrorDialog; dlg->setError(QString::fromLatin1(script), error); dlg->exec(); delete dlg; } dialog->show(); app.exec(); delete dialog; return 0; } diff --git a/src/ksieveui/editor/tests/CMakeLists.txt b/src/ksieveui/editor/tests/CMakeLists.txt index d5643f8..bea762b 100644 --- a/src/ksieveui/editor/tests/CMakeLists.txt +++ b/src/ksieveui/editor/tests/CMakeLists.txt @@ -1,14 +1,14 @@ include_directories(${libksieve_SOURCE_DIR} ${libksieve_SOURCE_DIR}/src/ksieveui/scriptsparsing ) -set(editorsieve_gui_SRCS editorsieve_gui.cpp) +set(editorsieve_gui_SRCS editorsieve_gui.cpp ../../tests/capability.cpp) add_executable(editorsieve_gui ${editorsieve_gui_SRCS}) target_link_libraries(editorsieve_gui KF5::KSieveUi KF5::PimCommon KF5::I18n Qt5::PrintSupport ) diff --git a/src/ksieveui/editor/tests/editorsieve_gui.cpp b/src/ksieveui/editor/tests/editorsieve_gui.cpp index 1d145e0..c92e992 100644 --- a/src/ksieveui/editor/tests/editorsieve_gui.cpp +++ b/src/ksieveui/editor/tests/editorsieve_gui.cpp @@ -1,63 +1,62 @@ /* Copyright (C) 2013-2018 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "editorsieve_gui.h" #include #include "ksieveui/editor/sieveeditor.h" -#include +#include "ksieveui/tests/capability.h" #include #include #include int main(int argc, char **argv) { QApplication app(argc, argv); QStandardPaths::setTestModeEnabled(true); QCommandLineParser parser; parser.addVersionOption(); parser.addHelpOption(); parser.process(app); SieveEditorTestWidget *dialog = new SieveEditorTestWidget; - PimCommon::SieveSyntaxHighlighterUtil sieveHighlighterutil; - const QStringList capabilities = sieveHighlighterutil.fullCapabilities(); + const QStringList capabilities = KSieveUi::Test::fullCapabilitiesList(); //Add all capabilities for testing dialog->setSieveCapabilities(capabilities); if (dialog->exec()) { qDebug() << " generated script :\n" << dialog->script() << "\n"; } delete dialog; return 0; } SieveEditorTestWidget::SieveEditorTestWidget(QWidget *parent) : KSieveUi::SieveEditor(parent) { connect(this, &SieveEditorTestWidget::valueChanged, this, &SieveEditorTestWidget::slotValueChanged); } SieveEditorTestWidget::~SieveEditorTestWidget() { } void SieveEditorTestWidget::slotValueChanged(bool changed) { qDebug() << " value changed :" << changed; } diff --git a/src/ksieveui/tests/capability.cpp b/src/ksieveui/tests/capability.cpp new file mode 100644 index 0000000..e7cdbd8 --- /dev/null +++ b/src/ksieveui/tests/capability.cpp @@ -0,0 +1,60 @@ +/* + Copyright (c) 2013-2018 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "capability.h" + +QStringList KSieveUi::Test::fullCapabilitiesList() +{ + return QStringList() + << QStringLiteral("mboxmetadata") + << QStringLiteral("body") + << QStringLiteral("extlists") + << QStringLiteral("envelope") + << QStringLiteral("redirect") + << QStringLiteral("fileinto") + << QStringLiteral("editheader") + << QStringLiteral("reject") + << QStringLiteral("ereject") + << QStringLiteral("imapflags") + << QStringLiteral("imap4flags") + << QStringLiteral("enotify") + << QStringLiteral("date") + << QStringLiteral("copy") + << QStringLiteral("mailbox") + << QStringLiteral("spamtest") + << QStringLiteral("spamtestplus") + << QStringLiteral("virustest") + << QStringLiteral("vacation") + << QStringLiteral("vacation-seconds") + << QStringLiteral("ihave") + << QStringLiteral("subaddress") + << QStringLiteral("environment") + << QStringLiteral("enclose") + << QStringLiteral("replace") + << QStringLiteral("include") + << QStringLiteral("extracttext") + << QStringLiteral("metadata") + << QStringLiteral("convert") + << QStringLiteral("foreverypart") + << QStringLiteral("variables") + << QStringLiteral("servermetadata") + << QStringLiteral("regex") + << QStringLiteral("relational") + << QStringLiteral("comparator-i;ascii-numeric") + << QStringLiteral("comparator-i;unicode-casemap") + << QStringLiteral("encoded-character"); +} diff --git a/src/ksieveui/tests/capability.h b/src/ksieveui/tests/capability.h new file mode 100644 index 0000000..8180aba --- /dev/null +++ b/src/ksieveui/tests/capability.h @@ -0,0 +1,31 @@ +/* + Copyright (c) 2013-2018 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef KSIEVEUITESTSCAPABILITY_H +#define KSIEVEUITESTSCAPABILITY_H + +#include + +namespace KSieveUi { +namespace Test { + +QStringList fullCapabilitiesList(); + +} +} + +#endif //KSIEVEUITESTSCAPABILITY_H