This commit is contained in:
Patrick von Reth 2015-06-29 12:09:34 +02:00
parent c004504a9d
commit 4a57343a40
3 changed files with 9 additions and 9 deletions

View File

@ -38,40 +38,40 @@ void benchmarkUtilsToPlain();
void SnoreBenchmark::benchmarkUtilsToHtml(){ void SnoreBenchmark::benchmarkUtilsToHtml(){
QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::NO_MARKUP), QString("Italic A\n" QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::NO_MARKUP), QString("Italic A\n"
"Italic B\n" "Italic B\n"
"Bold\n" "Bold\n"
"Underline\n" "Underline\n"
"Font\n" "Font\n"
"<&>\n" "<&>\n"
"Website\n")); "Website\n"));
QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::HREF), QString("Italic A\n" QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::HREF), QString("Italic A\n"
"Italic B\n" "Italic B\n"
"Bold\n" "Bold\n"
"Underline\n" "Underline\n"
"Font\n" "Font\n"
"&lt;&amp;&gt;\n" "&lt;&amp;&gt;\n"
"<a href=\"https://github.com/Snorenotify/Snorenotify\">Website</a>\n")); "<a href=\"https://github.com/Snorenotify/Snorenotify\">Website</a>\n"));
QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::HREF | Utils::BOLD | Utils::BREAK | QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::HREF | Utils::BOLD | Utils::BREAK |
Utils::UNDERLINE | Utils::FONT | Utils::ITALIC), htmlTestString); Utils::UNDERLINE | Utils::FONT | Utils::ITALIC), htmlTestString);
QBENCHMARK{ QBENCHMARK{
Utils::normaliseMarkup(htmlTestString, Utils::HREF); Utils::normalizeMarkup(htmlTestString, Utils::HREF);
} }
} }
void SnoreBenchmark::benchmarkUtilsToHtmlAllMarkup() void SnoreBenchmark::benchmarkUtilsToHtmlAllMarkup()
{ {
QCOMPARE(Utils::normaliseMarkup(htmlTestString, Utils::ALL_MARKUP), htmlTestString); QCOMPARE(Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP), htmlTestString);
QBENCHMARK{ QBENCHMARK{
Utils::normaliseMarkup(htmlTestString, Utils::ALL_MARKUP); Utils::normalizeMarkup(htmlTestString, Utils::ALL_MARKUP);
} }
} }
void SnoreBenchmark::benchmarkUtilsToPlain() void SnoreBenchmark::benchmarkUtilsToPlain()
{ {
QBENCHMARK{ QBENCHMARK{
Utils::normaliseMarkup(htmlTestString, Utils::NO_MARKUP); Utils::normalizeMarkup(htmlTestString, Utils::NO_MARKUP);
} }
} }
QTEST_MAIN(SnoreBenchmark) QTEST_MAIN(SnoreBenchmark)

View File

@ -238,7 +238,7 @@ void SnoreCore::displayExapleNotification()
QString text = QString("<i>%1</i><br>" QString text = QString("<i>%1</i><br>"
"<a href=\"https://github.com/Snorenotify/Snorenotify\">%2</a><br>").arg(tr("This is Snore"), tr("Project Website")); "<a href=\"https://github.com/Snorenotify/Snorenotify\">%2</a><br>").arg(tr("This is Snore"), tr("Project Website"));
if(!app.constHints().value("use-markup").toBool()) { if(!app.constHints().value("use-markup").toBool()) {
text = Utils::normaliseMarkup(text, Utils::NO_MARKUP); text = Utils::normalizeMarkup(text, Utils::NO_MARKUP);
} }
Notification noti(app, app.defaultAlert(), tr("Hello World"), text, app.icon()); Notification noti(app, app.defaultAlert(), tr("Hello World"), text, app.icon());
noti.addAction(Action(1, tr("Test Action"))); noti.addAction(Action(1, tr("Test Action")));

View File

@ -65,7 +65,7 @@ public:
* @param string A string to encode if needed. * @param string A string to encode if needed.
* @return if the string was rhichtext html encode string is returnd otherwise the original string. * @return if the string was rhichtext html encode string is returnd otherwise the original string.
*/ */
static QString normaliseMarkup(QString string, MARKUP_FLAGS tags); static QString normalizeMarkup(QString string, MARKUP_FLAGS tags);
/** /**
* Computes a md5 hash of the provided data. * Computes a md5 hash of the provided data.