Commit 406f488a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

improve autotests (fix some bugs about signature)

parent ea8b4163
......@@ -205,7 +205,33 @@ void RichTextComposerNgTest::shouldAddSpecificSignature()
newSignature.setEnabledSignature(enablesignature);
newSignature.setInlinedHtml(signaturehtml);
richtextComposerNg.insertSignature(newSignature, signatureplacement, signatureaddtext);
//qDebug() << " clean html "<<richtextComposerNg.toCleanHtml();
QCOMPARE(richtextComposerNg.toPlainText(), expected);
}
void RichTextComposerNgTest::shouldReplaceSignature()
{
MessageComposer::RichTextComposerNg richtextComposerNg;
richtextComposerNg.createActions(new KActionCollection(this));
const QString original(QStringLiteral("foo bla, bli\nbb"));
richtextComposerNg.setPlainText(original);
KIdentityManagement::Signature newSignature(QStringLiteral("Signature"));
newSignature.setEnabledSignature(true);
newSignature.setInlinedHtml(false);
QString expected(QStringLiteral("foo bla, bli\nbb-- \nSignature"));
richtextComposerNg.insertSignature(newSignature, KIdentityManagement::Signature::End, KIdentityManagement::Signature::AddSeparator);
QCOMPARE(richtextComposerNg.toPlainText(), expected);
KIdentityManagement::Signature emptySignature;
bool replaceSignature = richtextComposerNg.composerSignature()->replaceSignature(newSignature, emptySignature);
QVERIFY(replaceSignature);
QCOMPARE(richtextComposerNg.toPlainText(), original);
replaceSignature = richtextComposerNg.composerSignature()->replaceSignature(emptySignature, newSignature);
//When signature is empty we can't replace it.
QVERIFY(!replaceSignature);
}
QTEST_MAIN(RichTextComposerNgTest)
......@@ -46,6 +46,9 @@ private Q_SLOTS:
void shouldAddSpecificSignature_data();
void shouldAddSpecificSignature();
void shouldReplaceSignature();
};
#endif // RICHTEXTCOMPOSERNGTEST_H
Supports Markdown
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