summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-01 06:13:23 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-01 06:13:23 (GMT)
commitdc647f3e4b2978f0e73c7180077c7b45d505af1a (patch)
tree1d051cfb7963fb7cf453996ee387819a0b6650c1
parent58daed3935bb492f05e2f7fbf58e72016daf5b71 (diff)
Allow to define body text
-rw-r--r--messagecomposer/src/composer-ng/autotests/richtextcomposerngtest.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/messagecomposer/src/composer-ng/autotests/richtextcomposerngtest.cpp b/messagecomposer/src/composer-ng/autotests/richtextcomposerngtest.cpp
index ca01f63..d5a3c4d 100644
--- a/messagecomposer/src/composer-ng/autotests/richtextcomposerngtest.cpp
+++ b/messagecomposer/src/composer-ng/autotests/richtextcomposerngtest.cpp
@@ -212,24 +212,29 @@ void RichTextComposerNgTest::shouldAddSpecificSignature()
void RichTextComposerNgTest::shouldReplaceSignature_data()
{
QTest::addColumn<QString>("signatureText");
- QTest::newRow("simple") << QStringLiteral("Signature");
- QTest::newRow("withnewline") << QStringLiteral("Signature\nnew line");
- QTest::newRow("withnewlineatbegin") << QStringLiteral("\nSignature\nnew line");
+ QTest::addColumn<QString>("bodytext");
+ QTest::newRow("newlinebody") << QStringLiteral("Signature") << QStringLiteral("\n");
+ QTest::newRow("emptybody") << QStringLiteral("Signature") << QString();
+ QTest::newRow("spacebody") << QStringLiteral("Signature") << QStringLiteral(" ");
+ QTest::newRow("simple") << QStringLiteral("Signature") << QStringLiteral("foo bla, bli\nbb");
+ QTest::newRow("withnewline") << QStringLiteral("Signature\nnew line") << QStringLiteral("foo bla, bli\nbb");
+ QTest::newRow("withnewlineatbegin") << QStringLiteral("\nSignature\nnew line") << QStringLiteral("foo bla, bli\nbb");
}
void RichTextComposerNgTest::shouldReplaceSignature()
{
QFETCH(QString, signatureText);
+ QFETCH(QString, bodytext);
MessageComposer::RichTextComposerNg richtextComposerNg;
richtextComposerNg.createActions(new KActionCollection(this));
- const QString original(QStringLiteral("foo bla, bli\nbb"));
+ const QString original(bodytext);
richtextComposerNg.setPlainText(original);
KIdentityManagement::Signature newSignature(signatureText);
newSignature.setEnabledSignature(true);
newSignature.setInlinedHtml(false);
- QString expected = QStringLiteral("foo bla, bli\nbb-- \n") + signatureText;
+ QString expected = bodytext + QStringLiteral("-- \n") + signatureText;
richtextComposerNg.insertSignature(newSignature, KIdentityManagement::Signature::End, KIdentityManagement::Signature::AddSeparator);
QCOMPARE(richtextComposerNg.toPlainText(), expected);