Commit d7591dd8 authored by Laurent Montel's avatar Laurent Montel 😁

Add more autotests

parent 9fddd2c7
require "imap4flags";
#SCRIPTNAME: Partie du script 0
#Script name: add flags
if size :under 1
{
addflag [ "\\Deleted", "\\Answered", "\\Flagged" ];
}
\ No newline at end of file
require "imapflags";
#Script name: add flags
if size :under 1
{
addflag [ "\\Deleted", "\\Answered", "\\Flagged" ];
}
require "body";
require "imap4flags";
require "fileinto";
#SCRIPTNAME: Partie du script 0
# rule:[Gerrit CI Success]
if allof (exists "X-Gerrit-Commit"
, not body :text :contains [ "WARNINGS", "FAILURE" ]
, header :contains "from" "Continuous Integration (Code Review)"
)
{
setflag [ "\\Seen" ];
fileinto "INBOX/Trash";
stop;
}
\ No newline at end of file
require "";
require "subaddress";
require "imap4flags";
#SCRIPTNAME: Partie du script 0
if address :all :is "From" "someone@example.org"
{
setflag [ "\\Seen" ];
}
\ No newline at end of file
require "spamtest";
require "relational";
require "comparator-i;ascii-numeric";
#Script name: test virus
if allof (virustest :count "ge" :comparator "i;ascii-numeric" "5"
, virustest :value "ne" :comparator "i;ascii-numeric" "5"
, virustest :count "lt" :comparator "i;ascii-numeric" "4"
)
{
stop;
}
require "spamtest";
require "relational";
require "comparator-i;ascii-numeric";
#Script name: test virus
if allof (virustest :count "ge" :comparator "i;ascii-numeric" "5"
, virustest :value "ne" :comparator "i;ascii-numeric" "5"
, virustest :count "lt" :comparator "i;ascii-numeric" "4"
)
{
stop;
}
......@@ -21,10 +21,19 @@
#include "sieveeditorgraphicalmodewidgettest.h"
#include "../sieveeditorgraphicalmodewidget.h"
#include "scriptsparsing/parsingutil.h"
#include <PimCommon/SieveSyntaxHighlighterUtil>
#include <QTest>
#include <QStandardPaths>
#include <QProcess>
#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)
{
......@@ -47,6 +56,10 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts()
QFETCH(bool, success);
KSieveUi::SieveEditorGraphicalModeWidget w;
PimCommon::SieveSyntaxHighlighterUtil sieveHighlighterutil;
const QStringList capabilities = sieveHighlighterutil.fullCapabilities();
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");
......@@ -91,6 +104,9 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data()
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment