[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:23:07 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=bf4ead8
The following commit has been merged in the master branch:
commit bf4ead83776eefb81613a4c2a4984a9c62ac11a4
Author: Dan Vrátil <dvratil at redhat.com>
Date: Fri Jan 4 15:41:56 2013 +0100
Move tests to ktp-common-internals
---
CMakeLists.txt | 1 -
tests/CMakeLists.txt | 19 ---
tests/message-processor-basic-tests.cpp | 219 --------------------------------
tests/message-processor-basic-tests.h | 55 --------
tests/sync-processor.cpp | 53 --------
tests/sync-processor.h | 40 ------
6 files changed, 387 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97d72cf..93cf43f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,4 +48,3 @@ add_subdirectory(adiumxtra-protocol-handler)
add_subdirectory(logviewer)
add_subdirectory(plasmoid)
add_subdirectory(filters)
-add_subdirectory(tests)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
deleted file mode 100644
index 41b7fa4..0000000
--- a/tests/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-kde4_add_unit_test(ktpchat_tests
- TESTNAME message-processing-tests
- sync-processor.cpp
- message-processor-basic-tests.cpp
-)
-
-target_link_libraries(ktpchat_tests
- ktpchat
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${QT_QTGUI_LIBRARY}
- ${QT_QTTEST_LIBRARY}
- ${TELEPATHY_QT4_LIBRARIES}
- ${KTP_LIBRARIES}
-)
-
-add_definitions (-DQT_GUI_LIB)
\ No newline at end of file
diff --git a/tests/message-processor-basic-tests.cpp b/tests/message-processor-basic-tests.cpp
deleted file mode 100644
index 65d51bf..0000000
--- a/tests/message-processor-basic-tests.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2012 Lasath Fernando <kde at lasath.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "message-processor-basic-tests.h"
-#include <KUrl>
-#include <QTextDocument>
-
-
-#define compare(input, expected) \
-{ \
- QString processed = s.getProcessedMessage(input); \
- QString href = QLatin1String(expected); \
- QCOMPARE(processed, href); \
-}
-
-#define compareWithPlainText(input, expected) \
-{ \
- QString processed = s.getProcessedMessage(input); \
- QString href = QLatin1String(expected); \
- QCOMPARE(processed, href); \
- QTextDocument inputdoc, processeddoc; \
- inputdoc.setHtml(QLatin1String(input)); \
- processeddoc.setHtml(href); \
- QCOMPARE(inputdoc.toPlainText(), processeddoc.toPlainText()); \
-}
-
-
-
-Tp::Message normalMessage(const char* msg) {
- return Tp::Message(Tp::ChannelTextMessageTypeNormal, QLatin1String(msg));
-}
-
-void MessageProcessorBasicTests::testEmoticons()
-{
- QString processed = this->s.getProcessedMessage(":)");
- QString expected = QLatin1String("<img align=\"center\" title=\":)\" alt=\":)\" src=\"/usr/share/emoticons/kde4/smile.png\" width=\"22\" height=\"22\" />");
-
- QCOMPARE(processed, expected);
-}
-
-void MessageProcessorBasicTests::testEscaping()
-{
- QString processed = this->s.getProcessedMessage("<script type=\"text/javascript>
alert(\"ha!\");
</script>");
- QString expected = QLatin1String("<script type="text/javascript><br/>alert("ha!");<br/></script>");
-
- QCOMPARE(processed, expected);
-}
-
-void MessageProcessorBasicTests::testUrlCatching()
-{
- QString processed = this->s.getProcessedMessage("http://www.google.com.au/");
- QString href = QLatin1String("<a href=\"http://www.google.com.au/\">http://www.google.com.au/</a>");
-
- QCOMPARE(processed, href);
-}
-
-void MessageProcessorBasicTests::testURICatchingSMB() {
- QString processed = this->s.getProcessedMessage("smb://user@localhost/");
- QString href = QLatin1String("<a href=\"smb://user@localhost/\">smb://user@localhost/</a>");
-
- QCOMPARE(processed, href);
-}
-
-void MessageProcessorBasicTests::testWWWCatching() {
- QString processed = this->s.getProcessedMessage("www.google.com.au");
- QString href = QLatin1String("<a href=\"http://www.google.com.au\">www.google.com.au</a>");
-
- QCOMPARE(processed, href);
-}
-
-void MessageProcessorBasicTests::testUnsupportedProtocolCatching()
-{
- QString processed = this->s.getProcessedMessage("fakeprotocol://fakeuser@somefakehost/");
- QString href = QLatin1String("fakeprotocol://fakeuser@somefakehost/");
-
- QCOMPARE(processed, href);
-}
-
-void MessageProcessorBasicTests::testMetadataGeneration()
-{
- KTp::Message processed = this->s.processOutGoingMessage(
- Tp::Message(
- Tp::ChannelTextMessageTypeNormal,
- QLatin1String("http://www.google.com.au/")
- )
- );
-
- QVariantList urls = processed.property("Urls").toList();
- QCOMPARE(urls.length(), 1);
-
- QCOMPARE(qvariant_cast<KUrl>(urls.at(0)), KUrl("http://www.google.com.au/"));
-}
-
-void MessageProcessorBasicTests::testMultipleURLCatching()
-{
- KTp::Message processed = this->s.processOutGoingMessage(
- Tp::Message(
- Tp::ChannelTextMessageTypeNormal,
- QLatin1String("You should consider using http://duckduckgo.com/ instead of www.google.com.au")
- )
- );
-
- QVariantList urls = processed.property("Urls").toList();
- QCOMPARE(urls.length(), 2);
-
- QCOMPARE(qvariant_cast<KUrl>(urls.at(0)), KUrl("http://duckduckgo.com/"));
- QCOMPARE(qvariant_cast<KUrl>(urls.at(1)), KUrl("http://www.google.com.au"));
-}
-
-void MessageProcessorBasicTests::textRichTextUrlParsing()
-{
- compare("go to http://example.com/page.php?code=",
- "go to <a href=\"http://example.com/page.php?code=123"\">http://example.com/page.php?code=123"</a>");
-}
-
-
-void MessageProcessorBasicTests::testImageEmbedGIF()
-{
- const char* message = "http://kde.org/images/teaser/jointhegame.gif";
- const char* imgTag =
- "<a href=\"http://kde.org/images/teaser/jointhegame.gif\">"
- "http://kde.org/images/teaser/jointhegame.gif"
- "</a>
"
- "<br/><a href=\"http://kde.org/images/teaser/jointhegame.gif\">"
- "<img src=\"http://kde.org/images/teaser/jointhegame.gif\""
- " style=\"max-width:100%;margin-top:3px\""
- " alt=\"Click to view in browser\" />"
- "</a>";
-
- compare(message, imgTag);
-}
-
-void MessageProcessorBasicTests::testXSS()
-{
- compare("<script>alert('ha!');</script>", "<script>alert('ha!');</script>");
-}
-
-// void MessageProcessorBasicTests::testSearchExpansion()
-// {
- //let's assume the user hasn't messed with their web shortcuts
-// compare("gg:kde", "http://www.google.com/search?q=kde&ie=UTF-8&oe=UTF-8");
-// }
-
-void MessageProcessorBasicTests::testUsingAColon()
-{
- compare("It should still leave normal stuff with:acolon alone", "It should still leave normal stuff with:acolon alone");
-}
-
-// void MessageProcessorBasicTests::testSearchExpansionWithPadding()
-// {
-// compare(" gg:kde
", "http://www.google.com/search?q=kde&ie=UTF-8&oe=UTF-8");
-// }
-
-void MessageProcessorBasicTests::testBold()
-{
- compareWithPlainText("*b*", "<b>*b*</b>");
- compareWithPlainText("*bold*", "<b>*bold*</b>");
- compareWithPlainText("*this* should *be in bold*", "<b>*this*</b> should <b>*be in bold*</b>");
-}
-
-void MessageProcessorBasicTests::testItalics()
-{
- compareWithPlainText("/i/", "<i>/i/</i>");
- compareWithPlainText(" /this/ should /be in italics/", "<i>/this/</i> should <i>/be in italics/</i>");
- compareWithPlainText("/all / this /should/ be in italics/", "<i>/all / this /should/</i> be in italics/");
- compareWithPlainText("/f f/ fd /f f/", "<i>/f f/</i> fd <i>/f f/</i>");
- compareWithPlainText("/f /f/", "<i>/f /f/</i>");
- compareWithPlainText("/dsd / / ss/", "<i>/dsd / / ss/</i>");
-}
-
-void MessageProcessorBasicTests::testStrikethrough()
-{
- compareWithPlainText("-s-", "<s>-s-</s>");
- compareWithPlainText("-strike through-", "<s>-strike through-</s>");
-}
-
-void MessageProcessorBasicTests::testUnderline()
-{
- compareWithPlainText("_u_", "<u>_u_</u>");
- compareWithPlainText("_underlined_", "<u>_underlined_</u>");
- compareWithPlainText("_this_ should _be underlined_", "<u>_this_</u> should <u>_be underlined_</u>");
-}
-
-void MessageProcessorBasicTests::testBoldItalics()
-{
- compareWithPlainText("/*this is italics bold*/", "<i>/<b>*this is italics bold*</b>/</i>");
- compareWithPlainText("*/this is bold italics/*", "<b>*<i>/this is bold italics/</i>*</b>");
-
- compareWithPlainText("this is /*italics bold*/ , this is */bold italics/*", "this is <i>/<b>*italics bold*</b>/</i> , this is <b>*<i>/bold italics/</i>*</b>");
-
-// compareWithPlainText("/*this is wrong italics bold/*", "/*this is wrong italics bold/*");
-// compareWithPlainText("this has a /punctuation mark/, after the slash", "this has a <i>/punctuation mark/</i>, after the slash");
-}
-
-void MessageProcessorBasicTests::testRandomFormatting()
-{
- compareWithPlainText("/this *should* work/ but /let's be *sure*/", "<i>/this <b>*should*</b> work/</i> but <i>/let's be <b>*sure*</b>/</i>");
- compareWithPlainText("/this -should- work/ and /this -should- work as well/", "<i>/this <s>-should-</s> work/</i> and <i>/this <s>-should-</s> work as well/</i>");
-}
-
-
-QTEST_MAIN(MessageProcessorBasicTests);
-
-#include "moc_message-processor-basic-tests.cpp"
diff --git a/tests/message-processor-basic-tests.h b/tests/message-processor-basic-tests.h
deleted file mode 100644
index 452ac08..0000000
--- a/tests/message-processor-basic-tests.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2012 Lasath Fernando <kde at lasath.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef MESSAGE_PROCESSOR_BASIC_TESTS_H
-#define MESSAGE_PROCESSOR_BASIC_TESTS_H
-
-#include <QTest>
-#include <QtCore/QObject>
-#include "sync-processor.h"
-
-class MessageProcessorBasicTests : public QObject
-{
-Q_OBJECT
-
- SyncProcessor s;
-
-private Q_SLOTS:
- void testEmoticons();
- void testEscaping();
- void testUrlCatching();
- void testWWWCatching();
- void testURICatchingSMB();
- void testUnsupportedProtocolCatching();
- void testMetadataGeneration();
- void testMultipleURLCatching();
- void textRichTextUrlParsing();
- void testImageEmbedGIF();
- void testXSS();
-// void testSearchExpansion();
- void testUsingAColon();
-// void testSearchExpansionWithPadding();
- void testItalics();
- void testBold();
- void testStrikethrough();
- void testUnderline();
- void testBoldItalics();
- void testRandomFormatting();
-};
-
-#endif // MESSAGE_PROCESSOR_BASIC_TESTS_H
diff --git a/tests/sync-processor.cpp b/tests/sync-processor.cpp
deleted file mode 100644
index 324f4be..0000000
--- a/tests/sync-processor.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2012 Lasath Fernando <kde at lasath.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "sync-processor.h"
-#include <KTp/message-processor.h>
-
-#include <QString>
-
-struct SyncProcessor::SyncProcessorPrivate {
- KTp::MessageProcessor *actualProcessor;
-};
-
-SyncProcessor::SyncProcessor() :
- d(new SyncProcessor::SyncProcessorPrivate())
-{
- d->actualProcessor = KTp::MessageProcessor::instance();
-}
-
-KTp::Message SyncProcessor::processIncommingMessage(const Tp::ReceivedMessage &message)
-{
- return d->actualProcessor->processIncomingMessage(message);
-}
-
-KTp::Message SyncProcessor::processOutGoingMessage(Tp::Message message)
-{
- return d->actualProcessor->processOutgoingMessage(message);
-}
-
-QString SyncProcessor::getProcessedMessage(const char* contents)
-{
- Tp::Message message = Tp::Message(Tp::ChannelTextMessageTypeNormal, QLatin1String(contents));
- QString processed = processOutGoingMessage(message).finalizedMessage();
- return processed.trimmed();
-}
-
-SyncProcessor::~SyncProcessor() {
- delete d;
-}
\ No newline at end of file
diff --git a/tests/sync-processor.h b/tests/sync-processor.h
deleted file mode 100644
index 40a25fa..0000000
--- a/tests/sync-processor.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 Lasath Fernando <kde at lasath.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef SYNC_PROCESSOR_H
-#define SYNC_PROCESSOR_H
-
-#include <KTp/message-processor.h>
-
-class SyncProcessor
-{
-
-public:
- SyncProcessor();
- ~SyncProcessor();
-
- KTp::Message processIncommingMessage(const Tp::ReceivedMessage& message);
- KTp::Message processOutGoingMessage ( Tp::Message message );
- QString getProcessedMessage ( const char* contents );
-
-private:
- class SyncProcessorPrivate;
- SyncProcessorPrivate *d;
-};
-
-#endif // SYNC_PROCESSOR_H
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list