[folks] Added dummy test for the new individual properties for telepathy
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Added dummy test for the new individual properties for telepathy
- Date: Tue, 12 Jun 2012 11:15:19 +0000 (UTC)
commit 2ca10cde4106f36ec41aff16347f15affc15039f
Author: Seif Lotfy <seif lotfy com>
Date: Sat Mar 24 12:02:25 2012 +0100
Added dummy test for the new individual properties for telepathy
Signed-off-by: Seif Lotfy <seif lotfy collabora co uk>
tests/telepathy/Makefile.am | 6 ++
tests/telepathy/individual-zeitgeist.vala | 100 +++++++++++++++++++++++++++++
2 files changed, 106 insertions(+), 0 deletions(-)
---
diff --git a/tests/telepathy/Makefile.am b/tests/telepathy/Makefile.am
index 5bb593c..4c5904b 100644
--- a/tests/telepathy/Makefile.am
+++ b/tests/telepathy/Makefile.am
@@ -49,6 +49,7 @@ noinst_PROGRAMS = \
persona-store-capabilities \
individual-retrieval \
individual-properties \
+ individual-zeitgeist \
init \
$(NULL)
@@ -76,6 +77,10 @@ individual_properties_SOURCES = \
individual-properties.vala \
$(NULL)
+individual_zeitgeist_SOURCES = \
+ individual-zeitgeist.vala \
+ $(NULL)
+
init_SOURCES = \
init.vala \
$(NULL)
@@ -88,6 +93,7 @@ BUILT_SOURCES = \
fake_tp_backend_vala.stamp \
individual_properties_vala.stamp \
individual_retrieval_vala.stamp \
+ individual_zeitgeist_vala.stamp \
init_vala.stamp \
persona_store_capabilities_vala.stamp \
$(NULL)
diff --git a/tests/telepathy/individual-zeitgeist.vala b/tests/telepathy/individual-zeitgeist.vala
new file mode 100644
index 0000000..6e047e2
--- /dev/null
+++ b/tests/telepathy/individual-zeitgeist.vala
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 Collabora
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Seif Lotfy <seif lotfy collabora co uk>
+ */
+
+using TpTests;
+using Folks;
+
+/* A simple test program to expose the test Telepathy account used by folksâ
+ * Telepathy tests on the current D-Bus bus. This is intended to be used for
+ * manual testing using the test Telepathy account. */
+
+private void print_individual (Individual i)
+{
+ uint new_count = i.im_interaction_count;
+ uint new_call_count = i.call_interaction_count;
+ DateTime new_call_datetime = i.last_call_interaction_datetime;
+ DateTime new_chat_datetime = i.last_im_interaction_datetime;
+ if (new_count > 0)
+ {
+ int64 timestamp = 0;
+ if (new_chat_datetime != null)
+ timestamp = new_chat_datetime.to_unix();
+ stdout.printf("\n %s\n chat interaction count: %u\n chat interaction timestamp: %lld\n", i.alias, new_count, timestamp);
+ timestamp = 0;
+ if (new_call_datetime != null)
+ timestamp = new_call_datetime.to_unix();
+ stdout.printf(" call interaction count: %u\n call interaction timestamp: %lld\n", new_call_count, timestamp);
+ }
+}
+
+public int main (string[] args)
+{
+ var main_loop = new GLib.MainLoop (null, false);
+ /* Set up the aggregator */
+ var aggregator = new IndividualAggregator ();
+
+ aggregator.notify["is-quiescent"].connect (() =>
+ {
+ foreach (Individual i in aggregator.individuals.values)
+ {
+ uint count = i.im_interaction_count;
+ uint call_count = i.call_interaction_count;
+ DateTime chat_datetime = i.last_im_interaction_datetime;
+ DateTime call_datetime = i.last_call_interaction_datetime;
+ if (count > 0)
+ {
+ int64 timestamp = 0;
+ if (chat_datetime != null)
+ timestamp = chat_datetime.to_unix();
+ stdout.printf("\n %s\n chat interaction count: %u\n chat interaction timestamp: %lld\n", i.alias, count, timestamp);
+ timestamp = 0;
+ if (call_datetime != null)
+ timestamp = call_datetime.to_unix();
+ stdout.printf(" call interaction count: %u\n call interaction timestamp: %lld\n", call_count, timestamp);
+ }
+ i.notify["im-interaction-count"].connect(() => {print_individual (i);});
+ i.notify["call-interaction-count"].connect(() => {print_individual (i);});
+ }
+ });
+
+ Idle.add (() =>
+ {
+ aggregator.prepare.begin ((s,r) =>
+ {
+ try
+ {
+ aggregator.prepare.end (r);
+ }
+ catch (GLib.Error e1)
+ {
+ GLib.critical ("Failed to prepare aggregator: %s", e1.message);
+ assert_not_reached ();
+ }
+ });
+ return false;
+ });
+
+ /* Run until we're killed. */
+ main_loop.run ();
+
+ /* Tear down .*/
+ aggregator = null;
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]