[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:21:57 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=662c82b
The following commit has been merged in the master branch:
commit 662c82bb2f68b99e2244a66ee2b85af8a6f77646
Author: Lasath Fernando <kde at lasath.org>
Date: Tue May 1 13:02:11 2012 +1000
Actually add the tests
It turns out, I forgot to git add the tests I've referenced so
much in previous commit messages. So, here they are.
---
tests/CMakeLists.txt | 18 ++++++++++++++
tests/message-processor-basic-tests.cpp | 42 +++++++++++++++++++++++++++++++++
tests/message-processor-basic-tests.h | 38 +++++++++++++++++++++++++++++
tests/sync-processor.cpp | 35 +++++++++++++++++++++++++++
tests/sync-processor.h | 37 +++++++++++++++++++++++++++++
5 files changed, 170 insertions(+)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..7486ed9
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,18 @@
+
+
+kde4_add_unit_test(ktpchat_tests
+ TESTNAME basic-emoticon-test
+ 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}
+)
+
+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
new file mode 100644
index 0000000..4e20656
--- /dev/null
+++ b/tests/message-processor-basic-tests.cpp
@@ -0,0 +1,42 @@
+/*
+ * 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"
+
+Tp::Message normalMessage(const char* msg) {
+ return Tp::Message(Tp::ChannelTextMessageTypeNormal, QLatin1String(msg));
+}
+
+void MessageProcessorBasicTests::testEmoticons()
+{
+ QLatin1String smiley(":)");
+ QLatin1String expected("<img align=\"center\" title=\":)\" alt=\":)\" src=\"/usr/share/emoticons/kde4/smile.png\" width=\"22\" height=\"22\" />
");
+
+ QCOMPARE(s.processOutGoingMessage(Tp::Message(Tp::ChannelTextMessageTypeNormal, smiley)).finalizedMessage(), expected);
+}
+
+void MessageProcessorBasicTests::testEscaping()
+{
+ Tp::Message msg = normalMessage("<script type=\"text/javascript>
alert(\"ha!\");
</script>");
+ QString expected = QLatin1String("<script type="text/javascript><br/>alert("ha!");<br/></script>
");
+ QCOMPARE(s.processOutGoingMessage(msg).finalizedMessage(), expected);
+}
+
+QTEST_MAIN(MessageProcessorBasicTests);
+
+#include "moc_message-processor-basic-tests.cpp"
\ No newline at end of file
diff --git a/tests/message-processor-basic-tests.h b/tests/message-processor-basic-tests.h
new file mode 100644
index 0000000..20fc284
--- /dev/null
+++ b/tests/message-processor-basic-tests.h
@@ -0,0 +1,38 @@
+/*
+ * 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
+
+private:
+ SyncProcessor s;
+
+private Q_SLOTS:
+ void testEmoticons();
+ void testEscaping();
+};
+
+#endif // MESSAGE_PROCESSOR_BASIC_TESTS_H
diff --git a/tests/sync-processor.cpp b/tests/sync-processor.cpp
new file mode 100644
index 0000000..e7eb2dd
--- /dev/null
+++ b/tests/sync-processor.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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 <message-processor.h>
+
+SyncProcessor::SyncProcessor()
+{
+ this->instance = MessageProcessor::instance();
+}
+
+Message SyncProcessor::processIncommingMessage(const Tp::ReceivedMessage &message)
+{
+ return this->instance->processIncomingMessage(message);
+}
+
+Message SyncProcessor::processOutGoingMessage(Tp::Message message)
+{
+ return this->instance->processOutgoingMessage(message);
+}
diff --git a/tests/sync-processor.h b/tests/sync-processor.h
new file mode 100644
index 0000000..c433d7b
--- /dev/null
+++ b/tests/sync-processor.h
@@ -0,0 +1,37 @@
+/*
+ * 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 <message-processor.h>
+
+class SyncProcessor
+{
+
+public:
+ SyncProcessor();
+
+ Message processIncommingMessage(const Tp::ReceivedMessage& message);
+ Message processOutGoingMessage ( Tp::Message message );
+
+private:
+ MessageProcessor *instance;
+};
+
+#endif // SYNC_PROCESSOR_H
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list